Go\Aop\Framework\AroundInterceptor::invoke PHP Method

invoke() public method

Around invoker
public invoke ( Go\Aop\Intercept\Joinpoint $joinpoint ) : mixed
$joinpoint Go\Aop\Intercept\Joinpoint the concrete joinpoint
return mixed the result of the call to {@link Joinpoint::proceed()}
    public function invoke(Joinpoint $joinpoint)
    {
        $adviceMethod = $this->adviceMethod;
        return $adviceMethod($joinpoint);
    }

Usage Example

 public function testInvocationIsCalledWithinAdvice()
 {
     $sequence = array();
     $advice = function (Invocation $invocation) use(&$sequence) {
         $sequence[] = 'advice';
         $result = $invocation->proceed();
         $sequence[] = 'advice';
         return $result;
     };
     $invocation = $this->getInvocation($sequence);
     $interceptor = new AroundInterceptor($advice);
     $result = $interceptor->invoke($invocation);
     $this->assertEquals('invocation', $result, "Advice should return an original return value");
     $this->assertEquals(array('advice', 'invocation', 'advice'), $sequence, "Around logic should work");
 }
AroundInterceptor