Test Failed
Push — master ( 36b93f...f31f2a )
by shjchen
14:19
created

helpers.php ➔ settings()   A

Complexity

Conditions 5
Paths 5

Size

Total Lines 20

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 12.4085

Importance

Changes 0
Metric Value
cc 5
nc 5
nop 1
dl 0
loc 20
ccs 3
cts 9
cp 0.3333
crap 12.4085
rs 9.2888
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
     * @param null $key
15
     * @return \Illuminate\Foundation\Application|mixed|string
16
     */
17
    function settings($key = null)
18
    {
19 1
        if (is_null($key)) {
20
            return app('system_setting');
21
        }
22
23 1
		if (app()->runningInConsole()) {
24 1
            return '';
25
        }
26
		
27
        if (is_string($key)) {
28
            return app('system_setting')->getSetting($key);
29
        }
30
31
        if (is_array($key)) {
32
            return app('system_setting')->setSetting($key);
33
        }
34
35
        return '';
36
    }
37
}
38