コード例 #1
0
 /**
  * If the ProjectDescriptor's settings allow internal tags then return the Descriptor, otherwise null to filter it.
  *
  * @param DescriptorAbstract $value
  *
  * @return DescriptorAbstract|null
  */
 public function filter($value)
 {
     $isInternalAllowed = $this->builder->isVisibilityAllowed(Settings::VISIBILITY_INTERNAL);
     if ($isInternalAllowed) {
         $value->setDescription(preg_replace('/{@internal\\ (.+)}}/', '$1', $value->getDescription()));
         return $value;
     }
     // remove inline @internal tags
     $value->setDescription(preg_replace('/{@internal\\ .+}}/', '', $value->getDescription()));
     // if internal elements are not allowed; filter this element
     if ($value->getTags()->get('internal')) {
         return null;
     }
     return $value;
 }
コード例 #2
0
 /**
  * Assemble DocBlock.
  *
  * @param DocBlock|null      $docBlock
  * @param DescriptorAbstract $target
  *
  * @return void
  */
 protected function assembleDocBlock($docBlock, $target)
 {
     if (!$docBlock) {
         return;
     }
     $target->setSummary($docBlock->getShortDescription());
     $target->setDescription($docBlock->getLongDescription()->getContents());
     /** @var DocBlock\Tag $tag */
     foreach ($docBlock->getTags() as $tag) {
         $tagDescriptor = $this->builder->buildDescriptor($tag);
         // allow filtering of tags
         if (!$tagDescriptor) {
             continue;
         }
         $target->getTags()->get($tag->getName(), new Collection())->add($tagDescriptor);
     }
 }
コード例 #3
0
 /**
  * @covers phpDocumentor\Descriptor\DescriptorAbstract::setDescription
  * @covers phpDocumentor\Descriptor\DescriptorAbstract::getDescription
  */
 public function testSettingAndGettingDescription()
 {
     $this->assertSame('', $this->fixture->getDescription());
     $this->fixture->setDescription('description');
     $this->assertSame('description', $this->fixture->getDescription());
 }
コード例 #4
0
 /**
  * Resolves all @see and @link tags in the description of the given descriptor to their markdown representation.
  *
  * @param DescriptorAbstract $descriptor
  *
  * @uses self::resolveTag()
  *
  * @return void
  */
 private function resolveSeeAndLinkTags(DescriptorAbstract $descriptor)
 {
     // store descriptor to use it in the resolveTag method
     $this->descriptor = $descriptor;
     $descriptor->setDescription(preg_replace_callback(self::REGEX_INLINE_LINK_OR_SEE_TAG, array($this, 'resolveTag'), $descriptor->getDescription()));
 }