function DirectoryLoader::load
Same name in this branch
- 11.1.x vendor/symfony/routing/Loader/DirectoryLoader.php \Symfony\Component\Routing\Loader\DirectoryLoader::load()
File
-
vendor/
symfony/ dependency-injection/ Loader/ DirectoryLoader.php, line 21
Class
- DirectoryLoader
- DirectoryLoader is a recursive loader to go through directories.
Namespace
Symfony\Component\DependencyInjection\LoaderCode
public function load(mixed $file, ?string $type = null) : mixed {
$file = rtrim($file, '/');
$path = $this->locator
->locate($file);
$this->container
->fileExists($path, false);
foreach (scandir($path) as $dir) {
if ('.' !== $dir[0]) {
if (is_dir($path . '/' . $dir)) {
$dir .= '/';
// append / to allow recursion
}
$this->setCurrentDir($path);
$this->import($dir, null, false, $path);
}
}
return null;
}