Passed
Push — master ( 80267f...ba90ad )
by Zlatin
03:06
created

env()   B

Complexity

Conditions 6
Paths 5

Size

Total Lines 14
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 6
eloc 12
nc 5
nop 1
dl 0
loc 14
rs 8.8571
c 1
b 0
f 0
1
<?php
2
if (!function_exists('env')) {
3
4
    function env($name)
5
    {
6
        $value = getenv($name);
7
        switch ($value) {
8
            case 'true':
9
                return true;
10
            case 'false':
11
                return false;
12
            case 'null' :
13
                return null;
14
            case substr($value, 0, 1) === '"' || substr($value, 0, 1) === "'" :
15
                return substr($value, 1, -1);
16
            default:
17
                return $value;
18
        }
19
    }
20
}
21