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); }
public function testDocBlockWithMultipleOccurencesOfAnnotationCanBeSerializedToDom() { $dom = new fDOMDocument(); $dom->registerNamespace('test', 'http://xml.phpdox.net/src'); $element2 = clone $this->element; $this->element->expects($this->once())->method('asDom')->will($this->returnValue($dom->createElementNS('http://xml.phpdox.net/src', 'stub'))); $element2->expects($this->once())->method('asDom')->will($this->returnValue($dom->createElementNS('http://xml.phpdox.net/src', 'stub'))); $this->docBlock->appendElement($this->element); $this->docBlock->appendElement($element2); $node = $this->docBlock->asDom($dom); $this->assertEquals('<docblock xmlns="http://xml.phpdox.net/src"><stub/><stub/></docblock>', $dom->saveXML($node)); }
/** * @param \TheSeer\phpDox\DocBlock\DocBlock $docblock */ public function setDocBlock(DocBlock $docblock) { $docNode = $docblock->asDom($this->dom); $this->rootNode->appendChild($docNode); }