Process query parameters

@param  array $parameters
@return array
330785
protected function parseQueryParameters(array $parameters = [])
    {
        foreach ($parameters as $key => $candidate) {
            if (is_a($candidate, 'Tmdb\Model\Common\QueryParameter\QueryParameterInterface')) {
                $interfaces = class_implements($candidate);

                if (array_key_exists('Tmdb\Model\Common\QueryParameter\QueryParameterInterface', $interfaces)) {
                    unset($parameters[$key]);

                    $parameters[$candidate->getKey()] = $candidate->getValue();
                }
            }
        }

        return $parameters;
    }
880769
public function processParameters(array $parameters, ContainerBuilder $container)
    {
        foreach ($parameters as $parameterKey => &$parameterValue) {
            if (\is_array($parameterValue)) {
                $parameterValue = $this->processParameters($parameterValue, $container);
                continue;
            }

            $resolvedValue = $this->environmentPlaceholderResolver
                ->resolveEnvironmentPlaceholders($parameterValue, $container);

            $replacementValue = $this->replacementFetcher->getReplacedValueForParameter($parameterKey, $resolvedValue);

            if (null !== $replacementValue) {
                $parameterValue = $replacementValue;
            }
        }

        return $parameters;
    }
1115438
private function fetchOptions($parameters, &$query): array
    {
        $allowed = array_keys($this->options);

        $result = [];
        foreach ($parameters as $key => $parameter) {
            if (is_numeric($key) && isset($allowed[$key])) {
                // this segment fetched keys from given parameters either by name or by position
                $key = $allowed[$key];
            } elseif (!array_key_exists($key, $this->options) && is_array($parameters)) {
                // all additional parameters given in array form can be glued to query string
                $query[$key] = $parameter;
                continue;
            }

            //String must be normalized here
            if (is_string($parameter) && !preg_match('/^[a-z\-_0-9]+$/i', $parameter)) {
                $result[$key] = $this->slugify->slugify($parameter);
                continue;
            }

            $result[$key] = (string)$parameter;
        }

        return $result;
    }
1003930
public function getContainers(array $parameters = array())
    {
        $result = array();

        foreach ($this->getContainersInfo($parameters) as $info) {
            $result[] = new Container($this, $info['name'], $info['count'], $info['bytes']);
        }

        return $result;
    }
931384
public function transform(array $parameters)
    {
        $transformed = array();

        foreach ($parameters as $name => $value) {
            $transformed[$name] = $this->transformerResolver->resolve($value)->transform($value);
        }

        return $transformed;
    }
1340309
protected function prepareParameters(array $parameters)
	{
		return array_merge($this->_parameters, self::resolveAliases($parameters, $this->aliases));
	}
1078218
public function formatParameters($parameters)
    {
        $parameters = Arr::wrap($parameters);

        foreach ($parameters as $key => $parameter) {
            if ($parameter instanceof UrlRoutable) {
                $parameters[$key] = $parameter->getRouteKey();
            }
        }

        return $parameters;
    }
406921
protected function _toQuerystring($parameters) {
		$out = '';
		$keys = array_keys($parameters);
		$count = count($parameters);
		for ($i = 0; $i < $count; $i++) {
			$out .= $keys[$i] . '=' . $parameters[$keys[$i]];
			if ($i < $count - 1) {
				$out .= '&';
			}
		}
		return $out;
	}
143782
protected function processQueryParameters($queryParams)
    {
        foreach ($queryParams as $name => $value) {
            if (is_bool($value)) {
                $queryParams[$name] = $value ? 'true' : 'false';
            }
        }
        return $queryParams;
    }
816153
public function queryProcessing($queryParams) 
    {
        $driver = strtolower($this->connection->getAttribute(PDO::ATTR_DRIVER_NAME));
        //drivers = Array ( [0] => mysql [1] => oci [2] => pgsql [3] => sqlite [4] => sqlsrv )
        switch ($driver) {
        case 'mysql':
            list($this->query, $this->totalQuery, $this->filterQuery)
                = MySQLDataSource::processQuery($this->query, $queryParams);
            break;
        case 'oci':
            list($this->query, $this->totalQuery, $this->filterQuery)
                = OracleDataSource::processQuery($this->query, $queryParams);
            break;
        case 'pgsql':
            list($this->query, $this->totalQuery, $this->filterQuery)
                = PostgreSQLDataSource::processQuery($this->query, $queryParams);
            break;
        case 'sqlsrv':
            list($this->query, $this->totalQuery, $this->filterQuery)
                = SQLSRVDataSource::processQuery($this->query, $queryParams);
            break;
        default:
            break;
        }
        $this->countTotal = Util::get($queryParams, 'countTotal', false);
        $this->countFilter = Util::get($queryParams, 'countFilter', false);
        return $this;
    }
609993
public function all(array $parameters = [])
    {
        $resolver = $this->createOptionsResolver();
        $resolver->setDefined('search');

        return $this->get('namespaces', $resolver->resolve($parameters));
    }
85845
private function formatParameters(array $parameters, string $type): array
    {
        $this->checkQueryRepositoryCompatibility($type);
        $this->checkQueryResourceId($parameters, $type);

        $returnParameters = [];

        foreach ($parameters['query'] as $parameter => $value) {
            // The parameter is a filter,
            // so it must be checked if it is whitelisted
            if ('filter_by' === $parameter) {
                $returnParameters['filter'] = $this->queryAddFilterByParameter($value);

                continue;
            }

            // The parameter is a sorting field,
            // so it must be checked if it is whitelisted
            if ('sort_by' === $parameter) {
                $returnParameters['sort'] = $this->queryAddSortByParameter($value);

                continue;
            }

            // The parameter is a list of fields,
            // so it must be checked whether they are supported by the Repository
            if ('field_list' === $parameter) {
                $returnParameters['field_list'] = $this->queryAddFieldList($type, $value);

                continue;
            }

            // The parameter is of any other kind,
            // so it must be checked that it is supported by the Repository
            if (!\in_array($parameter, $this->queryParameters, true)) {
                throw new \InvalidArgumentException(\sprintf(
                    'Parameter %s is not a valid query parameters for repository %s',
                    $parameter,
                    $this->name
                ));
            }
            if (!\is_string($value) && !\is_numeric($value)) {
                throw new \InvalidArgumentException(\sprintf(
                    'Value for parameter %s is not a valid type, must be either a string or a number, %s given',
                    $parameter,
                    \gettype($value)
                ));
            }
            $returnParameters[$parameter] = $value;
        }

        return [
            'parameters' => $returnParameters,
            'resource_id' => $parameters['resource_id'],
        ];
    }
1289588
private function parseParameters(array $parameters)
    {
        if (empty($parameters)) {
            return '';
        }

        $parameters = implode('&', array_map(
            function ($value, $key) {
                return sprintf('%s=%s', $key, urlencode($value));
            },
            $parameters,
            array_keys($parameters)
        ));

        return "&{$parameters}";
    }
861460
private function buildQuery(array $parameters)
        {
            // no parameters?
            if(empty($parameters)) {
                return '';
            }

            // encode the keys
            $keys = self::urlencode_rfc3986(array_keys($parameters));

            // encode the values
            $values = self::urlencode_rfc3986(array_values($parameters));

            // reset the parameters
            $parameters = array_combine($keys, $values);

            // sort parameters by key
            uksort($parameters, 'strcmp');

            // loop parameters
            foreach ($parameters as $key => $value) {
                // sort by value
                if(Arrays::is($value)) $parameters[$key] = natsort($value);
            }

            // process parameters
            foreach ($parameters as $key => $value) {
                $chunks[] = $key . '=' . str_replace('%25', '%', $value);
            }

            // return
            return implode('&', $chunks);
        }
648941
protected function passGetScope(array $parameters): ?array
    {
        $scope = $this->passReadStringValue($parameters, 'scope');

        return empty($scope) === false ? explode(' ', $scope) : null;
    }
950215
public function getParameters(array $parameters = [])
    {
        foreach (['view', 'this'] as $forbiddenKey) {
            if (array_key_exists($forbiddenKey, $parameters)) {
                throw new \ErrorException('The "' . $forbiddenKey . '" key is forbidden.');
            }
        }
        $sharedVariables = $this->getOptionDefault('shared_variables');
        if ($sharedVariables) {
            $parameters = array_merge($sharedVariables, $parameters);
        }
        $parameters['view'] = $this;

        return $parameters;
    }
523718
protected function getRouteQueryString(array $parameters)
	{
		// First we will get all of the string parameters that are remaining after we
		// have replaced the route wildcards. We'll then build a query string from
		// these string parameters then use it as a starting point for the rest.
		if (count($parameters) == 0) return '';

		$query = http_build_query(
			$keyed = $this->getStringParameters($parameters)
		);

		// Lastly, if there are still parameters remaining, we will fetch the numeric
		// parameters that are in the array and add them to the query string or we
		// will build the intial query string if it wasn't started with strings.
		if (count($keyed) < count($parameters))
		{
			$query .= '&'.implode(
				'&', $this->getNumericParameters($parameters)
			);
		}

		return '?'.trim($query, '&');
	}