You are here

public function Finder::in in Database Sanitize 7

Searches files and directories which match defined rules.

Parameters

string|array $dirs A directory path or an array of directories:

Return value

$this

Throws

\InvalidArgumentException if one of the directories does not exist

File

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

Class

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

Namespace

Symfony\Component\Finder

Code

public function in($dirs) {
  $resolvedDirs = array();
  foreach ((array) $dirs as $dir) {
    if (is_dir($dir)) {
      $resolvedDirs[] = $this
        ->normalizeDir($dir);
    }
    elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
      $resolvedDirs = array_merge($resolvedDirs, array_map(array(
        $this,
        'normalizeDir',
      ), $glob));
    }
    else {
      throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
    }
  }
  $this->dirs = array_merge($this->dirs, $resolvedDirs);
  return $this;
}