Conditions | 2 |
Paths | 2 |
Total Lines | 9 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
25 | 25 | public function getAttribute(ReflectionClass|ReflectionMethod|ReflectionParameter $reflector, string $attributeName): object |
|
26 | { |
||
27 | 25 | $attributes = $reflector->getAttributes($attributeName); |
|
28 | |||
29 | 25 | if ($attributes === []) { |
|
30 | 9 | throw ParseException::missingAttribute($reflector->getName(), $attributeName); |
|
31 | } |
||
32 | |||
33 | 22 | return array_pop($attributes)->newInstance(); |
|
34 | } |
||
36 |