DiDom\Document::toElement PHP Method

toElement() public method

public toElement ( ) : Element
return Element
    public function toElement()
    {
        if ($this->document->documentElement === null) {
            throw new RuntimeException('Cannot convert empty document to Element');
        }
        return new Element($this->document->documentElement);
    }

Usage Example

Beispiel #1
0
 public function testToElement()
 {
     $html = $this->loadFixture('posts.html');
     $document = new Document($html, false);
     $element = $document->toElement();
     $this->assertInstanceOf('DiDom\\Element', $element);
 }