1 | <?php |
||
26 | class FluentInterfaceAspect implements Aspect |
||
27 | { |
||
28 | /** |
||
29 | * Fluent interface advice |
||
30 | * |
||
31 | * @Around("within(Demo\Aspect\FluentInterface+) && execution(public **->set*(*))") |
||
32 | * |
||
33 | * @param MethodInvocation $invocation |
||
34 | * @return mixed|null|object |
||
35 | */ |
||
36 | protected function aroundMethodExecution(MethodInvocation $invocation) |
||
37 | { |
||
38 | $result = $invocation->proceed(); |
||
39 | |||
40 | return $result !== null ? $result : $invocation->getThis(); |
||
41 | } |
||
42 | } |
||
43 |