/** * Generates the XML for a class or trait node. * * @param \PDepend\Source\AST\ASTClass $type * @param string $typeIdentifier * @return void */ private function generateTypeXml(AbstractASTClassOrInterface $type, $typeIdentifier) { if (!$type->isUserDefined()) { return; } $xml = end($this->xmlStack); $doc = $xml->ownerDocument; $typeXml = $doc->createElement($typeIdentifier); $typeXml->setAttribute('name', Utf8Util::ensureEncoding($type->getName())); $xml->appendChild($typeXml); array_push($this->xmlStack, $typeXml); $this->writeNodeDependencies($typeXml, $type); $this->writeFileReference($typeXml, $type->getCompilationUnit()); array_pop($this->xmlStack); }