You are here

public function DocBlock::__construct 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::__construct()

Parses the given docblock and populates the member fields.

The constructor may also receive namespace information such as the current namespace and aliases. This information is used by some tags (e.g. @return, @param, etc.) to turn a relative Type into a FQCN.

Parameters

\Reflector|string $docblock A docblock comment (including: asterisks) or reflector supporting the getDocComment method.

Context $context The context in which the DocBlock: occurs.

Location $location The location within the file that this: DocBlock occurs in.

Throws

\InvalidArgumentException if the given argument does not have the getDocComment method.

File

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

Class

DocBlock
Parses the DocBlock for any structure.

Namespace

phpDocumentor\Reflection

Code

public function __construct($docblock, Context $context = null, Location $location = null) {
  if (is_object($docblock)) {
    if (!method_exists($docblock, 'getDocComment')) {
      throw new \InvalidArgumentException('Invalid object passed; the given reflector must support ' . 'the getDocComment method');
    }
    $docblock = $docblock
      ->getDocComment();
  }
  $docblock = $this
    ->cleanInput($docblock);
  list($templateMarker, $short, $long, $tags) = $this
    ->splitDocBlock($docblock);
  $this->isTemplateStart = $templateMarker === '#@+';
  $this->isTemplateEnd = $templateMarker === '#@-';
  $this->short_description = $short;
  $this->long_description = new DocBlock\Description($long, $this);
  $this
    ->parseTags($tags);
  $this->context = $context;
  $this->location = $location;
}