You are here

public function DirectoryOperations::directoryGlob in AT Tools 8.2

Same name and namespace in other branches
  1. 8.3 at_theme_generator/src/File/DirectoryOperations.php \Drupal\at_theme_generator\File\DirectoryOperations::directoryGlob()
  2. 8 at_theme_generator/src/File/DirectoryOperations.php \Drupal\at_theme_generator\File\DirectoryOperations::directoryGlob()

Recursively glob files below the path of a specified type.

Parameters

$path:

array $types:

Return value

array globbed files

File

at_theme_generator/src/File/DirectoryOperations.php, line 131
Contains \Drupal\at_theme_generator\File\DirectoryOperations

Class

DirectoryOperations

Namespace

Drupal\at_theme_generator\File

Code

public function directoryGlob($path, array $types) {
  $files = [];
  $scan_directories = self::directoryScan($path);
  if (isset($scan_directories)) {
    foreach ($scan_directories as $directory) {
      $glob_path = $types . $directory;
      if (is_dir($glob_path)) {
        if (isset($types)) {
          foreach ($types as $type) {
            $files[$directory][$type] = array_filter(glob($glob_path . "/*.{$type}"), 'is_file');
          }
        }
      }
    }
  }
  return $files;
}