public function Finder::append in Database Sanitize 7
Appends an existing set of files/directories to the finder.
The set can be another Finder, an Iterator, an IteratorAggregate, or even a plain array.
Parameters
iterable $iterator:
Return value
$this
Throws
\InvalidArgumentException when the given argument is not iterable
File
- vendor/
symfony/ finder/ Finder.php, line 598
Class
- Finder
- Finder allows to build rules to find files and directories.
Namespace
Symfony\Component\FinderCode
public function append($iterator) {
if ($iterator instanceof \IteratorAggregate) {
$this->iterators[] = $iterator
->getIterator();
}
elseif ($iterator instanceof \Iterator) {
$this->iterators[] = $iterator;
}
elseif ($iterator instanceof \Traversable || \is_array($iterator)) {
$it = new \ArrayIterator();
foreach ($iterator as $file) {
$it
->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
}
$this->iterators[] = $it;
}
else {
throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
}
return $this;
}