function SimpleAnnotationReader::getClassAnnotation

Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Component/Annotation/Doctrine/SimpleAnnotationReader.php \Drupal\Component\Annotation\Doctrine\SimpleAnnotationReader::getClassAnnotation()
  2. 10 core/lib/Drupal/Component/Annotation/Doctrine/SimpleAnnotationReader.php \Drupal\Component\Annotation\Doctrine\SimpleAnnotationReader::getClassAnnotation()
  3. 11.x core/lib/Drupal/Component/Annotation/Doctrine/SimpleAnnotationReader.php \Drupal\Component\Annotation\Doctrine\SimpleAnnotationReader::getClassAnnotation()

File

core/lib/Drupal/Component/Annotation/Doctrine/SimpleAnnotationReader.php, line 123

Class

SimpleAnnotationReader
Simple Annotation Reader.

Namespace

Drupal\Component\Annotation\Doctrine

Code

public function getClassAnnotation(\ReflectionClass $class, $annotationName) {
    foreach ($this->getClassAnnotations($class) as $annot) {
        if ($annot instanceof $annotationName) {
            return $annot;
        }
    }
    return null;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.