A runtime joinpoint is an event that occurs on a static joinpoint (i.e. a location in a the program).
For instance, an invocation is the runtime joinpoint on a method (static joinpoint).
The static part of a given joinpoint can be generically retrieved using the getStaticPart() method.
In the context of an interception framework, a runtime joinpoint is then the reification of an access to
an accessible object (a method, a constructor, a field), i.e. the static part of the joinpoint. It is passed
to the interceptors that are installed on the static joinpoint.
/** * Method invoker * * @param Joinpoint $joinpoint the method invocation joinpoint * * @return mixed the result of the call to {@see Joinpoint->proceed()} */ public final function invoke(Joinpoint $joinpoint) { if ($joinpoint instanceof Invocation) { if ($this->pointcut->matches($joinpoint->getStaticPart(), $joinpoint->getThis(), $joinpoint->getArguments())) { return $this->adviceMethod->invoke($joinpoint); } } return $joinpoint->proceed(); }
/** * Method invoker * * @param Joinpoint $joinpoint the method invocation joinpoint * * @return mixed the result of the call to {@see Joinpoint->proceed()} */ public final function invoke(Joinpoint $joinpoint) { if ($joinpoint instanceof Invocation) { if ($this->dynamicPointFilter->matches($joinpoint->getStaticPart(), $joinpoint->getThis(), $joinpoint->getArguments())) { return $this->interceptor->invoke($joinpoint); } } return $joinpoint->proceed(); }
/** * After invoker * * @param Joinpoint $joinpoint the concrete joinpoint * * @return mixed the result of the call to {@link Joinpoint::proceed()} */ public function invoke(Joinpoint $joinpoint) { try { $result = $joinpoint->proceed(); } finally { $adviceMethod = $this->adviceMethod; $adviceMethod($joinpoint); } return $result; }
/** * After throwing exception invoker * * @param Joinpoint $joinpoint the concrete joinpoint * * @return mixed the result of the call to {@link Joinpoint::proceed()} * @throws Exception */ public function invoke(Joinpoint $joinpoint) { try { $result = $joinpoint->proceed(); } catch (Exception $invocationException) { $adviceMethod = $this->adviceMethod; $adviceMethod($joinpoint); throw $invocationException; } return $result; }
/** * Method invoker * * @param Joinpoint $joinpoint the method invocation joinpoint * * @return mixed the result of the call to {@see Joinpoint->proceed()} */ public final function invoke(Joinpoint $joinpoint) { if ($joinpoint instanceof Invocation) { $point = $joinpoint->getStaticPart(); $instance = $joinpoint->getThis(); $context = new \ReflectionClass($instance); if ($this->pointFilter->matches($point, $context, $instance, $joinpoint->getArguments())) { return $this->interceptor->invoke($joinpoint); } } return $joinpoint->proceed(); }
/** * After invoker * * @param Joinpoint $joinpoint the concrete joinpoint * * @return mixed the result of the call to {@link Joinpoint::proceed()} * @throws Exception */ public final function invoke(Joinpoint $joinpoint) { $result = null; try { $result = $joinpoint->proceed(); } catch (Exception $invocationException) { // this is need for finally emulation in PHP } $adviceMethod = $this->adviceMethod; $adviceMethod($joinpoint); if (isset($invocationException)) { throw $invocationException; } return $result; }
/** * Implement this method to perform extra treatments before and * after the invocation. Polite implementations would certainly * like to invoke {@link Joinpoint::proceed()}. * * @param Joinpoint $joinpoint the method invocation joinpoint * * @return mixed the result of the call to {@link Joinpoint::proceed()} */ public function invoke(Joinpoint $joinpoint) { $this->adviceMethod->__invoke($joinpoint->getThis(), $joinpoint->getStaticPart(), $this->message, $this->level); return $joinpoint->proceed(); }
/** * Implement this method to perform extra treatments before and * after the invocation. Polite implementations would certainly * like to invoke {@link Joinpoint::proceed()}. * * @param Joinpoint $joinpoint the method invocation joinpoint * * @return mixed the result of the call to {@link Joinpoint::proceed()} */ public function invoke(Joinpoint $joinpoint) { /** @var ReflectionMethod|ReflectionProperty $reflection */ $reflection = $joinpoint->getStaticPart(); $reflectorName = 'unknown'; if ($reflection && method_exists($reflection, 'getName')) { $reflectorName = $reflection->getName(); } $this->adviceMethod->__invoke($joinpoint->getThis(), $reflectorName, $this->message, $this->level); return $joinpoint->proceed(); }
/** * Implement this method to perform extra treatments before and * after the invocation. Polite implementations would certainly * like to invoke {@link Joinpoint::proceed()}. * * @param Joinpoint $joinpoint the method invocation joinpoint * * @return mixed the result of the call to {@link Joinpoint::proceed()} */ public function invoke(Joinpoint $joinpoint) { $reflection = $joinpoint->getStaticPart(); $reflectorName = 'unknown'; if ($reflection && method_exists($reflection, 'getName')) { $reflectorName = $reflection->getName(); } $adviceMethod = $this->adviceMethod; $adviceMethod($joinpoint->getThis(), $reflectorName, $this->message, $this->level); return $joinpoint->proceed(); }