function RegexDirectoryIterator::accept
Same name in other branches
- 9 core/lib/Drupal/Component/FileSystem/RegexDirectoryIterator.php \Drupal\Component\FileSystem\RegexDirectoryIterator::accept()
- 8.9.x core/lib/Drupal/Component/FileSystem/RegexDirectoryIterator.php \Drupal\Component\FileSystem\RegexDirectoryIterator::accept()
- 11.x core/lib/Drupal/Component/FileSystem/RegexDirectoryIterator.php \Drupal\Component\FileSystem\RegexDirectoryIterator::accept()
Implements \RegexIterator::accept().
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\FileSystemCode
public function accept() {
/** @var \SplFileInfo $file_info */
$file_info = $this->getInnerIterator()
->current();
return $file_info->isFile() && preg_match($this->getRegex(), $file_info->getFilename());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.