| Conditions | 5 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 5 |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | public function supports($value): bool |
||
| 16 | { |
||
| 17 | 5 | if (!\is_string($value)) { |
|
| 18 | return false; |
||
| 19 | 5 | } |
|
| 20 | 1 | ||
| 21 | $matches = []; |
||
|
|
|||
| 22 | |||
| 23 | 4 | if (null === $matches = $this->extract($value)) { |
|
| 24 | return false; |
||
| 25 | 4 | } |
|
| 26 | 1 | ||
| 27 | if (!class_exists($matches['class']) && !interface_exists($matches['class'])) { |
||
| 28 | return false; |
||
| 29 | 3 | } |
|
| 30 | 1 | ||
| 31 | $constants = (new ReflectionClass($matches['class'])) |
||
| 32 | ->getConstants() |
||
| 33 | 2 | ; |
|
| 34 | 2 | ||
| 35 | return \array_key_exists($matches['constant'], $constants); |
||
| 36 | } |
||
| 64 |