function StaticReflectionParser::__construct

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionParser.php \Drupal\Component\Annotation\Doctrine\StaticReflectionParser::__construct()
  2. 10 core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionParser.php \Drupal\Component\Annotation\Doctrine\StaticReflectionParser::__construct()

Parses a class residing in a PSR-0 hierarchy.

Parameters

string $className The full, namespaced class name.:

ClassFinderInterface $finder A ClassFinder object which finds the class.:

bool $classAnnotationOptimize Only retrieve the class docComment.: Presumes there is only one statement per line.

File

core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionParser.php, line 150

Class

StaticReflectionParser
Parses a file for namespaces/use/class declarations.

Namespace

Drupal\Component\Annotation\Doctrine

Code

public function __construct($className, $finder, $classAnnotationOptimize = false) {
    $this->className = ltrim($className, '\\');
    $lastNsPos = strrpos($this->className, '\\');
    if ($lastNsPos !== false) {
        $this->namespace = substr($this->className, 0, $lastNsPos);
        $this->shortClassName = substr($this->className, $lastNsPos + 1);
    }
    else {
        $this->shortClassName = $this->className;
    }
    $this->finder = $finder;
    $this->classAnnotationOptimize = $classAnnotationOptimize;
}

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