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

Breadcrumb

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

function DirectoryLoader::load

Same name in this branch
  1. 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\Loader

Code

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;
}

API Navigation

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