コード例 #1
0
ファイル: Template.php プロジェクト: level-2/transphporm
 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;
 }
コード例 #2
0
ファイル: Not.php プロジェクト: solleer/framework
 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;
 }