Passed
Push — master ( 32d12e...054be4 )
by shjchen
02:23
created

helpers.php ➔ settings()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 4.3731

Importance

Changes 0
Metric Value
cc 4
nc 4
nop 2
dl 0
loc 16
ccs 5
cts 7
cp 0.7143
crap 4.3731
rs 9.7333
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of ibrand/setting.
5
 *
6
 * (c) iBrand <https://www.ibrand.cc>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
if (!function_exists('settings')) {
13
14
    /**
15
     * get settings.
16
     * @param null $key
17
     * @param null $value
18
     * @return \Illuminate\Foundation\Application|mixed|string
19
     */
20
    function settings($key = null, $value=null)
21
    {
22 2
        if (is_null($key)) {
23
            return app('system_setting');
24
        }
25
		
26 2
        if (is_string($key)) {
27 2
            return app('system_setting')->getSetting($key,$value);
28
        }
29
30 2
        if (is_array($key)) {
31 2
            return app('system_setting')->setSetting($key);
32
        }
33
34
        return '';
35
    }
36
}
37