1 | <?php |
||
25 | class DefaultPointcutAdvisor extends AbstractGenericPointcutAdvisor |
||
26 | { |
||
27 | |||
28 | /** |
||
29 | * Pointcut instance |
||
30 | * |
||
31 | * @var Pointcut |
||
32 | */ |
||
33 | private $pointcut; |
||
34 | |||
35 | /** |
||
36 | * Create a DefaultPointcutAdvisor, specifying Pointcut and Advice. |
||
37 | * |
||
38 | * @param Pointcut $pointcut The Pointcut targeting the Advice |
||
39 | * @param Advice $advice The Advice to run when Pointcut matches |
||
40 | */ |
||
41 | 2 | public function __construct(Pointcut $pointcut, Advice $advice) |
|
46 | |||
47 | /** |
||
48 | * {@inheritdoc} |
||
49 | */ |
||
50 | 2 | public function getAdvice() |
|
51 | { |
||
52 | 2 | $advice = parent::getAdvice(); |
|
53 | 2 | if (($advice instanceof Interceptor) && ($this->pointcut->getKind() & PointFilter::KIND_DYNAMIC)) { |
|
54 | $advice = new DynamicInvocationMatcherInterceptor( |
||
55 | $this->pointcut, |
||
56 | $advice |
||
57 | ); |
||
58 | } |
||
59 | |||
60 | 2 | return $advice; |
|
61 | } |
||
62 | |||
63 | |||
64 | /** |
||
65 | * Get the Pointcut that drives this advisor. |
||
66 | * |
||
67 | * @return Pointcut The pointcut |
||
68 | */ |
||
69 | 2 | public function getPointcut() |
|
73 | |||
74 | /** |
||
75 | * Specify the pointcut targeting the advice. |
||
76 | * |
||
77 | * @param Pointcut $pointcut The Pointcut targeting the Advice |
||
78 | */ |
||
79 | public function setPointcut(Pointcut $pointcut) |
||
83 | |||
84 | /** |
||
85 | * Return string representation of object |
||
86 | * |
||
87 | * @return string |
||
88 | */ |
||
89 | public function __toString() |
||
96 | } |
||
97 |