public function RegexDirectoryIterator::accept in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Component/FileSystem/RegexDirectoryIterator.php \Drupal\Component\FileSystem\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\FileSystemCode
public function accept() {
/** @var \SplFileInfo $file_info */
$file_info = $this
->getInnerIterator()
->current();
return $file_info
->isFile() && preg_match($this->regex, $file_info
->getFilename());
}