/** * @param AbstractUnitObject $unit */ public function importExports(AbstractUnitObject $unit, $container = 'parent') { $parent = $this->rootNode->queryOne(sprintf('//phpdox:%s[@full="%s"]', $container, $unit->getName())); if ($parent instanceof fDOMElement) { $parent->parentNode->removeChild($parent); } $parent = $this->rootNode->appendElementNS(self::XMLNS, $container); $parent->setAttribute('full', $unit->getName()); $parent->setAttribute('namespace', $unit->getNamespace()); $parent->setAttribute('name', $unit->getLocalName()); if ($unit->hasExtends()) { foreach ($unit->getExtends() as $name) { $extends = $parent->appendElementNS(self::XMLNS, 'extends'); $this->setName($name, $extends); } } if ($unit->hasImplements()) { foreach ($unit->getImplements() as $name) { $implements = $parent->appendElementNS(self::XMLNS, 'implements'); $this->setName($name, $implements); } } if ($unit->usesTraits()) { foreach ($unit->getUsedTraits() as $name) { $uses = $parent->appendElementNS(self::XMLNS, 'uses'); $this->setName($name, $uses); } } foreach ($unit->getConstants() as $constant) { $parent->appendChild($this->dom->importNode($constant->export(), TRUE)); } foreach ($unit->getExportedMembers() as $member) { $memberNode = $this->dom->importNode($member->export(), TRUE); $this->adjustStaticResolution($memberNode); $parent->appendChild($memberNode); } foreach ($unit->getExportedMethods() as $method) { $methodNode = $this->dom->importNode($method->export(), TRUE); $this->adjustStaticResolution($methodNode); $parent->appendChild($methodNode); if ($this->hasMethod($method->getName())) { $unitMethod = $this->getMethod($method->getName()); if ($unitMethod->hasInheritDoc()) { $unitMethod->inhertDocBlock($method); } } } }