src/Glob.php
protected static function fallbackGlob($pattern, $flags)
    {
        if (! $flags & self::GLOB_BRACE) {
            return static::systemGlob($pattern, $flags);
        }
        $flags &= ~self::GLOB_BRACE;
        $length = strlen($pattern);
        $paths  = [];
        if ($flags & self::GLOB_NOESCAPE) {
            $begin = strpos($pattern, '{');
        } else {
            $begin = 0;
            while (true) {
                if ($begin === $length) {
                    $begin = false;
                    break;
                } elseif ($pattern[$begin] === '\\' && ($begin + 1) < $length) {
                    $begin++;
                } elseif ($pattern[$begin] === '{') {
                    break;
                }
                $begin++;
            }
        }
        if ($begin === false) {
            return static::systemGlob($pattern, $flags);
        }
        $next = static::nextBraceSub($pattern, $begin + 1, $flags);
        if ($next === null) {
            return static::systemGlob($pattern, $flags);
        }
        $rest = $next;
        while ($pattern[$rest] !== '}') {
            $rest = static::nextBraceSub($pattern, $rest + 1, $flags);
            if ($rest === null) {
                return static::systemGlob($pattern, $flags);
            }
        }
        $p = $begin + 1;
        while (true) {
            $subPattern = substr($pattern, 0, $begin)
                . substr($pattern, $p, $next - $p)
                . substr($pattern, $rest + 1);
            $result = static::fallbackGlob($subPattern, $flags | self::GLOB_BRACE);
            if ($result) {
                $paths = array_merge($paths, $result);
            }
            if ($pattern[$next] === '}') {
                break;
            }
            $p    = $next + 1;
            $next = static::nextBraceSub($pattern, $p, $flags);
        }
        return array_unique($paths);
    }
protected static function fallbackGlob($pattern, $flags)
    {
        if (! $flags & self::GLOB_BRACE) {
            return static::systemGlob($pattern, $flags);
        }
        $flags &= ~self::GLOB_BRACE;
        $length = strlen($pattern);
        $paths  = [];
        if ($flags & self::GLOB_NOESCAPE) {
            $begin = strpos($pattern, '{');
        } else {
            $begin = 0;
            while (true) {
                if ($begin === $length) {
                    $begin = false;
                    break;
                } elseif ($pattern[$begin] === '\\' && ($begin + 1) < $length) {
                    $begin++;
                } elseif ($pattern[$begin] === '{') {
                    break;
                }
                $begin++;
            }
        }
        if ($begin === false) {
            return static::systemGlob($pattern, $flags);
        }
        $next = static::nextBraceSub($pattern, $begin + 1, $flags);
        if ($next === null) {
            return static::systemGlob($pattern, $flags);
        }
        $rest = $next;
        while ($pattern[$rest] !== '}') {
            $rest = static::nextBraceSub($pattern, $rest + 1, $flags);
            if ($rest === null) {
                return static::systemGlob($pattern, $flags);
            }
        }
        $p = $begin + 1;
        while (true) {
            $subPattern = substr($pattern, 0, $begin)
                . substr($pattern, $p, $next - $p)
                . substr($pattern, $rest + 1);
            $result = static::fallbackGlob($subPattern, $flags | self::GLOB_BRACE);
            if ($result) {
                $paths = array_merge($paths, $result);
            }
            if ($pattern[$next] === '}') {
                break;
            }
            $p    = $next + 1;
            $next = static::nextBraceSub($pattern, $p, $flags);
        }
        return array_unique($paths);
    }
protected static function fallbackGlob ( $ pattern , $ flags ) { if ( ! $ flags & self :: GLOB_BRACE ) { return static :: systemGlob ( $ pattern , $ flags ) ; } $ flags &= ~ self :: GLOB_BRACE ; $ length = strlen ( $ pattern ) ; $ paths = [ ] ; if ( $ flags & self :: GLOB_NOESCAPE ) { $ begin = strpos ( $ pattern , '{' ) ; } else { $ begin = 0 ; while ( true ) { if ( $ begin === $ length ) { $ begin = false ; break ; } elseif ( $ pattern [ $ begin ] === '\\' && ( $ begin + 1 ) < $ length ) { $ begin ++ ; } elseif ( $ pattern [ $ begin ] === '{' ) { break ; } $ begin ++ ; } } if ( $ begin === false ) { return static :: systemGlob ( $ pattern , $ flags ) ; } $ next = static :: nextBraceSub ( $ pattern , $ begin + 1 , $ flags ) ; if ( $ next === null ) { return static :: systemGlob ( $ pattern , $ flags ) ; } $ rest = $ next ; while ( $ pattern [ $ rest ] !== '}' ) { $ rest = static :: nextBraceSub ( $ pattern , $ rest + 1 , $ flags ) ; if ( $ rest === null ) { return static :: systemGlob ( $ pattern , $ flags ) ; } } $ p = $ begin + 1 ; while ( true ) { $ subPattern = substr ( $ pattern , 0 , $ begin ) . substr ( $ pattern , $ p , $ next - $ p ) . substr ( $ pattern , $ rest + 1 ) ; $ result = static :: fallbackGlob ( $ subPattern , $ flags | self :: GLOB_BRACE ) ; if ( $ result ) { $ paths = array_merge ( $ paths , $ result ) ; } if ( $ pattern [ $ next ] === '}' ) { break ; } $ p = $ next + 1 ; $ next = static :: nextBraceSub ( $ pattern , $ p , $ flags ) ; } return array_unique ( $ paths ) ; }
Expand braces manually, then use the system glob.

@param  string  $pattern
@param  int     $flags
@return array
@throws \RuntimeException
Expand braces manually then use the system glob .