function AnnotatedClassDiscovery::getAnnotationReader

Same name in this branch
  1. 9 core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery::getAnnotationReader()
Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery::getAnnotationReader()
  2. 8.9.x core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery::getAnnotationReader()
  3. 10 core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery::getAnnotationReader()
  4. 10 core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery::getAnnotationReader()
  5. 11.x core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery::getAnnotationReader()
  6. 11.x core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php \Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery::getAnnotationReader()

Gets the used doctrine annotation reader.

Return value

\Doctrine\Common\Annotations\Reader The annotation reader.

2 calls to AnnotatedClassDiscovery::getAnnotationReader()
AnnotatedClassDiscovery::getAnnotationReader in core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php
Gets the used doctrine annotation reader.
AnnotatedClassDiscovery::getDefinitions in core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php
Gets the definition of all plugins for this type.
1 method overrides AnnotatedClassDiscovery::getAnnotationReader()
AnnotatedClassDiscovery::getAnnotationReader in core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php
Gets the used doctrine annotation reader.

File

core/lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php, line 88

Class

AnnotatedClassDiscovery
Defines a discovery mechanism to find annotated plugins in PSR-4 namespaces.

Namespace

Drupal\Component\Annotation\Plugin\Discovery

Code

protected function getAnnotationReader() {
    if (!isset($this->annotationReader)) {
        $this->annotationReader = new SimpleAnnotationReader();
        // Add the namespaces from the main plugin annotation, like @EntityType.
        $namespace = substr($this->pluginDefinitionAnnotationName, 0, strrpos($this->pluginDefinitionAnnotationName, '\\'));
        $this->annotationReader
            ->addNamespace($namespace);
        // Register additional namespaces to be scanned for annotations.
        foreach ($this->annotationNamespaces as $namespace) {
            $this->annotationReader
                ->addNamespace($namespace);
        }
    }
    return $this->annotationReader;
}

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