Total Complexity | 5 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
10 | class AnnotationUtils |
||
11 | { |
||
12 | /** |
||
13 | * Returns a class annotation. Finds in the parents if not found in the main class. |
||
14 | * |
||
15 | * @return object|null |
||
16 | */ |
||
17 | public static function getClassAnnotation(Reader $reader, ReflectionClass $refClass, string $annotationClass) |
||
18 | { |
||
19 | do { |
||
20 | $type = $reader->getClassAnnotation($refClass, $annotationClass); |
||
21 | if ($type !== null) { |
||
22 | return $type; |
||
23 | } |
||
24 | $refClass = $refClass->getParentClass(); |
||
25 | } while ($refClass); |
||
26 | return null; |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * Returns the class annotations. Finds in the parents too. |
||
31 | * |
||
32 | * @return object[] |
||
33 | */ |
||
34 | public static function getClassAnnotations(Reader $reader, ReflectionClass $refClass): array |
||
42 | } |
||
43 | } |