public function getFuncArgs($name) { foreach ($this->pseudo as $pseudo) { if (strpos($pseudo, $name) === 0) { $brackets = $this->getBracketType($pseudo); $bracketMatcher = new \Transphporm\Parser\BracketMatcher($pseudo); $ret = $bracketMatcher->match($brackets[0], $brackets[1]); return $ret; } } }
public function match($pseudo, \DomElement $element) { if (strpos($pseudo, 'not') === 0) { $valueParser = new \Transphporm\Parser\Value($this->dataFunction); $bracketMatcher = new \Transphporm\Parser\BracketMatcher($pseudo); $css = explode(',', $bracketMatcher->match('(', ')')); $xpath = new \DomXpath($element->ownerDocument); return $this->notElement($css, $valueParser, $xpath, $element); } return true; }
public function match($pseudo, \DomElement $element) { if (strpos($pseudo, 'nth-child') === 0) { $bracketMatcher = new \Transphporm\Parser\BracketMatcher($pseudo); $criteria = $bracketMatcher->match('(', ')'); $bracketMatcher = new \Transphporm\Parser\BracketMatcher($element->getNodePath()); $num = $bracketMatcher->match('[', ']'); if (is_callable([$this, $criteria])) { return $this->{$criteria}($num); } else { return $num == $criteria; } } return true; }
public function match($pseudo, \DomElement $element) { $pos = strpos($pseudo, '['); if ($pos === false) { return true; } $name = substr($pseudo, 0, $pos); if (!is_callable([$this->dataFunction, $name])) { return true; } $bracketMatcher = new \Transphporm\Parser\BracketMatcher($pseudo); $criteria = $bracketMatcher->match('[', ']'); if (strpos($pseudo, '=') === false) { $lookupValue = $this->dataFunction->{$name}([$criteria], $element); return $lookupValue !== null; } list($field, $value) = explode('=', $criteria); $operator = $this->getOperator($field); $lookupValue = $this->dataFunction->{$name}([trim($field, $operator)], $element); return $this->processOperator($operator, $lookupValue, $this->parseValue(trim($value, '"'))); }