/**
  * Export the given reflected constant definition to the provided parent element.
  *
  * @param \DOMElement        $parent Element to augment.
  * @param ConstantDescriptor $constant Element to export.
  *
  * @return \DOMElement
  */
 public function convert(\DOMElement $parent, ConstantDescriptor $constant)
 {
     $fullyQualifiedNamespaceName = $constant->getNamespace() instanceof NamespaceDescriptor ? $constant->getNamespace()->getFullyQualifiedStructuralElementName() : $parent->getAttribute('namespace');
     $child = new \DOMElement('constant');
     $parent->appendChild($child);
     $child->setAttribute('namespace', ltrim($fullyQualifiedNamespaceName, '\\'));
     $child->setAttribute('line', $constant->getLine());
     $child->appendChild(new \DOMElement('name', $constant->getName()));
     $child->appendChild(new \DOMElement('full_name', $constant->getFullyQualifiedStructuralElementName()));
     $child->appendChild(new \DOMElement('value'))->appendChild(new \DOMText($constant->getValue()));
     $this->docBlockConverter->convert($child, $constant);
     return $child;
 }
 /**
  * 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 reflected method definition to the provided parent element.
  *
  * @param \DOMElement      $parent Element to augment.
  * @param MethodDescriptor $method Element to export.
  *
  * @return \DOMElement
  */
 public function convert(\DOMElement $parent, MethodDescriptor $method)
 {
     $fullyQualifiedNamespaceName = $method->getNamespace() instanceof NamespaceDescriptor ? $method->getNamespace()->getFullyQualifiedStructuralElementName() : $parent->getAttribute('namespace');
     $child = new \DOMElement('method');
     $parent->appendChild($child);
     $child->setAttribute('final', var_export($method->isFinal(), true));
     $child->setAttribute('abstract', var_export($method->isAbstract(), true));
     $child->setAttribute('static', var_export($method->isStatic(), true));
     $child->setAttribute('visibility', $method->getVisibility());
     $child->setAttribute('namespace', $fullyQualifiedNamespaceName);
     $child->setAttribute('line', $method->getLine());
     $child->appendChild(new \DOMElement('name', $method->getName()));
     $child->appendChild(new \DOMElement('full_name', $method->getFullyQualifiedStructuralElementName()));
     $this->docBlockConverter->convert($child, $method);
     foreach ($method->getArguments() as $argument) {
         $this->argumentConverter->convert($child, $argument);
     }
     return $child;
 }
 /**
  * @covers phpDocumentor\Plugin\Core\Transformer\Writer\Xml\DocBlockConverter::convert
  * @covers phpDocumentor\Plugin\Core\Transformer\Writer\Xml\DocBlockConverter::addInheritedFromTag
  */
 public function testAddInheritedFromTag()
 {
     // Arrange
     $fqcn = 'fqcn';
     $url = 'url';
     $parent = $this->prepareParentXMLElement();
     $parentDescriptor = $this->givenADescriptor()->shouldReceive('getFullyQualifiedStructuralElementName')->andReturn($fqcn)->getMock();
     $descriptor = $this->givenADescriptorWithSummaryDescriptionAndTags('summary', 'description', array())->shouldReceive('getInheritedElement')->andReturn($parentDescriptor)->getMock();
     $ruleMock = $this->givenARuleThatGeneratesTheGivenUrl($url);
     $this->routerMock->shouldReceive('match')->with($parentDescriptor)->andReturn($ruleMock);
     // Act
     $this->fixture->convert($parent, $descriptor);
     // Assert
     $this->assertSame('inherited_from', $parent->getElementsByTagName('tag')->item(0)->getAttribute('name'));
     $this->assertSame($fqcn, $parent->getElementsByTagName('tag')->item(0)->getAttribute('refers'));
     $this->assertSame($fqcn, $parent->getElementsByTagName('tag')->item(0)->getAttribute('description'));
     $this->assertSame($url, $parent->getElementsByTagName('tag')->item(0)->getAttribute('link'));
 }