Return params prepared for url builder

@param  array $rewrite

@return array
5396
public function getParams(array $rewrite = []): array
    {
        $params = $this->params;

        // change page to first for each new grid (with new filters or orders, or other stuff)
        $page = $rewrite['page'] ?? 1;

        if ($page > 1) {
            $params[$this->prefix . 'page'] = $page;
        }

        // change limit
        $limit = $rewrite['limit'] ?? $this->getLimit();

        if ($limit !== $this->defaultLimit) {
            $params[$this->prefix . 'limit'] = $limit;
        }

        // change orders
        $orders = $rewrite['orders'] ?? $this->getOrders();

        foreach ($orders as $column => $order) {
            $column = $this->applyAlias($column);
            $params[$this->prefix . 'order-' . $column] = $order;
        }

        // change filters
        $filters = $rewrite['filters'] ?? $this->getFilters();

        foreach ($filters as $column => $columnFilters) {
            /** @var array $columnFilters */
            $column = $this->applyAlias($column);
            if (\count($columnFilters) === 1 && isset($columnFilters[self::FILTER_EQ])) {
                $params[$this->prefix . 'filter-' . $column] = $columnFilters[self::FILTER_EQ];
                continue;
            }

            $columnFilter = [];
            foreach ($columnFilters as $filterName => $filterValue) {
                $columnFilter[] = $filterName . '-' . $filterValue;
            }
            $params[$this->prefix . 'filter-' . $column] = implode('_', $columnFilter);
        }
        return $params;
    }
318789
public function pathToString($path, $rewrite = false)
    {
        if (is_string($path)) {
            return $path;
        }
        $str = $this->basePath;
        if ($str == '/') {
            $str = '';
        }
        if (! ($this->rewrite or $rewrite)) {
            $str .= '/' . $this->scriptName;
        }
        $str .= '/' . implode('/', array_map('urlencode', $path));
        $str = rtrim($str, '/');
        if ($str == '') {
            return '/';
        }
        return $str;
    }
983333
public function getRequestParameters()
    {
        $parameters = [];

        if ($this->isRequestPost()) {
            $input = file_get_contents("php://input");
            $arguments = explode('&', $input);
            foreach ($arguments as $argument) {
                $argumentSplited = explode('=', $argument);
                $key = urldecode($argumentSplited[0]);
                $value = urldecode($argumentSplited[1]);
                // for multiple values
                if (strpos($value, ',')) {
                    $value = explode(',', $value);
                }
                if (substr($key, -2) == '[]') {
                    $key = substr($key, 0, strlen($key)-2);
                    if (!isset($parameters[$key])) {
                        $parameters[$key] = [];
                    }
                    $parameters[$key][] = $value;
                } else {
                    $parameters[$key] = $value;
                }
            }
        } else {
            $parameters = parent::getRequestParameters();
        }

        return $parameters;
    }
216583
private function getUriParams($route)
    {
        preg_match_all('~{(\w+)}~', $this->getRouteParam($route, 'uri'), $matches);
        
        return isset($matches[1]) ? $matches[1] : [];
    }
1348269
public function getUrl(array $params = [])
    {
        $params = $this->getParams($params);
        $constructedUrl = $this->url;
        if (count($params)) {
            $constructedUrl .= '?';
            foreach ($params as $key => $val) {
                $constructedUrl .= $key . '=' . $val . '&';
            }
            $constructedUrl = substr($constructedUrl, 0, -1);
        }
        return $constructedUrl;
    }
1120263
public function getUrlRule()
    {
        $request = $this->getRequestRoute();
        
        return [
            'module' => $this->module->id,
            'route' => $this->module->id . '/' . $request['route'],
            'params' => $request['originalArgs'],
        ];
    }
628935
public function parameters($request)
    {
        // If the route has a regular expression for the host part of the URI, we will
        // compile that and get the parameter matches for this domain. We will then
        // merge them into this parameters array so that this array is completed.
        $parameters = $this->bindPathParameters($request);

        // If the route has a regular expression for the host part of the URI, we will
        // compile that and get the parameter matches for this domain. We will then
        // merge them into this parameters array so that this array is completed.
        if (! is_null($this->route->compiled->getHostRegex())) {
            $parameters = $this->bindHostParameters(
                $request, $parameters
            );
        }

        return $this->replaceDefaults($parameters);
    }
194078
public function get_return_params() {
        global $PAGE;

        $params = array();
        if (!WS_SERVER) {
            $params = $PAGE->url->params();
        }
        unset($params['id']);
        unset($params['action']);
        return $params;
    }
184460
public static function parseParameters($link)
    {
        $pos = strpos($link, '?');
        if ($pos !== null) {
            $link = substr($link, $pos + 1);
        }

        $params = [];
        parse_str($link, $params);

        return $params;
    }
30061
protected function appendRedirectableGetParameters($url)
    {
        $concat = (parse_url($url, PHP_URL_QUERY) === null)
            ? '?'
            : '&';

        return
            $url . (
            $this->settingsManager->getRedirectableGetParameters()
                ? $concat . $this->settingsManager->getRedirectableGetParameters()
                : ''
            );
    }
1028745
protected function _getUrl($url, $rel = false)
    {
        if (!is_array($url)) {
            $url = ltrim($url, '/');
            $url = '/' . $url;
        }
        if ($rel !== false) {
            $url = Router::url($url);
        }
        return $url;
    }
359604
protected function extractUrlParameters($url)
    {
        $query = parse_url($url, PHP_URL_QUERY);
        parse_str($query, $params);

        return $params;
    }
483816
private function getNestedParams(array $params)
    {
        $query = http_build_query($params, null, '&');
        $params = explode('&', $query);
        $result = [];

        foreach ($params as $param) {
            list($key, $value) = explode('=', $param, 2);
            $result[urldecode($key)] = urldecode($value);
        }

        return $result;
    }
545860
public static function getParamsAsArray($url)
    {
        $query = parse_url($url, PHP_URL_QUERY);
        if (!$query) {
            return [];
        }
        $params = [];
        parse_str($query, $params);

        return $params;
    }
657379
protected function parseUrlParams($url_params)
    {
        if ($url_params != '#' && (is_array($url_params) || (strpos($url_params, 'http') !== 0 && strpos($url_params, '/') !== 0))) {
            if (!is_array($url_params))
                $url_params = array($url_params);
            $url_to = Rails::application()->router()->urlFor($url_params, true);
        } else {
            $url_to = $url_params;
        }
        return $url_to;
    }
899669
protected function parseUrl($uri)
    {
        $parsedUrl = parse_url($uri);

        return [
            isset($parsedUrl['scheme']) ? $parsedUrl['scheme'] : '',
            isset($parsedUrl['host']) ? $parsedUrl['host'] : '',
            isset($parsedUrl['port']) ? $parsedUrl['port'] : null,
            isset($parsedUrl['path']) ? $parsedUrl['path'] : '/',
            isset($parsedUrl['query']) ? $parsedUrl['query'] : '',
            isset($parsedUrl['fragment']) ? $parsedUrl['fragment'] : '',
            isset($parsedUrl['user']) ? $parsedUrl['user'] : '',
            isset($parsedUrl['pass']) ? $parsedUrl['pass'] : ''
        ];
    }
577834
private function buildUrlParams(
        string $url,
        array $params
    ) {
        array_walk($params, function (&$value, $key) {
            $value = "$key=$value";
        });

        return $url.'?'.implode('&', $params);
    }