/** * Export the given reflected interface definition to the provided parent element. * * This method creates a new child element on the given parent XML element * and takes the properties of the Reflection argument and sets the * elements and attributes on the child. * * If a child DOMElement is provided then the properties and attributes are * set on this but the child element is not appended onto the parent. This * is the responsibility of the invoker. Essentially this means that the * $parent argument is ignored in this case. * * @param \DOMElement $parent Element to augment. * @param InterfaceDescriptor $interface Element to export. * * @return \DOMElement */ public function convert(\DOMElement $parent, InterfaceDescriptor $interface) { $child = new \DOMElement('interface'); $parent->appendChild($child); /** @var InterfaceDescriptor $parentInterface */ foreach ($interface->getParent() as $parentInterface) { $parentFqcn = is_string($parentInterface) === false ? $parentInterface->getFullyQualifiedStructuralElementName() : $parentInterface; $child->appendChild(new \DOMElement('extends', $parentFqcn)); } $namespace = $interface->getNamespace()->getFullyQualifiedStructuralElementName(); $child->setAttribute('namespace', ltrim($namespace, '\\')); $child->setAttribute('line', $interface->getLine()); $child->appendChild(new \DOMElement('name', $interface->getName())); $child->appendChild(new \DOMElement('full_name', $interface->getFullyQualifiedStructuralElementName())); $this->docBlockConverter->convert($child, $interface); foreach ($interface->getConstants() as $constant) { $this->constantConverter->convert($child, $constant); } foreach ($interface->getMethods() as $method) { $this->methodConverter->convert($child, $method); } return $child; }