FluentDOM\Nodes\Builder::getWrapperNodes PHP Method

getWrapperNodes() public method

Get the inner and outer wrapper nodes. Simple means that they are the same nodes.
public getWrapperNodes ( DOMElement $template, boolean &$simple ) : DOMElement[]
$template DOMElement
$simple boolean
return DOMElement[]
    public function getWrapperNodes($template, &$simple)
    {
        $wrapper = $template->cloneNode(TRUE);
        $targets = NULL;
        $target = NULL;
        if (!$simple) {
            // get the first element without child elements.
            $targets = $this->getOwner()->xpath('.//*[count(*) = 0]', $wrapper);
        }
        if ($simple || $targets->length === 0) {
            $target = $wrapper;
            $simple = TRUE;
        } elseif ($targets instanceof \DOMNodeList) {
            $target = $targets->item(0);
        }
        return array($target, $wrapper);
    }