/** * Export this function definition to the given parent DOMElement. * * @param \DOMElement $parent Element to augment. * @param FunctionReflector $function Element to export. * @param \DOMElement $child if supplied this element will be * augmented instead of freshly added. * * @return void */ public function export(\DOMElement $parent, $function, \DOMElement $child = null) { if (!$child) { $child = new \DOMElement('function'); $parent->appendChild($child); } $child->setAttribute('namespace', $function->getNamespace() ? $function->getNamespace() : $parent->getAttribute('namespace')); $child->setAttribute('line', $function->getLineNumber()); $short_name = method_exists($function, 'getShortName') ? $function->getShortName() : $function->getName(); $child->appendChild(new \DOMElement('name', $short_name)); $child->appendChild(new \DOMElement('full_name', $function->getName())); $object = new DocBlockExporter(); $function->setDefaultPackageName($parent->getAttribute('package')); $object->export($child, $function); foreach ($function->getArguments() as $argument) { $object = new ArgumentExporter(); $object->export($child, $argument); } }