Conditions | 7 |
Paths | 5 |
Total Lines | 27 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
31 | public function getRoutes(ReflectionClass $class): array |
||
32 | { |
||
33 | $addRoutes = []; |
||
34 | $removeRoutes = []; |
||
35 | |||
36 | foreach ($this->getClassAnnotations($class) as $annotation) { |
||
37 | if (($annotation instanceof AddRoute |
||
38 | || $annotation instanceof RemoveRoute) |
||
39 | && !isset($annotation->name)) { |
||
40 | throw new MissingAnnotationArgumentException( |
||
41 | $annotation, |
||
42 | 'name', |
||
43 | $class |
||
44 | ); |
||
45 | } |
||
46 | |||
47 | if ($annotation instanceof AddRoute) { |
||
48 | $addRoutes[$annotation->name] = $annotation; |
||
49 | continue; |
||
50 | } |
||
51 | |||
52 | if ($annotation instanceof RemoveRoute) { |
||
53 | $removeRoutes[$annotation->name] = $annotation; |
||
54 | } |
||
55 | } |
||
56 | |||
57 | return [$addRoutes, $removeRoutes]; |
||
58 | } |
||
61 |