Go\Aop\Pointcut\AndPointcut::matchPart PHP Method

matchPart() protected method

Checks if point filter matches the point
protected matchPart ( Go\Aop\Pointcut $pointcut, ReflectionMethod | ReflectionProperty $point, mixed $context = null, object | string | null $instance = null, array $arguments = null ) : boolean
$pointcut Go\Aop\Pointcut Pointcut part
$point ReflectionMethod | ReflectionProperty
$context mixed Related context, can be class or namespace
$instance object | string | null [Optional] Instance for dynamic matching
$arguments array [Optional] Extra arguments for dynamic matching
return boolean
    protected function matchPart(Pointcut $pointcut, $point, $context = null, $instance = null, array $arguments = null)
    {
        return $pointcut->matches($point, $context, $instance, $arguments) && $pointcut->getClassFilter()->matches($context);
    }

Usage Example

Beispiel #1
0
 /**
  * @inheritDoc
  */
 protected function matchPart(Pointcut $pointcut, $point, $context = null, $instance = null, array $arguments = null)
 {
     $pointcutKind = $pointcut->getKind();
     // We need to recheck filter kind one more time, because of OR syntax
     switch (true) {
         case $point instanceof \ReflectionMethod && $pointcutKind & PointFilter::KIND_METHOD:
         case $point instanceof \ReflectionProperty && $pointcutKind & PointFilter::KIND_PROPERTY:
         case $point instanceof \ReflectionClass && $pointcutKind & PointFilter::KIND_CLASS:
             return parent::matchPart($pointcut, $point, $context, $instance, $arguments);
         default:
             return false;
     }
 }