Conditions | 4 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 4.0466 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
25 | 10 | protected function validateBoolean(Node $node, string $functionName): void |
|
26 | { |
||
27 | 10 | if (!$node instanceof Literal || !\is_string($node->value)) { |
|
28 | throw InvalidBooleanException::forNonLiteralNode($node::class, $functionName); |
||
29 | } |
||
30 | |||
31 | 10 | $value = \strtolower(\trim((string) $node->value, "'\"")); |
|
32 | 10 | $lowercaseValue = \strtolower($value); |
|
33 | |||
34 | 10 | if (!$this->isValidBoolean($lowercaseValue)) { |
|
35 | 5 | throw InvalidBooleanException::forInvalidBoolean($value, $functionName); |
|
36 | } |
||
44 |