1 | <?php |
||
22 | class PropertyInterceptorAspect implements Aspect |
||
23 | { |
||
24 | |||
25 | /** |
||
26 | * Advice that controls an access to the properties |
||
27 | * |
||
28 | * @param FieldAccess $fieldAccess Joinpoint |
||
29 | * |
||
30 | * @Around("access(public|protected Demo\Example\PropertyDemo->*)") |
||
31 | * @return mixed |
||
32 | */ |
||
33 | public function aroundFieldAccess(FieldAccess $fieldAccess) |
||
34 | { |
||
35 | $value = $fieldAccess->proceed(); |
||
36 | echo "Calling Around Interceptor for ", $fieldAccess, ", value: ", json_encode($value), PHP_EOL; |
||
37 | |||
38 | // $value = 666; You can change the return value for read/write operations in advice! |
||
39 | return $value; |
||
40 | } |
||
41 | } |
||
42 |