helpers.php ➔ settings()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 4

Importance

Changes 0
Metric Value
cc 4
nc 4
nop 2
dl 0
loc 16
ccs 7
cts 7
cp 1
crap 4
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 3
        if (is_null($key)) {
23 1
            return app('system_setting');
24
        }
25
		
26 3
        if (is_string($key)) {
27 2
            return app('system_setting')->getSetting($key,$value);
28
        }
29
30 3
        if (is_array($key)) {
31 2
            return app('system_setting')->setSetting($key);
32
        }
33
34 1
        return '';
35
    }
36
}
37