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

Utils::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
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