/** * 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 }