You are here

public static function LegacyWrapper::scanDirectory in Mini site 8

Finds all files that match a given mask in a given directory.

Throws

\RuntimeException If compatible function is not found.

4 calls to LegacyWrapper::scanDirectory()
Asset::delete in src/Asset.php
Delete asset, while also removing empty directories.
Minisite::processArchive in src/Minisite.php
Process archive by extracting files and filling-in assets information.
MinisiteTestBase::assertAssetFilesExist in tests/src/Functional/MinisiteTestBase.php
Assert assets paths exist.
MinisiteTestBase::assertAssetFilesNotExist in tests/src/Functional/MinisiteTestBase.php
Assert assets paths not exist.

File

src/LegacyWrapper.php, line 25

Class

LegacyWrapper
Class LegacyWrapper.

Namespace

Drupal\minisite

Code

public static function scanDirectory($dir, $mask, array $options = []) {
  if (method_exists(FileSystem::class, 'scanDirectory')) {

    /** @var \Drupal\Core\File\FileSystemInterface $fs */
    $fs = \Drupal::service('file_system');
    return $fs
      ->scanDirectory($dir, $mask, $options);
  }
  if (function_exists('file_scan_directory')) {
    return file_scan_directory($dir, $mask, $options);
  }
  throw new \RuntimeException('Unable to find compatible function');
}