protected function globToRegexp($glob)
    {
        $sourceParts = explode('*', $glob);
        $regexParts = array_map(function ($part) {
            return preg_quote($part, '#');
        }, $sourceParts);
        return implode('(.+)', $regexParts);
    }