You are here

protected function DocBlock::parseTags in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpdocumentor/reflection-docblock/src/phpDocumentor/Reflection/DocBlock.php \phpDocumentor\Reflection\DocBlock::parseTags()

Creates the tag objects.

Parameters

string $tags Tag block to parse.:

Return value

void

1 call to DocBlock::parseTags()
DocBlock::__construct in vendor/phpdocumentor/reflection-docblock/src/phpDocumentor/Reflection/DocBlock.php
Parses the given docblock and populates the member fields.

File

vendor/phpdocumentor/reflection-docblock/src/phpDocumentor/Reflection/DocBlock.php, line 220

Class

DocBlock
Parses the DocBlock for any structure.

Namespace

phpDocumentor\Reflection

Code

protected function parseTags($tags) {
  $result = array();
  $tags = trim($tags);
  if ('' !== $tags) {
    if ('@' !== $tags[0]) {
      throw new \LogicException('A tag block started with text instead of an actual tag,' . ' this makes the tag block invalid: ' . $tags);
    }
    foreach (explode("\n", $tags) as $tag_line) {
      if (isset($tag_line[0]) && $tag_line[0] === '@') {
        $result[] = $tag_line;
      }
      else {
        $result[count($result) - 1] .= "\n" . $tag_line;
      }
    }

    // create proper Tag objects
    foreach ($result as $key => $tag_line) {
      $result[$key] = Tag::createInstance(trim($tag_line), $this);
    }
  }
  $this->tags = $result;
}