Total Complexity | 11 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
5 | class SystemParser |
||
6 | { |
||
7 | public static $isCalled = false; |
||
8 | public static $sysvar = array(); |
||
9 | |||
10 | public function __construct() |
||
11 | { |
||
12 | if (!self::$isCalled) { |
||
13 | self::$isCalled = true; |
||
14 | self::$sysvar = static::parse(); |
||
15 | } |
||
16 | } |
||
17 | |||
18 | public static function parse() |
||
19 | { |
||
20 | if (function_exists('getenv')) { |
||
21 | return getenv(); |
||
22 | } |
||
23 | |||
24 | if (!empty($_ENV)) { |
||
25 | return $_ENV; |
||
26 | } |
||
27 | } |
||
28 | |||
29 | public static function getValues($variable = null) |
||
30 | { |
||
31 | if (!is_null($variable)) { |
||
32 | if (isset(self::$sysvar[$variable])) { |
||
33 | return self::$sysvar[$variable]; |
||
34 | } else { |
||
35 | return null; |
||
36 | } |
||
37 | } |
||
38 | |||
39 | return static::getAllEnvVariables(); |
||
40 | } |
||
41 | |||
42 | public static function checkValue($variable) |
||
43 | { |
||
44 | if (isset(self::$sysvar[$variable])) { |
||
45 | return true; |
||
46 | } |
||
47 | |||
48 | return false; |
||
49 | } |
||
50 | |||
51 | private static function getAllEnvVariables() |
||
54 | } |
||
55 | } |
||
56 |