TheSeer\phpDox\DocBlock\DocBlock::asDom PHP Method

asDom() public method

public asDom ( TheSeer\fDOM\fDOMDocument $doc ) : TheSeer\fDOM\fDOMElement
$doc TheSeer\fDOM\fDOMDocument
return TheSeer\fDOM\fDOMElement
    public function asDom(\TheSeer\fDOM\fDOMDocument $doc)
    {
        $node = $doc->createElementNS('http://xml.phpdox.net/src', 'docblock');
        // add lines and such?
        foreach ($this->elements as $element) {
            if (is_array($element)) {
                foreach ($element as $el) {
                    $node->appendChild($el->asDom($doc));
                }
                continue;
            }
            $node->appendChild($element->asDom($doc));
        }
        return $node;
    }

Usage Example

Example #1
0
 public function setDocBlock(DocBlock $docblock) {
     $docNode = $docblock->asDom($this->ctx->ownerDocument);
     if ($this->ctx->hasChildNodes()) {
         $this->ctx->insertBefore($docNode, $this->ctx->firstChild);
         return;
     }
     $this->ctx->appendChild($docNode);
 }
All Usage Examples Of TheSeer\phpDox\DocBlock\DocBlock::asDom