lithium\net\http\Router::_parseScope PHP Method

_parseScope() protected static method

Return the unscoped url to route.
protected static _parseScope ( string $name, string $request ) : mixed
$name string Scope name.
$request string A `lithium\action\Request` instance .
return mixed The url to route, or `false` if the request doesn't match the scope.
    protected static function _parseScope($name, $request)
    {
        $url = trim($request->url, '/');
        $url = $url ? '/' . $url . '/' : '/';
        if (!($config = static::attached($name))) {
            return $url;
        }
        $scheme = $request->scheme . ($request->scheme ? '://' : '//');
        $host = $request->host;
        if ($config['absolute']) {
            preg_match($config['pattern'], $scheme . $host . $url, $match);
        } else {
            preg_match($config['pattern'], $url, $match);
        }
        if ($match) {
            $result = array_intersect_key($match, array_flip($config['params']));
            $request->params = array();
            if (isset($config['library'])) {
                $request->params['library'] = $config['library'];
            }
            $request->params += $result;
            if ($config['prefix']) {
                $url = preg_replace('@^/' . trim($config['prefix'], '/') . '@', '', $url);
            }
            return $url;
        }
        return false;
    }