Go\Aop\Intercept\FunctionInvocation::getFunction PHP Method

getFunction() public method

Gets the function being called.
public getFunction ( ) : ReflectionFunction
return ReflectionFunction the function being called.
    public function getFunction();

Usage Example

 /**
  * This advice intercepts an access to the file_get_contents() function
  *
  * @param FunctionInvocation $invocation
  *
  * @Around("execution(Demo\Example\file_get_contents(*))")
  *
  * @return mixed
  */
 public function aroundFileGetContents(FunctionInvocation $invocation)
 {
     echo 'Calling Around Interceptor for function: ', $invocation->getFunction()->getName(), '()', ' with arguments: ', json_encode($invocation->getArguments()), PHP_EOL;
     // return $invocation->proceed(); // Do not call original file_get_contents()
     return 'Hello!';
     // Override return value for function
 }
FunctionInvocation