private function templateSubsection($doc, $selector) { $tokenizer = new \Transphporm\Parser\Tokenizer($selector); $xpathStr = $this->xPath->getXpath($tokenizer->getTokens()); $xpath = new \DomXpath($doc); $nodes = $xpath->query($xpathStr); $result = []; foreach ($nodes as $node) { $result[] = $node; } return $result; }
private function notElement($css, $xpath, $element) { foreach ($css as $selector) { $tokenizer = new \Transphporm\Parser\Tokenizer($selector); $xpathString = $this->cssToXpath->getXpath($tokenizer->getTokens()); //Find all nodes matched by the expressions in the brackets :not(EXPR) foreach ($xpath->query($xpathString) as $matchedElement) { //Check to see whether this node was matched by the not query if ($element->isSameNode($matchedElement)) { return false; } } } return true; }