Neos\Flow\Reflection\ReflectionService::getClassNamesByAnnotation PHP 메소드

getClassNamesByAnnotation() 공개 메소드

Searches for and returns all names of classes which are tagged by the specified annotation. If no classes were found, an empty array is returned.
public getClassNamesByAnnotation ( string $annotationClassName ) : array
$annotationClassName string Name of the annotation class, for example "Neos\Flow\Annotations\Aspect"
리턴 array
    public function getClassNamesByAnnotation($annotationClassName)
    {
        if (!$this->initialized) {
            $this->initialize();
        }
        $annotationClassName = $this->cleanClassName($annotationClassName);
        return isset($this->annotatedClasses[$annotationClassName]) ? array_keys($this->annotatedClasses[$annotationClassName]) : [];
    }

Usage Example

 /**
  * This method is used to optimize the matching process.
  *
  * @param \Neos\Flow\Aop\Builder\ClassNameIndex $classNameIndex
  * @return \Neos\Flow\Aop\Builder\ClassNameIndex
  */
 public function reduceTargetClassNames(\Neos\Flow\Aop\Builder\ClassNameIndex $classNameIndex)
 {
     $classNames = $this->reflectionService->getClassNamesByAnnotation(Flow\ValueObject::class);
     $annotatedIndex = new \Neos\Flow\Aop\Builder\ClassNameIndex();
     $annotatedIndex->setClassNames($classNames);
     return $classNameIndex->intersect($annotatedIndex);
 }
All Usage Examples Of Neos\Flow\Reflection\ReflectionService::getClassNamesByAnnotation
ReflectionService