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

close() public method

Closes the logger process and writes the output file.
public close ( ) : void
return void
    public function close()
    {
        if ($this->logFile === null) {
            throw new NoLogOutputException($this);
        }
        $dom = new \DOMDocument('1.0', 'UTF-8');
        $dom->formatOutput = true;
        $dependencies = $dom->createElement('dependencies');
        $dependencies->setAttribute('generated', date('Y-m-d\\TH:i:s'));
        $dependencies->setAttribute('pdepend', '@package_version@');
        array_push($this->xmlStack, $dependencies);
        foreach ($this->code as $node) {
            $node->accept($this);
        }
        $dom->appendChild($dependencies);
        $buffer = $dom->saveXML();
        file_put_contents($this->logFile, $buffer);
    }