1 | <?php |
||
22 | class AnnotationPointcut implements Pointcut |
||
23 | { |
||
24 | use PointcutClassFilterTrait; |
||
25 | /** |
||
26 | * Annotation class to match |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $annotationName = ''; |
||
31 | |||
32 | /** |
||
33 | * Annotation reader |
||
34 | * |
||
35 | * @var null|Reader |
||
36 | */ |
||
37 | protected $annotationReader = null; |
||
38 | |||
39 | /** |
||
40 | * Kind of current filter, can be KIND_CLASS, KIND_METHOD, KIND_PROPERTY, KIND_TRAIT |
||
41 | * |
||
42 | * @var int |
||
43 | */ |
||
44 | protected $filterKind = 0; |
||
45 | |||
46 | /** |
||
47 | * Specifies name of the expected class to receive |
||
48 | * |
||
49 | * @var string |
||
50 | */ |
||
51 | protected $expectedClass = ''; |
||
52 | |||
53 | /** |
||
54 | * Method to call for annotation reader |
||
55 | * |
||
56 | * @var string |
||
57 | */ |
||
58 | protected $annotationMethod = ''; |
||
59 | |||
60 | /** |
||
61 | * Static mappings of kind to expected class and method name |
||
62 | * |
||
63 | * @var array |
||
64 | */ |
||
65 | protected static $mappings = [ |
||
66 | self::KIND_CLASS => [ReflectionClass::class, 'getClassAnnotation'], |
||
67 | self::KIND_TRAIT => [ReflectionClass::class, 'getClassAnnotation'], |
||
68 | self::KIND_METHOD => [ReflectionMethod::class, 'getMethodAnnotation'], |
||
69 | self::KIND_PROPERTY => [ReflectionProperty::class, 'getPropertyAnnotation'] |
||
70 | ]; |
||
71 | |||
72 | /** |
||
73 | * Annotation matcher constructor |
||
74 | * |
||
75 | * @param integer $filterKind Kind of filter, e.g. KIND_CLASS |
||
76 | * @param Reader $reader Reader of annotations |
||
77 | * @param string $annotationName Annotation class name to match |
||
78 | */ |
||
79 | 3 | public function __construct($filterKind, Reader $reader, $annotationName) |
|
90 | |||
91 | /** |
||
92 | * @param ReflectionClass|ReflectionMethod|ReflectionProperty $point |
||
93 | * {@inheritdoc} |
||
94 | */ |
||
95 | public function matches($point) |
||
106 | |||
107 | /** |
||
108 | * Returns the kind of point filter |
||
109 | * |
||
110 | * @return integer |
||
111 | */ |
||
112 | public function getKind() |
||
116 | } |
||
117 |