Completed
Push — master ( d0ff07...576091 )
by Xeriab
04:55
created

Utils::arrayGet()   C

Complexity

Conditions 11
Paths 8

Size

Total Lines 32
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 132

Importance

Changes 0
Metric Value
dl 0
loc 32
ccs 0
cts 25
cp 0
rs 5.2653
c 0
b 0
f 0
cc 11
eloc 16
nc 8
nop 3
crap 132

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
/**
4
 * Konfig
5
 *
6
 * Yet another simple configuration loader library.
7
 *
8
 * @author  Xeriab Nabil (aka KodeBurner) <[email protected]>
9
 * @license https://raw.github.com/xeriab/konfig/master/LICENSE MIT
10
 * @link    https://xeriab.github.io/projects/konfig
11
 */
12
13
namespace Exen\Konfig;
14
15
use Closure;
16
17
final class Utils
18
{
19
    /**
20
     * Includes the given file and returns the results.
21
     *
22
     * @param string The path to the file
23
     * @return mixed The results of the include
24
     * @since 0.1.0
25
     */
26
    public static function load($file = null)
27
    {
28
        return require_once $file;
29
    }
30
31
    /**
32
     * Takes a value and checks if it's a Closure or not, if it's a Closure it
33
     * will return the result of the closure, if not, it will simply return the
34
     * value.
35
     *
36
     * @param mixed $var The value to get
37
     * @return mixed
38
     * @since 0.1.0
39
     */
40
    public static function checkValue($var = null)
41
    {
42
        return ($var instanceof Closure) ? $var() : $var;
43
    }
44
45
    /**
46
     * @return string
47
     * @since 0.1.2
48
     */
49
    public function __toString()
50
    {
51
        return 'Exen\Konfig\Utils' . PHP_EOL;
52
    }
53
}
54
55
#: END OF ./src/Utils.php FILE
56