1 | <?php |
||
19 | class MatchInheritedPointcut implements Pointcut |
||
20 | { |
||
21 | use PointcutClassFilterTrait; |
||
22 | |||
23 | /** |
||
24 | * Performs matching of point of code |
||
25 | * |
||
26 | * @param mixed $point Specific part of code, can be any Reflection class |
||
27 | * @param null|mixed $context Related context, can be class or namespace |
||
28 | * @param null|string|object $instance Invocation instance or string for static calls |
||
29 | * @param null|array $arguments Dynamic arguments for method |
||
30 | * |
||
31 | * @return bool |
||
32 | */ |
||
33 | public function matches($point, $context = null, $instance = null, array $arguments = null) |
||
34 | { |
||
35 | if (!$context instanceof \ReflectionClass) { |
||
36 | return false; |
||
37 | }; |
||
38 | |||
39 | if (!($point instanceof \ReflectionMethod) && !($point instanceof \ReflectionProperty)) { |
||
40 | return false; |
||
41 | } |
||
42 | |||
43 | $declaringClassName = $point->getDeclaringClass()->name; |
||
44 | |||
45 | return $context->name !== $declaringClassName && $context->isSubclassOf($declaringClassName); |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * Returns the kind of point filter |
||
50 | * |
||
51 | * @return integer |
||
52 | */ |
||
53 | 1 | public function getKind() |
|
57 | } |
||
58 |