Example #1
0
 /**
  * @param AnnotationCollection  $annotations
  * @param InterceptionInterface $interception
  * @param Closure               $callback
  *
  * @return mixed
  */
 private function runInterceptors(AnnotationCollection $annotations, InterceptionInterface $interception, Closure $callback)
 {
     foreach ($annotations as $annotation) {
         foreach ($this->interceptors as $interceptor) {
             if (!$interceptor->canInterceptAnnotation($annotation)) {
                 continue;
             }
             $result = $callback($interceptor, $annotation, $interception);
             $this->resultCollector->collect($result);
             if ($result instanceof ContentAwareResultInterface && $result->hasContent()) {
                 return $result->getContent();
             }
         }
     }
     return null;
 }