Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Finder.php

function Finder::append

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.

Return value

$this

File

vendor/symfony/finder/Finder.php, line 703

Class

Finder
Finder allows to build rules to find files and directories.

Namespace

Symfony\Component\Finder

Code

public function append(iterable $iterator) : static {
    if ($iterator instanceof \IteratorAggregate) {
        $this->iterators[] = $iterator->getIterator();
    }
    elseif ($iterator instanceof \Iterator) {
        $this->iterators[] = $iterator;
    }
    else {
        $it = new \ArrayIterator();
        foreach ($iterator as $file) {
            $file = $file instanceof \SplFileInfo ? $file : new \SplFileInfo($file);
            $it[$file->getPathname()] = $file;
        }
        $this->iterators[] = $it;
    }
    return $this;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal