Test Failed
Push — master ( 3f3d5c...32d12e )
by
unknown
02:12
created

helpers.php ➔ settings()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 20

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 4.0466

Importance

Changes 0
Metric Value
cc 4
nc 4
nop 2
dl 0
loc 20
ccs 6
cts 7
cp 0.8571
crap 4.0466
rs 9.6
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,$value=null)
18
    {
19 2
        if (is_null($key)) {
20 1
            return app('system_setting');
21
        }
22
23
//		if (app()->runningInConsole()) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
57% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
24
//            return '';
25
//        }
26
		
27 1
        if (is_string($key)) {
28 1
            return app('system_setting')->getSetting($key,$value);
29
        }
30
31 1
        if (is_array($key)) {
32 1
            return app('system_setting')->setSetting($key);
33
        }
34
35
        return '';
36
    }
37
}
38