public function close()
{
// Check for configured output
if ($this->logFile === null) {
throw new NoLogOutputException($this);
}
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->formatOutput = true;
$jdepend = $dom->createElement('PDepend');
$this->packages = $jdepend->appendChild($dom->createElement('Packages'));
$this->cycles = $jdepend->appendChild($dom->createElement('Cycles'));
foreach ($this->code as $node) {
$node->accept($this);
}
$dom->appendChild($jdepend);
$buffer = $dom->saveXML();
file_put_contents($this->logFile, $buffer);
}