function WildcardFileFinder::addPaths in X Autoload 7.5
Same name and namespace in other branches
- 7.4 lib/Discovery/WildcardFileFinder.php \Drupal\xautoload\Discovery\WildcardFileFinder::addPaths()
Parameters
string[] $paths: Array keys are file paths or wildcard file paths.
mixed $value:
File
- src/
Discovery/ WildcardFileFinder.php, line 54
Class
- WildcardFileFinder
- Scan directories for wildcard files[] instructions in a module's info file.
Namespace
Drupal\xautoload\DiscoveryCode
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;
}
}
}