You are here

public function DirectoryOperations::directoryScanRecursive in AT Tools 8

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

Scan directories recursively.

Parameters

$path:

Return value

array Directories & files below the path. Directories & files below the path.

File

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

Class

DirectoryOperations

Namespace

Drupal\at_theme_generator\File

Code

public function directoryScanRecursive($path) {
  $scan_directories_recursive = array();
  $path_directory = scandir($path);
  foreach ($path_directory as $key => $value) {
    if (!in_array($value, array(
      ".",
      "..",
    ))) {
      if (is_dir($path . '/' . $value)) {
        $scan_directories_recursive[$value] = self::directoryScanRecursive($path . '/' . $value);
      }
      else {
        $scan_directories_recursive[] = $value;
      }
    }
  }
  return $scan_directories_recursive;
}