Conditions | 4 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
27 | 4 | public function execute(mixed $parameter, array $options = []): mixed |
|
28 | { |
||
29 | 4 | if (!is_string($parameter)) { |
|
30 | 1 | throw new \InvalidArgumentException('Constant parameter must be a string'); |
|
31 | } |
||
32 | |||
33 | 3 | if (!defined($parameter) && array_key_exists('default', $options)) { |
|
34 | 1 | return $options['default']; |
|
35 | } |
||
36 | |||
37 | 2 | return constant($parameter); |
|
38 | } |
||
40 |