public function RegexDirectoryIterator::__construct

public RegexDirectoryIterator::__construct($path, $regex)

RegexDirectoryIterator constructor.

Parameters

string $path: The path to scan.

string $regex: The regular expression to match, including delimiters. For example, /\.yml$/ would list only files ending in .yml.

File

core/lib/Drupal/Component/FileSystem/RegexDirectoryIterator.php, line 26

Class

RegexDirectoryIterator
Iterates over files whose names match a regular expression in a directory.

Namespace

Drupal\Component\FileSystem

Code

public function __construct($path, $regex) {
  // Use FilesystemIterator to not iterate over the the . and .. directories.
  $iterator = new \FilesystemIterator($path);
  parent::__construct($iterator);
  $this->regex = $regex;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!FileSystem!RegexDirectoryIterator.php/function/RegexDirectoryIterator::__construct/8.1.x