/** * Export this function definition to the given parent DOMElement. * * @param \DOMElement $parent Element to augment. * @param FunctionDescriptor $function Element to export. * @param \DOMElement $child if supplied this element will be augmented instead of freshly added. * * @return void */ public function buildFunction(\DOMElement $parent, FunctionDescriptor $function, \DOMElement $child = null) { if (!$child) { $child = new \DOMElement('function'); $parent->appendChild($child); } $namespace = $function->getNamespace() ? $function->getNamespace() : $parent->getAttribute('namespace'); $child->setAttribute('namespace', ltrim($namespace, '\\')); $child->setAttribute('line', $function->getLine()); $child->appendChild(new \DOMElement('name', $function->getName())); $child->appendChild(new \DOMElement('full_name', $function->getFullyQualifiedStructuralElementName())); $this->buildDocBlock($child, $function); foreach ($function->getArguments() as $argument) { $this->buildArgument($child, $argument); } }