function YamlDirectoryDiscovery::getDirectoryIterator

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

Gets an iterator to loop over the files in the provided directory.

This method exists so that it is easy to replace this functionality in a class that extends this one. For example, it could be used to make the scan recursive.

Parameters

string $directory: The directory to scan.

Return value

\Traversable An \Traversable object or array where the values are \SplFileInfo objects.

1 call to YamlDirectoryDiscovery::getDirectoryIterator()
YamlDirectoryDiscovery::findFiles in core/lib/Drupal/Component/Discovery/YamlDirectoryDiscovery.php
Returns an array of providers keyed by file path.

File

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

Class

YamlDirectoryDiscovery
Discovers multiple YAML files in a set of directories.

Namespace

Drupal\Component\Discovery

Code

protected function getDirectoryIterator($directory) {
    return new RegexDirectoryIterator($directory, '/\\.yml$/i');
}

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