| 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 = $this->parse(); |
||
| 15 | } |
||
| 16 | } |
||
| 17 | |||
| 18 | public function parse() |
||
| 19 | { |
||
| 20 | if (!empty($_ENV)) { |
||
| 21 | return $_ENV; |
||
| 22 | } |
||
| 23 | |||
| 24 | if (function_exists('getenv')) { |
||
| 25 | return getenv(); |
||
| 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) |
||
| 49 | } |
||
| 50 | |||
| 51 | private static function getAllEnvVariables() |
||
| 52 | { |
||
| 56 |