Esempio n. 1
0
 /**
  * @param \phpDocumentor\Reflection\BaseReflector $reflector
  * @param Context $context
  * @param array $config
  */
 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 = ucfirst($docblock->getShortDescription());
         if (empty($this->shortDescription) && !$this instanceof PropertyDoc && $context !== null && $docblock->getTagsByName('inheritdoc') === null) {
             $context->errors[] = ['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->errors[] = ['line' => $this->startLine, 'file' => $this->sourceFile, 'message' => "No docblock for element '{$this->name}'"];
     }
 }