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

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

If multiple annotations are set on the target you will get one (random) instance of them.
public getMethodAnnotation ( string $className, string $methodName, string $annotationClassName ) : object
$className string Name of the class
$methodName string Name of the method
$annotationClassName string Annotation to filter for
Результат object
    public function getMethodAnnotation($className, $methodName, $annotationClassName)
    {
        if (!$this->initialized) {
            $this->initialize();
        }
        $annotations = $this->getMethodAnnotations($className, $methodName, $annotationClassName);
        return $annotations === [] ? null : current($annotations);
    }

Usage Example

 /**
  * @param JoinPointInterface $joinPoint The current join point
  * @return mixed
  * @Flow\Around("methodAnnotatedWith(Flowpack\JobQueue\Common\Annotations\Defer)")
  */
 public function queueMethodCallAsJob(JoinPointInterface $joinPoint)
 {
     if ($this->processingJob) {
         return $joinPoint->getAdviceChain()->proceed($joinPoint);
     }
     /** @var Defer $deferAnnotation */
     $deferAnnotation = $this->reflectionService->getMethodAnnotation($joinPoint->getClassName(), $joinPoint->getMethodName(), Defer::class);
     $queueName = $deferAnnotation->queueName;
     $job = new StaticMethodCallJob($joinPoint->getClassName(), $joinPoint->getMethodName(), $joinPoint->getMethodArguments());
     $this->jobManager->queue($queueName, $job, $deferAnnotation->options);
     return null;
 }
All Usage Examples Of Neos\Flow\Reflection\ReflectionService::getMethodAnnotation
ReflectionService