public function RegexDirectoryIterator::accept

public RegexDirectoryIterator::accept()

Implements \FilterIterator::accept().

File

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

Class

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

Namespace

Drupal\Component\FileSystem

Code

public function accept() {
  /** @var \SplFileInfo $file_info */
  $file_info = $this->getInnerIterator()->current();
  return $file_info->isFile() && preg_match($this->regex, $file_info->getFilename());
}

© 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::accept/8.1.x