public function __construct($reflector = null, $context = null, $config = [])
{
parent::__construct($config);
if ($reflector === null) {
return;
}
// base properties
$this->name = ltrim($reflector->getName(), '\\');
$this->startLine = $reflector->getNode()->getAttribute('startLine');
$this->endLine = $reflector->getNode()->getAttribute('endLine');
$docblock = $reflector->getDocBlock();
if ($docblock !== null) {
$this->shortDescription = static::mbUcFirst($docblock->getShortDescription());
if (empty($this->shortDescription) && !$this instanceof PropertyDoc && $context !== null && $docblock->getTagsByName('inheritdoc') === null) {
$context->warnings[] = ['line' => $this->startLine, 'file' => $this->sourceFile, 'message' => "No short description for " . substr(StringHelper::basename(get_class($this)), 0, -3) . " '{$this->name}'"];
}
$this->description = $docblock->getLongDescription()->getContents();
$this->phpDocContext = $docblock->getContext();
$this->tags = $docblock->getTags();
foreach ($this->tags as $i => $tag) {
if ($tag instanceof SinceTag) {
$this->since = $tag->getVersion();
unset($this->tags[$i]);
} elseif ($tag instanceof DeprecatedTag) {
$this->deprecatedSince = $tag->getVersion();
$this->deprecatedReason = $tag->getDescription();
unset($this->tags[$i]);
}
}
} elseif ($context !== null) {
$context->warnings[] = ['line' => $this->startLine, 'file' => $this->sourceFile, 'message' => "No docblock for element '{$this->name}'"];
}
}