function Finder::in
Searches files and directories which match defined rules.
Parameters
string|string[] $dirs A directory path or an array of directories:
Return value
$this
Throws
DirectoryNotFoundException if one of the directories does not exist
File
-
vendor/
symfony/ finder/ Finder.php, line 635
Class
- Finder
- Finder allows to build rules to find files and directories.
Namespace
Symfony\Component\FinderCode
public function in(string|array $dirs) : static {
$resolvedDirs = [];
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 | \GLOB_NOSORT)) {
sort($glob);
$resolvedDirs[] = array_map($this->normalizeDir(...), $glob);
}
else {
throw new DirectoryNotFoundException(\sprintf('The "%s" directory does not exist.', $dir));
}
}
$this->dirs = array_merge($this->dirs, ...$resolvedDirs);
return $this;
}