| Total Complexity | 3 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | trait GetConstantsTrait |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * Used to store an array of constants |
||
| 18 | * |
||
| 19 | * @var array |
||
| 20 | */ |
||
| 21 | private static $constants = []; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Fills constants array if it is empty and returns it |
||
| 25 | * |
||
| 26 | * @return array |
||
| 27 | */ |
||
| 28 | private function getConstants(): array |
||
| 29 | { |
||
| 30 | if (empty(self::$constants)) { |
||
| 31 | self::$constants = (new ReflectionClass($this))->getConstants(); |
||
| 32 | } |
||
| 33 | |||
| 34 | return self::$constants; |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Fills constants array if it is empty and returns it |
||
| 39 | * |
||
| 40 | * @param mixed $value |
||
| 41 | * |
||
| 42 | * @return bool |
||
| 43 | */ |
||
| 44 | private function constantValueExists($value): bool |
||
| 47 | } |
||
| 48 | } |
||
| 49 |