| Conditions | 4 |
| Paths | 4 |
| Total Lines | 12 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 75 | 9 | public static function getenv($key, $default = null) |
|
|
2 ignored issues
–
show
|
|||
| 76 | { |
||
| 77 | 6 | switch (true) { |
|
| 78 | 9 | case array_key_exists($key, $_ENV): |
|
| 79 | 3 | return $_ENV[$key]; |
|
| 80 | 6 | case array_key_exists($key, $_SERVER): |
|
| 81 | 3 | return $_SERVER[$key]; |
|
| 82 | 2 | default: |
|
| 83 | 3 | $value = getenv($key); |
|
| 84 | 3 | return $value === false ? $default : $value; |
|
| 85 | 2 | } |
|
| 86 | } |
||
| 87 | } |
||
| 88 |