Neos\Flow\Reflection\ReflectionService::getClassesContainingMethodsAnnotatedWith PHP Метод

getClassesContainingMethodsAnnotatedWith() публичный Метод

Returns all class names of classes containing at least one method annotated with the given annotation class
public getClassesContainingMethodsAnnotatedWith ( string $annotationClassName ) : array
$annotationClassName string The annotation class name for a method annotation
Результат array An array of class names
    public function getClassesContainingMethodsAnnotatedWith($annotationClassName)
    {
        if (!$this->initialized) {
            $this->initialize();
        }
        return isset($this->classesByMethodAnnotations[$annotationClassName]) ? array_keys($this->classesByMethodAnnotations[$annotationClassName]) : [];
    }

Usage Example

 /**
  * This method is used to optimize the matching process.
  *
  * @param ClassNameIndex $classNameIndex
  * @return ClassNameIndex
  */
 public function reduceTargetClassNames(ClassNameIndex $classNameIndex)
 {
     $classNames = $this->reflectionService->getClassesContainingMethodsAnnotatedWith($this->annotation);
     $annotatedIndex = new ClassNameIndex();
     $annotatedIndex->setClassNames($classNames);
     return $classNameIndex->intersect($annotatedIndex);
 }
ReflectionService