You are here

public function FileReadOnlyStorage::listAll in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Component/PhpStorage/FileReadOnlyStorage.php \Drupal\Component\PhpStorage\FileReadOnlyStorage::listAll()

Lists all the files in the storage.

Return value

array Array of filenames.

Overrides PhpStorageInterface::listAll

File

core/lib/Drupal/Component/PhpStorage/FileReadOnlyStorage.php, line 85

Class

FileReadOnlyStorage
Reads code as regular PHP files, but won't write them.

Namespace

Drupal\Component\PhpStorage

Code

public function listAll() {
  $names = [];
  if (file_exists($this->directory)) {
    foreach (new \DirectoryIterator($this->directory) as $fileinfo) {
      if (!$fileinfo
        ->isDot()) {
        $name = $fileinfo
          ->getFilename();
        if ($name != '.htaccess') {
          $names[] = $name;
        }
      }
    }
  }
  return $names;
}