function YamlDirectoryDiscovery::findFiles

Same name in other branches
  1. 9 core/lib/Drupal/Component/Discovery/YamlDirectoryDiscovery.php \Drupal\Component\Discovery\YamlDirectoryDiscovery::findFiles()
  2. 8.9.x core/lib/Drupal/Component/Discovery/YamlDirectoryDiscovery.php \Drupal\Component\Discovery\YamlDirectoryDiscovery::findFiles()
  3. 10 core/lib/Drupal/Component/Discovery/YamlDirectoryDiscovery.php \Drupal\Component\Discovery\YamlDirectoryDiscovery::findFiles()

Returns an array of providers keyed by file path.

Return value

array An array of providers keyed by file path.

1 call to YamlDirectoryDiscovery::findFiles()
YamlDirectoryDiscovery::findAll in core/lib/Drupal/Component/Discovery/YamlDirectoryDiscovery.php
Returns an array of discoverable items.

File

core/lib/Drupal/Component/Discovery/YamlDirectoryDiscovery.php, line 125

Class

YamlDirectoryDiscovery
Discovers multiple YAML files in a set of directories.

Namespace

Drupal\Component\Discovery

Code

protected function findFiles() {
    $file_list = [];
    foreach ($this->directories as $provider => $directories) {
        $directories = (array) $directories;
        foreach ($directories as $directory) {
            if (is_dir($directory)) {
                
                /** @var \SplFileInfo $fileInfo */
                foreach ($this->getDirectoryIterator($directory) as $fileInfo) {
                    $file_list[$fileInfo->getPathname()] = $provider;
                }
            }
        }
    }
    return $file_list;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.