| Conditions | 7 |
| Paths | 10 |
| Total Lines | 27 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 7.0178 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | 7 | public function getEnums(object|string|null $target = null): array |
|
| 17 | { |
||
| 18 | 7 | if (!empty($target)) { |
|
| 19 | 4 | $target = new \ReflectionClass($target); |
|
| 20 | } |
||
| 21 | |||
| 22 | 7 | $result = []; |
|
| 23 | 7 | foreach ($this->availableEnums() as $enum) { |
|
| 24 | try { |
||
| 25 | 7 | $reflection = $this->enumReflection($enum); |
|
| 26 | 6 | } catch (LocatorException $e) { |
|
| 27 | 6 | if ($this->debug) { |
|
| 28 | throw $e; |
||
| 29 | } |
||
| 30 | |||
| 31 | //Ignoring |
||
| 32 | 6 | continue; |
|
| 33 | } |
||
| 34 | |||
| 35 | 7 | if (!$this->isTargeted($reflection, $target) || $reflection->isInterface()) { |
|
| 36 | 4 | continue; |
|
| 37 | } |
||
| 38 | |||
| 39 | 7 | $result[$reflection->getName()] = $reflection; |
|
| 40 | } |
||
| 41 | |||
| 42 | 7 | return $result; |
|
| 43 | } |
||
| 81 |