// The actual recursive filesystem scan is only invoked by instantiating the
// RecursiveIteratorIterator.
$iterator =
new \
RecursiveIteratorIterator($filter,
\RecursiveIteratorIterator::LEAVES_ONLY,
// Suppress filesystem errors in case a directory cannot be accessed.
\RecursiveIteratorIterator::CATCH_GET_CHILD
);
foreach ($iterator as $key =>
$fileinfo) { // All extension names in Drupal have to be valid PHP function names due
// to the module hook architecture.
if (!
preg_match(static::PHP_FUNCTION_PATTERN,
$fileinfo->
getBasename('.info.yml'
))) { continue;
} $extension_arguments =
$this->fileCache ?
$this->fileCache->
get($fileinfo->
getPathName()) : FALSE;
// Ensure $extension_arguments is an array. Previously, the Extension
// object was cached and now needs to be replaced with the array.
if (empty($extension_arguments) || !
is_array($extension_arguments)) { // Determine extension type from info file.
$type = FALSE;
$file =
$fileinfo->
openFile('r'
);
while (!
$type && !
$file->
eof()) {