/** * @Go\After("execution(public **->*(*))") * * @param AbstractMethodInvocation $methodInvocation * * @return mixed */ public function postPublicMethod(AbstractMethodInvocation $methodInvocation) { $scope = get_class($methodInvocation->getThis()); foreach ($this->interceptors as $interceptor) { $interceptor($methodInvocation, $scope); } return $methodInvocation->proceed(); }
/** * Replaces the parameters within the given $methodInvocation with type-safe interface jails, whenever applicable * * @param AbstractMethodInvocation $methodInvocation * * @return void * * @throws ExceptionInterface * @throws HierarchyException */ public function __invoke(AbstractMethodInvocation $methodInvocation) { $method = $methodInvocation->getMethod(); $arguments =& Closure::bind(function &(AbstractMethodInvocation $methodInvocation) { return $methodInvocation->arguments; }, null, AbstractMethodInvocation::class)->__invoke($methodInvocation); foreach ($arguments as $parameterIndex => &$argument) { if (null === $argument) { continue; } if (!($interface = $this->getParameterInterfaceType($parameterIndex, $method))) { continue; } $argument = $this->jailFactory->createInstanceJail($argument, $interface); } }
/** * {@inheritdoc} */ public function __construct($className, $methodName, array $advices) { parent::__construct($className, $methodName, $advices); $this->closureToCall = $this->getStaticInvoker($this->className, $methodName); }