1 | <?php |
||
9 | trait ControllerAnnotationExtractorTrait |
||
10 | { |
||
11 | abstract protected function getAnnotationReader(): Reader; |
||
12 | |||
13 | /** |
||
14 | * @param null|callable $controller |
||
15 | * @param string $annotationClass |
||
16 | * |
||
17 | * @return null|object |
||
18 | */ |
||
19 | 2 | protected function getClassAnnotationFromController(?callable $controller, string $annotationClass) |
|
20 | { |
||
21 | 2 | $objectToReflect = $this->getObjectToReflect($controller); |
|
22 | |||
23 | 2 | if (is_object($objectToReflect)) { |
|
24 | 2 | return $this->getAnnotationReader()->getClassAnnotation( |
|
25 | 2 | new \ReflectionObject($objectToReflect), |
|
26 | 2 | $annotationClass |
|
27 | ); |
||
28 | } |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * @param null|callable $controller |
||
33 | * @param string $annotationClass |
||
34 | * |
||
35 | * @return null|object |
||
36 | */ |
||
37 | 2 | protected function getMethodAnnotationFromController(?callable $controller, string $annotationClass) |
|
49 | |||
50 | /** |
||
51 | * @param null|callable $controller |
||
52 | * |
||
53 | * @return null|object |
||
54 | */ |
||
55 | 2 | protected function getObjectToReflect(?callable $controller) |
|
65 | } |
||
66 |