protected static function Glob::systemGlob in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/zendframework/zend-stdlib/src/Glob.php \Zend\Stdlib\Glob::systemGlob()
Use the glob function provided by the system.
Parameters
string $pattern:
int $flags:
Return value
array
Throws
Exception\RuntimeException
2 calls to Glob::systemGlob()
- Glob::fallbackGlob in vendor/
zendframework/ zend-stdlib/ src/ Glob.php - Expand braces manually, then use the system glob.
- Glob::glob in vendor/
zendframework/ zend-stdlib/ src/ Glob.php - Find pathnames matching a pattern.
File
- vendor/
zendframework/ zend-stdlib/ src/ Glob.php, line 56
Class
- Glob
- Wrapper for glob with fallback if GLOB_BRACE is not available.
Namespace
Zend\StdlibCode
protected static function systemGlob($pattern, $flags) {
if ($flags) {
$flagMap = [
self::GLOB_MARK => GLOB_MARK,
self::GLOB_NOSORT => GLOB_NOSORT,
self::GLOB_NOCHECK => GLOB_NOCHECK,
self::GLOB_NOESCAPE => GLOB_NOESCAPE,
self::GLOB_BRACE => GLOB_BRACE,
self::GLOB_ONLYDIR => GLOB_ONLYDIR,
self::GLOB_ERR => GLOB_ERR,
];
$globFlags = 0;
foreach ($flagMap as $internalFlag => $globFlag) {
if ($flags & $internalFlag) {
$globFlags |= $globFlag;
}
}
}
else {
$globFlags = 0;
}
ErrorHandler::start();
$res = glob($pattern, $globFlags);
$err = ErrorHandler::stop();
if ($res === false) {
throw new Exception\RuntimeException("glob('{$pattern}', {$globFlags}) failed", 0, $err);
}
return $res;
}