function Crawler::add
Adds a node to the current list of nodes.
This method uses the appropriate specialized add*() method based on the type of the argument.
Parameters
\DOMNodeList|\DOMNode|\DOMNode[]|string|null $node A node:
Throws
\InvalidArgumentException when node is not the expected type
2 calls to Crawler::add()
- Crawler::addNodes in vendor/
symfony/ dom-crawler/ Crawler.php - Adds an array of \DOMNode instances to the list of nodes.
- Crawler::__construct in vendor/
symfony/ dom-crawler/ Crawler.php
File
-
vendor/
symfony/ dom-crawler/ Crawler.php, line 110
Class
- Crawler
- Crawler eases navigation of a list of \DOMNode objects.
Namespace
Symfony\Component\DomCrawlerCode
public function add(\DOMNodeList|\DOMNode|array|string|null $node) : void {
if ($node instanceof \DOMNodeList) {
$this->addNodeList($node);
}
elseif ($node instanceof \DOMNode) {
$this->addNode($node);
}
elseif (\is_array($node)) {
$this->addNodes($node);
}
elseif (\is_string($node)) {
$this->addContent($node);
}
elseif (null !== $node) {
throw new \InvalidArgumentException(\sprintf('Expecting a DOMNodeList or DOMNode instance, an array, a string, or null, but got "%s".', get_debug_type($node)));
}
}