/** * @param AbstractUnitObject $unit */ private function addUnit(AbstractUnitObject $unit, $type) { $root = $this->getRootElement(); if (!$this->findUnitNodeByName($unit->getNamespace(), $unit->getLocalName())) { $unitNode = $root->appendElementNS('http://xml.phpdox.net/src', $type); $unitNode->setAttribute('name', $unit->getLocalName()); $src = $unit->getSourceFilename(); if ($src != '') { $unitNode->setAttribute('src', $src->getRelative($this->srcDir, FALSE)); } $desc = $unit->getCompactDescription(); if ($desc != '') { $unitNode->setAttribute('description', $desc); } $xpath = 'phpdox:namespace[@name="' . $unit->getNamespace() . '"]'; $ctx = $root->queryOne($xpath); if (!$ctx) { $ctx = $root->appendElementNS('http://xml.phpdox.net/src', 'namespace'); $ctx->setAttribute('name', $unit->getNamespace()); } $ctx->appendChild($unitNode); } }