PDepend\Report\Summary\Xml::visitNamespace PHP Method

visitNamespace() public method

Visits a namespace node.
public visitNamespace ( PDepend\Source\AST\ASTNamespace $namespace ) : void
$namespace PDepend\Source\AST\ASTNamespace
return void
    public function visitNamespace(ASTNamespace $namespace)
    {
        $xml = end($this->xmlStack);
        $doc = $xml->ownerDocument;
        $packageXml = $doc->createElement('package');
        $packageXml->setAttribute('name', Utf8Util::ensureEncoding($namespace->getName()));
        $this->writeNodeMetrics($packageXml, $namespace);
        array_push($this->xmlStack, $packageXml);
        foreach ($namespace->getTypes() as $type) {
            $type->accept($this);
        }
        foreach ($namespace->getFunctions() as $function) {
            $function->accept($this);
        }
        array_pop($this->xmlStack);
        if ($packageXml->firstChild === null) {
            return;
        }
        $xml->appendChild($packageXml);
    }