function DocParser::parse

Same name in other branches
  1. 9 core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php \Drupal\Component\Annotation\Doctrine\DocParser::parse()
  2. 8.9.x core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php \Drupal\Component\Annotation\Doctrine\DocParser::parse()
  3. 10 core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php \Drupal\Component\Annotation\Doctrine\DocParser::parse()

Parses the given docblock string for annotations.

Parameters

string $input The docblock string to parse.:

string $context The parsing context.:

Return value

array Array of annotations. If no annotations are found, an empty array is returned.

File

core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php, line 326

Class

DocParser
A parser for docblock annotations.

Namespace

Drupal\Component\Annotation\Doctrine

Code

public function parse($input, $context = '') {
    $pos = $this->findInitialTokenPosition($input);
    if ($pos === null) {
        return array();
    }
    $this->context = $context;
    $this->lexer
        ->setInput(trim(substr($input, $pos), '* /'));
    $this->lexer
        ->moveNext();
    return $this->Annotations();
}

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