public function Crawler::filter in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/dom-crawler/Crawler.php \Symfony\Component\DomCrawler\Crawler::filter()
Filters the list of nodes with a CSS selector.
This method only works if you have installed the CssSelector Symfony Component.
Parameters
string $selector A CSS selector:
Return value
Crawler A new instance of Crawler with the filtered list of nodes
Throws
\RuntimeException if the CssSelector Component is not available
File
- vendor/
symfony/ dom-crawler/ Crawler.php, line 651
Class
- Crawler
- Crawler eases navigation of a list of \DOMElement objects.
Namespace
Symfony\Component\DomCrawlerCode
public function filter($selector) {
if (!class_exists('Symfony\\Component\\CssSelector\\CssSelector')) {
throw new \RuntimeException('Unable to filter with a CSS selector as the Symfony CssSelector is not installed (you can use filterXPath instead).');
}
// The CssSelector already prefixes the selector with descendant-or-self::
return $this
->filterRelativeXPath(CssSelector::toXPath($selector));
}