/** * 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; }
/** * 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); } }
/** * @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()); }
/** * 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())); }