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

_compileStack() protected static method

protected static _compileStack ( $stack )
    protected static function _compileStack($stack)
    {
        $result = null;
        list($result, $query) = array_pad(explode('?', array_pop($stack), 2), 2, null);
        foreach (array_reverse($stack) as $fragment) {
            $result = ltrim($result, '/');
            $result = str_replace(($result ? '' : '/') . '{:args}', $result, $fragment);
        }
        return $result . ($query ? '?' . $query : '');
    }