/** * Generates a URL from the given node or returns false if unable. * * @param string|Descriptor\PropertyDescriptor $node * * @return string|false */ public function __invoke($node) { if (!$node instanceof Descriptor\PropertyDescriptor) { return false; } $converter = new QualifiedNameToUrlConverter(); $className = $node->getParent()->getFullyQualifiedStructuralElementName(); return '/classes/' . $converter->fromClass($className) . '.html#property_' . $node->getName(); }
/** * @covers phpDocumentor\Descriptor\PropertyDescriptor::getCopyright * @covers phpDocumentor\Descriptor\DescriptorAbstract::getCopyright */ public function testCopyrightTagsInheritWhenNoneArePresent() { // Arrange $copyrightTagDescriptor = new TagDescriptor('copyright'); $copyrightCollection = new Collection(array($copyrightTagDescriptor)); $this->fixture->getTags()->clear(); $parentProperty = $this->whenFixtureHasPropertyInParentClassWithSameName($this->fixture->getName()); $parentProperty->getTags()->set('copyright', $copyrightCollection); // Act $result = $this->fixture->getCopyright(); // Assert $this->assertSame($copyrightCollection, $result); }
/** * Export the given reflected property definition to the provided parent element. * * @param \DOMElement $parent Element to augment. * @param PropertyDescriptor $property Element to export. * * @return \DOMElement */ public function convert(\DOMElement $parent, PropertyDescriptor $property) { $fullyQualifiedNamespaceName = $property->getNamespace() instanceof NamespaceDescriptor ? $property->getNamespace()->getFullyQualifiedStructuralElementName() : $parent->getAttribute('namespace'); $child = new \DOMElement('property'); $parent->appendChild($child); $child->setAttribute('static', var_export($property->isStatic(), true)); $child->setAttribute('visibility', $property->getVisibility()); $child->setAttribute('namespace', $fullyQualifiedNamespaceName); $child->setAttribute('line', $property->getLine()); $child->appendChild(new \DOMElement('name', '$' . $property->getName())); $child->appendChild(new \DOMElement('full_name', $property->getFullyQualifiedStructuralElementName())); $child->appendChild(new \DOMElement('default'))->appendChild(new \DOMText($property->getDefault())); $this->docBlockConverter->convert($child, $property); return $child; }
/** * Export the given property definition to the provided parent element. * * @param \DOMElement $parent Element to augment. * @param PropertyDescriptor $property Element to export. * * @return void */ public function buildProperty(\DOMElement $parent, PropertyDescriptor $property) { $child = new \DOMElement('property'); $parent->appendChild($child); $child->setAttribute('static', $property->isStatic() ? 'true' : 'false'); $child->setAttribute('visibility', $property->getVisibility()); $child->setAttribute('line', $property->getLine()); $namespaceFqnn = $property->getNamespace() ? $property->getNamespace()->getFullyQualifiedStructuralElementName() : $parent->getAttribute('namespace'); $child->setAttribute('namespace', $namespaceFqnn); $child->appendChild(new \DOMElement('name', '$' . $property->getName())); $child->appendChild(new \DOMElement('default'))->appendChild(new \DOMText($property->getDefault())); $this->buildDocBlock($child, $property); }
/** * Generates a URL from the given node or returns false if unable. * * @param string|Descriptor\PropertyDescriptor $node * * @return string|false */ public function __invoke($node) { $converter = new QualifiedNameToUrlConverter(); $className = $node->getParent()->getFullyQualifiedStructuralElementName(); return '/classes/' . $converter->fromClass($className) . '.html#property_' . $node->getName(); }