Exemple #1
0
 /**
  * Create a new instance of JoinPoint.
  * Note: The kind of `JoinPoint` class depends on the context execution.
  *
  * @param  int                                                              $kind
  *  The kind of `JoinPoint`.
  * @param  \Aop\Pointcut\PointcutInterface                                  $pointcut
  *  The pointcut that triggers the `JoinPoint`.
  * @param  \Aop\JoinPoint\Support\JoinPointSupportInterceptorInterface      $support
  *  The interceptor that support the JoinPoint
  *
  * @return \Aop\JoinPoint\JoinPoint
  *  Returns a `JoinPoint` instance, the class of `JoinPoint` depends on the `$kind`.
  */
 protected function createJoinPoint($kind, PointcutInterface $pointcut, JoinPointSupportInterceptorInterface $support)
 {
     // class name
     $jp = '\\Aop\\JoinPoint\\' . Aop::getKindName($kind, true) . 'JoinPoint';
     // create an instance of JointPoint (kind class resolved)
     return new $jp($pointcut, $support);
 }
 /**
  * Create and throws a `\Aop\Exception\KindException`.
  *
  * @param string $method
  * @param int $kind
  */
 protected function createKindException($kind, $method)
 {
     throw new KindException('`' . $method . '` error:
         the interceptor does not support the `' . Aop::getKindName($kind) . '` kind.');
 }
 /**
  * @inheritdoc
  * @see \Aop\Weaver\WeaverInterface::addAround()
  */
 public function addAround(Pointcutinterface $pointcut, AdviceInterface $advice, array $options = [])
 {
     throw new KindException('`' . __METHOD__ . '` error:
         the interceptor does not support the `' . Aop::getKindName(Aop::KIND_AROUND) . '` kind.');
 }
Exemple #4
0
 public function testGetKindName()
 {
     new _Aop();
     $this->string(_Aop::getKindName(_Aop::KIND_AFTER_FUNCTION_RETURN))->isEqualTo('after_function_return')->string(_Aop::getKindName(_Aop::KIND_AROUND_PROPERTY_READ, true))->isEqualTo('AroundPropertyRead')->exception(function () {
         _Aop::getKindName(-1000);
     })->isInstanceOf('\\Aop\\Exception\\KindException');
 }