public function QueryPath::not in QueryPath 6
Same name and namespace in other branches
- 7.3 QueryPath/QueryPath.php \QueryPath::not()
- 7.2 QueryPath/QueryPath.php \QueryPath::not()
File
- QueryPath/
QueryPath.php, line 516
Class
Code
public function not($selector) {
$found = new SplObjectStorage();
if ($selector instanceof DOMElement) {
foreach ($this->matches as $m) {
if ($m !== $selector) {
$found
->attach($m);
}
}
}
elseif (is_array($selector)) {
foreach ($this->matches as $m) {
if (!in_array($m, $selector, TRUE)) {
$found
->attach($m);
}
}
}
elseif ($selector instanceof SplObjectStorage) {
foreach ($this->matches as $m) {
if ($selector
->contains($m)) {
$found
->attach($m);
}
}
}
else {
foreach ($this->matches as $m) {
if (!qp($m, NULL, $this->options)
->is($selector)) {
$found
->attach($m);
}
}
}
$this
->setMatches($found);
return $this;
}