Conditions | 2 |
Paths | 1 |
Total Lines | 13 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 2 |
Changes | 2 | ||
Bugs | 1 | Features | 1 |
1 | <?php |
||
17 | 29 | public function handle(string $input): string |
|
18 | { |
||
19 | |||
20 | 29 | return preg_replace_callback( |
|
21 | 29 | '/(%)([A-Z_0-9]+)(%)/', |
|
22 | 29 | function (array $matches) { |
|
23 | 6 | return |
|
24 | 6 | $_ENV[$matches[2]] |
|
25 | 6 | ?? $_SERVER[$matches[2]] |
|
26 | 6 | ?? (getenv($matches[2]) === false ? $matches[1] . $matches[2] . $matches[3] : getenv($matches[2])); |
|
27 | 29 | }, |
|
28 | 29 | $input |
|
29 | 29 | ) ?? ''; |
|
30 | } |
||
32 |