/** * Generates a URL from the given node or returns false if unable. * * @param DescriptorAbstract $node * * @return string|false */ public function __invoke($node) { $name = str_replace('\\', '.', ltrim($node->getFullyQualifiedStructuralElementName(), '\\')); // convert root namespace to default; default is a keyword and no namespace CAN be named as such if ($name === '') { $name = 'default'; } return '/packages/' . $name . '.html'; }
/** * @covers phpDocumentor\Descriptor\DescriptorAbstract::setFullyQualifiedStructuralElementName * @covers phpDocumentor\Descriptor\DescriptorAbstract::getFullyQualifiedStructuralElementName */ public function testSettingAndGettingFullyQualifiedStructuralElementName() { $this->assertSame('', $this->fixture->getFullyQualifiedStructuralElementName()); $this->fixture->setFullyQualifiedStructuralElementName('elementname'); $this->assertSame('elementname', $this->fixture->getFullyQualifiedStructuralElementName()); }
/** * Retrieves a key for the index for the provided element. * * @param DescriptorAbstract $element * * @return string */ protected function getIndexKey($element) { $key = $element->getFullyQualifiedStructuralElementName(); // properties should have an additional $ before the property name if ($element instanceof PropertyInterface) { list($fqcn, $propertyName) = explode('::', $key); $key = $fqcn . '::$' . $propertyName; } return $key; }
/** * Normalizes the given FQSEN as if the context marker represents a class/interface/trait as parent. * * @param string $fqsen * @param DescriptorAbstract $container * * @return string */ protected function getTypeWithClassAsContext($fqsen, DescriptorAbstract $container) { if (!$container instanceof ClassDescriptor && !$container instanceof InterfaceDescriptor && !$container instanceof TraitDescriptor) { return $fqsen; } $containerFqsen = $container->getFullyQualifiedStructuralElementName(); return str_replace(self::CONTEXT_MARKER . '::', $containerFqsen . '::', $fqsen); }
/** * Generates a URL from the given node or returns false if unable. * * @param DescriptorAbstract $node * * @return string|false */ public function __invoke($node) { return '/classes/' . str_replace('\\', '.', ltrim($node->getFullyQualifiedStructuralElementName(), '\\')) . '.html'; }