class DirectoryLoader
Same name in this branch
- 11.1.x vendor/symfony/routing/Loader/DirectoryLoader.php \Symfony\Component\Routing\Loader\DirectoryLoader
DirectoryLoader is a recursive loader to go through directories.
@author Sebastien Lavoie <seb@wemakecustom.com>
Hierarchy
- class \Symfony\Component\DependencyInjection\Loader\FileLoader extends \Symfony\Component\Config\Loader\FileLoader
- class \Symfony\Component\DependencyInjection\Loader\DirectoryLoader extends \Symfony\Component\DependencyInjection\Loader\FileLoader
Expanded class hierarchy of DirectoryLoader
2 files declare their use of DirectoryLoader
- ExtensionTrait.php in vendor/
symfony/ dependency-injection/ Extension/ ExtensionTrait.php - Kernel.php in vendor/
symfony/ http-kernel/ Kernel.php
File
-
vendor/
symfony/ dependency-injection/ Loader/ DirectoryLoader.php, line 19
Namespace
Symfony\Component\DependencyInjection\LoaderView source
class DirectoryLoader extends FileLoader {
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;
}
public function supports(mixed $resource, ?string $type = null) : bool {
if ('directory' === $type) {
return true;
}
return null === $type && \is_string($resource) && str_ends_with($resource, '/');
}
}