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

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

Tells if the specified class has the given annotation
public isClassAnnotatedWith ( string $className, string $annotationClassName ) : boolean
$className string Name of the class
$annotationClassName string Annotation to check for
Результат boolean
    public function isClassAnnotatedWith($className, $annotationClassName)
    {
        if (!$this->initialized) {
            $this->initialize();
        }
        $className = $this->cleanClassName($className);
        $annotationClassName = $this->cleanClassName($annotationClassName);
        return isset($this->annotatedClasses[$annotationClassName][$className]);
    }

Usage Example

Пример #1
0
 /**
  * Only convert if the given target class has a constructor with one argument being of type given type
  *
  * @param string $source
  * @param string $targetType
  * @return bool
  */
 public function canConvertFrom($source, $targetType)
 {
     if (($this->reflectionService->isClassAnnotatedWith($targetType, Flow\Entity::class) || $this->reflectionService->isClassAnnotatedWith($targetType, Flow\ValueObject::class) || $this->reflectionService->isClassAnnotatedWith($targetType, Entity::class)) === true) {
         return false;
     }
     $methodParameters = $this->reflectionService->getMethodParameters($targetType, '__construct');
     if (count($methodParameters) !== 1) {
         return false;
     }
     $methodParameter = array_shift($methodParameters);
     return $methodParameter['type'] === gettype($source);
 }
All Usage Examples Of Neos\Flow\Reflection\ReflectionService::isClassAnnotatedWith
ReflectionService