src/AvatarServiceDiscovery.php
protected function discoverAnnotations(array $classes) : array {
    AnnotationRegistry::reset();
    AnnotationRegistry::registerLoader('class_exists');

    $reader = $this->createReader();

    $annotations = [];
    foreach ($classes as $class) {
      $reflection = new \ReflectionClass($class);
      if (!$reflection->isSubclassOf($this->serviceInterface)) {
        continue;
      }

      /** @var \dpi\ak\Annotation\AvatarService $annotation */
      $annotation = $reader->getClassAnnotation($reflection, $this->annotationClass);
      if ($annotation) {
        $annotations[$class] = $annotation;
      }
    }

    AnnotationRegistry::reset();

    return $annotations;
  }
protected function discoverAnnotations(array $classes) : array {
    AnnotationRegistry::reset();
    AnnotationRegistry::registerLoader('class_exists');

    $reader = $this->createReader();

    $annotations = [];
    foreach ($classes as $class) {
      $reflection = new \ReflectionClass($class);
      if (!$reflection->isSubclassOf($this->serviceInterface)) {
        continue;
      }

      /** @var \dpi\ak\Annotation\AvatarService $annotation */
      $annotation = $reader->getClassAnnotation($reflection, $this->annotationClass);
      if ($annotation) {
        $annotations[$class] = $annotation;
      }
    }

    AnnotationRegistry::reset();

    return $annotations;
  }
protected function discoverAnnotations ( array $ classes ) : array { AnnotationRegistry :: reset ( ) ; AnnotationRegistry :: registerLoader ( 'class_exists' ) ; $ reader = $ this -> createReader ( ) ; $ annotations = [ ] ; foreach ( $ classes as $ class ) { $ reflection = new \ ReflectionClass ( $ class ) ; if ( ! $ reflection -> isSubclassOf ( $ this -> serviceInterface ) ) { continue ; } /** @var \dpi\ak\Annotation\AvatarService $annotation */ $ annotation = $ reader -> getClassAnnotation ( $ reflection , $ this -> annotationClass ) ; if ( $ annotation ) { $ annotations [ $ class ] = $ annotation ; } } AnnotationRegistry :: reset ( ) ; return $ annotations ; }
Discovers and caches annotations.

@param string[] $classes
An array of classes.

@return \dpi\ak\Annotation\AvatarService[]
An array of avatar services keyed by class name.
Discovers and caches annotations .