PDepend\Report\Dependencies\Xml::writeNodeDependencies PHP Method

writeNodeDependencies() protected method

Aggregates all dependencies for the given $node instance and adds them to the \DOMElement
protected writeNodeDependencies ( DOMElement $xml, PDepend\Source\AST\AbstractASTArtifact $node ) : void
$xml DOMElement
$node PDepend\Source\AST\AbstractASTArtifact
return void
    protected function writeNodeDependencies(\DOMElement $xml, AbstractASTArtifact $node)
    {
        if (!$this->dependencyAnalyzer) {
            return;
        }
        $xml = end($this->xmlStack);
        $doc = $xml->ownerDocument;
        $efferentXml = $doc->createElement('efferent');
        $xml->appendChild($efferentXml);
        foreach ($this->dependencyAnalyzer->getEfferents($node) as $type) {
            $typeXml = $doc->createElement('type');
            $typeXml->setAttribute('namespace', Utf8Util::ensureEncoding($type->getNamespaceName()));
            $typeXml->setAttribute('name', Utf8Util::ensureEncoding($type->getName()));
            $efferentXml->appendChild($typeXml);
        }
        $afferentXml = $doc->createElement('afferent');
        $xml->appendChild($afferentXml);
        foreach ($this->dependencyAnalyzer->getAfferents($node) as $type) {
            $typeXml = $doc->createElement('type');
            $typeXml->setAttribute('namespace', Utf8Util::ensureEncoding($type->getNamespaceName()));
            $typeXml->setAttribute('name', Utf8Util::ensureEncoding($type->getName()));
            $afferentXml->appendChild($typeXml);
        }
    }