Map server params for URI

@param array $params
@return array
424908
protected function mapUriPartsFromServerParams(array $params)
    {
        $parts = [];
        
        $map = [
            'PHP_AUTH_USER' => 'user',
            'PHP_AUTH_PWD' => 'password',
            'HTTP_HOST' => 'host',
            'SERVER_PORT' => 'port',
            'REQUEST_URI' => 'path',
            'QUERY_STRING' => 'query'
        ];
        
        foreach ($map as $param => $key) {
            if (isset($params[$param])) {
                $parts[$key] = $params[$param];
            }
        }
        
        return $parts;
    }
1015319
public function findByParams($params = [])
    {
        $query = $this->paramsToQuery($params);

        return $this->findByQuery($query, $params);
    }
1164309
public function map(array $params)
	{
		if (!isset($params['ientifier'])) {
			throw new MissingArgumentException('identifier');
		}

		if (!isset($params['primaryKey'])) {
			throw new MissingArgumentException('primaryKey');
		}

		if (!isset($params['format'])) {
			$params['format'] = 'json';
		}

		return $this->post('map', $params);
	}
1163808
private function getDateParams($params)
    {
        /**
         * @var \DateTime
         */
        $to = $this->dateContext;
        /**
         * @var \DateTime
         */
        $from = clone $to;
        $from->sub(new \DateInterval('PT4M'));
        $from->sub(new \DateInterval('PT59S'));

        $params['dateFrom'] = $from->format('Y-m-d H:i:s');

        $params['dateTo'] = $to->format('Y-m-d H:i:s');

        return $params;
    }
428705
public function getHandler(...$params): array
    {
        list($path, $method) = $params;
        // list($path, $info) = $router;

        return $this->match($path, $method);
    }
642680
private function httpBuildQuery($params)
    {
        $query = [];
        foreach ($params as $key => $param) {
            if (!is_array($param)) {
                continue;
            }
            // when a param has many values, it generate the query string separated to join late
            foreach ($param as $subParam) {
                $query[] = http_build_query([$key => $subParam]);
            }
            unset($params[$key]);
        }

        // join queries strings
        $query[] = http_build_query($params);
        $query = implode('&', $query);

        return $query;
    }
1134569
public function getUri($params = array())
    {
        $uri = $this->route;

        if (!empty($params)) {
            $uri = str_replace(array_keys($params), $params, $this->route);
        }

        return $uri;
    }
819397
private static function formatParameters(array $params)
    {
        return '[' . implode(', ', array_map(static function ($param) {
            if (is_resource($param)) {
                return (string) $param;
            }

            $json = @json_encode($param);

            if (! is_string($json) || $json === 'null' && is_string($param)) {
                // JSON encoding failed, this is not a UTF-8 string.
                return sprintf('"%s"', preg_replace('/.{2}/', '\\x$0', bin2hex($param)));
            }

            return $json;
        }, $params)) . ']';
    }
1175739
private function serializeRuleParams($params)
    {
        $result = [];
        foreach ($params as $key => $value) {
            if (is_array($value)) {
                $value = '['.$this->serializeRuleParams($value).']';
            }
            if (is_numeric($key)) {
                $result[] = $value;
            } else {
                $result[] = "'$key' => $value";
            }
        }
        return implode(', ', $result);
    }
1182943
private function getRouteParams(array $params = [], array $default = [])
    {
        return array_merge(
            $this->request->query->all(),
            $this->request->attributes->get('_route_params'),
            array_merge($params, $default)
        );
    }
341591
public function getAliases($params = [])
    {
        return $this->getClient()->indices()->getAliases(array_merge(['index' => $this->getIndexName()], $params));
    }
228780
public function mapParams(array $map, $params = null)
    {
        if (!isset($params)) {
            $params = $this->params;
        }

        $mapped = array();

        foreach ($params as $key => $value) {
            if (isset($map[$key]) && is_string($map[$key])) {
                gplcart_array_set($mapped, $map[$key], $value);
            }
        }

        return $mapped;
    }
845192
final public static function sinfo(array $params):string
    {
        return (\iumioFramework\Core\Base\Server\GlobalServer::getServerInfo($params['name']));
    }
294689
protected static function reflectionParameterToArray(array $params): array
    {
        $return = [];
        foreach ($params as $param) {
            $array = [
                'name' => $param->name,
                'type' => self::getParameterType($param),
            ];

            if ($param->isOptional()) {
                $array['default'] = $param->getDefaultValue();
            } elseif ($array['type'] && $param->allowsNull()) {
                $array['default'] = null;
            }

            $reflection = $param->getDeclaringFunction();
            $array['file'] = $reflection->getFileName();
            $array['line'] = $reflection->getStartLine();

            $return[] = $array;
        }

        return $return;
    }
1320600
protected function getURL(array $params):string{
		$url = '';

		if($this->scheme){
			$url .= $this->scheme.':';
		}

		if($this->host){
			$url .= '//'.$this->host;

			if($this->port){
				$url .= ':'.$this->port;
			}

		}

		if($this->path){
			$url .= $this->path;
		}

		if(!empty($params)){
			$url .= '?'.http_build_query($params);
		}

		if($this->fragment){
			$url .= '#'.$this->fragment;
		}

		return $url;
	}
458855
public static function getUriFromGlobals(array $serverParams): UriInterface
    {
        $uri = new Uri('');

        $uri = $uri->withScheme(isset($serverParams['HTTPS']) && $serverParams['HTTPS'] !== 'off' ? 'https' : 'http');

        $hasPort = false;
        if (isset($serverParams['HTTP_HOST'])) {
            $hostHeaderParts = explode(':', $serverParams['HTTP_HOST'], 2);
            $uri = $uri->withHost($hostHeaderParts[0]);
            if (count($hostHeaderParts) > 1) {
                $hasPort = true;
                $uri = $uri->withPort((int) $hostHeaderParts[1]);
            }
        } elseif (isset($serverParams['SERVER_NAME'])) {
            $uri = $uri->withHost($serverParams['SERVER_NAME']);
        } elseif (isset($serverParams['SERVER_ADDR'])) {
            $uri = $uri->withHost($serverParams['SERVER_ADDR']);
        }

        if (!$hasPort && isset($serverParams['SERVER_PORT'])) {
            $uri = $uri->withPort($serverParams['SERVER_PORT']);
        }

        $hasQuery = false;
        if (isset($serverParams['REQUEST_URI'])) {
            $requestUriParts = explode('?', $serverParams['REQUEST_URI'], 2);
            $uri = $uri->withPath($requestUriParts[0]);
            if (count($requestUriParts) > 1) {
                $hasQuery = true;
                $uri = $uri->withQuery($requestUriParts[1]);
            }
        }

        if (!$hasQuery && isset($serverParams['QUERY_STRING'])) {
            $uri = $uri->withQuery($serverParams['QUERY_STRING']);
        }

        return $uri;
    }
458597
public function loadParams(array $params)
    {
        $this->arguments = array();
        $this->options = array();

        foreach ($params as $param) {
            if (strpos($param, '-') !== false) {
                $this->options[] = $this->extractOption($param);
            } else {
                $this->arguments[] = $param;
            }
        }

        return $this;
    }