$excluded =
[];
foreach ((array) $exclude as $pattern) { foreach ($this->
glob($pattern, true,
$_, false, true
) as $path =>
$info) { // normalize Windows slashes and remove trailing slashes
$excluded[rtrim(str_replace('\\', '/',
$path), '/'
)] = true;
} } $ret =
[];
$isSubpath = 0 !==
$i &&
str_contains(substr($resource, 0,
$i), '/'
);
foreach ($this->
glob($resource, false,
$_,
$ignoreErrors || !
$isSubpath, false,
$excluded) as $path =>
$info) { if (null !==
$res =
$this->
doImport($path, 'glob' ===
$type ? null :
$type,
$ignoreErrors,
$sourceResource)) { $ret[] =
$res;
} $isSubpath = true;
} if ($isSubpath) { return isset($ret[1
]) ?
$ret :
($ret[0
] ?? null
);
} } return $this->
doImport($resource,
$type,
$ignoreErrors,
$sourceResource);
}