function Crawler::children
Returns the children nodes of the current selection.
Throws
\InvalidArgumentException When current node is empty
\RuntimeException If the CssSelector Component is not available and $selector is provided
File
-
vendor/
symfony/ dom-crawler/ Crawler.php, line 483
Class
- Crawler
- Crawler eases navigation of a list of \DOMNode objects.
Namespace
Symfony\Component\DomCrawlerCode
public function children(?string $selector = null) : static {
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
}
if (null !== $selector) {
$converter = $this->createCssSelectorConverter();
$xpath = $converter->toXPath($selector, 'child::');
return $this->filterRelativeXPath($xpath);
}
$node = $this->getNode(0)->firstChild;
return $this->createSubCrawler($node ? $this->sibling($node) : []);
}