| Conditions | 4 |
| Paths | 8 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | protected static function getConstants(): array |
||
| 21 | { |
||
| 22 | $calledClass = get_called_class(); |
||
| 23 | if (!array_key_exists($calledClass, self::$constCacheArray)) { |
||
| 24 | try { |
||
| 25 | $reflect = new ReflectionClass($calledClass); |
||
| 26 | |||
| 27 | /** @var array<string,scalar> $values */ |
||
| 28 | $values = $reflect->getConstants(); |
||
| 29 | |||
| 30 | self::$constCacheArray[$calledClass] = $values; |
||
| 31 | } catch (ReflectionException $e) { |
||
| 32 | return []; |
||
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 36 | return self::$constCacheArray[$calledClass]; |
||
| 37 | } |
||
| 61 |