| Conditions | 5 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 56 | 14 | public static function get(string $key, $default = null) |
|
| 57 | { |
||
| 58 | 14 | if (($value = getenv($key)) === false) { |
|
| 59 | 1 | return self::value($default); |
|
| 60 | } |
||
| 61 | |||
| 62 | 13 | if (array_key_exists(strtolower($value), self::$valuesMatches)) { |
|
| 63 | 8 | return self::$valuesMatches[strtolower($value)]; |
|
| 64 | } |
||
| 65 | |||
| 66 | 5 | if (strlen($value) > 1 && Str::startsEndsWith($value, ['"', '\''])) { |
|
| 67 | 3 | return substr($value, 1, -1); |
|
| 68 | } |
||
| 69 | |||
| 70 | 2 | return $value; |
|
| 71 | } |
||
| 72 | } |
||
| 73 |