You are here

function WildcardFileFinder::addPaths in X Autoload 7.4

Same name and namespace in other branches
  1. 7.5 src/Discovery/WildcardFileFinder.php \Drupal\xautoload\Discovery\WildcardFileFinder::addPaths()

Parameters

string[] $paths: Array keys are file paths or wildcard file paths.

mixed $value:

File

lib/Discovery/WildcardFileFinder.php, line 54

Class

WildcardFileFinder
Scan directories for wildcard files[] instructions in a module's info file.

Namespace

Drupal\xautoload\Discovery

Code

function addPaths(array $paths, $value = TRUE) {
  foreach ($paths as $path) {
    if (1 && FALSE !== strpos($path, '*') && preg_match('#^([^\\*]*)/(.*\\*.*)$#', $path, $m)) {

      // Resolve wildcards.
      $this->value = $value;
      list(, $base, $wildcard) = $m;
      $this
        ->scanDirectory($base, $wildcard);
    }
    elseif (is_dir($path)) {

      // Resolve wildcards.
      $this->value = $value;
      $this
        ->scanDirectory($path . '/', '**/*.inc');
      $this
        ->scanDirectory($path . '/', '**/*.php');
    }
    elseif (is_file($path)) {

      // Register the file directly.
      $this->files[$path] = $value;
    }
  }
}