/*
Render UA call parameters

@param mixed parameters

@return string
549085
private function renderParams($parameters)
    {
        if(is_array($parameters))
        {
            // We have an array, we'll need to make sure we get all of the items setup correctly
            $paramArray = array();
            foreach($parameters as $param)
            {
                // make it JS ready for all params
                $paramArray[] = json_encode($param, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
            }
            $parameters = implode(", ", $paramArray);
        }
        
        // Return what we were given.. just in a better format!
        return $parameters;
    }
1090432
public function getAutocompleteResults($parameters = [])
    {
        $path = $this->appendParametersToUrl('/v3/autocomplete', $parameters);
        $request = $this->getRequest('GET', $path, $this->getDefaultHeaders());

        return $this->processRequest($request);
    }
309548
private function formatParameter(ReflectionParameter $parameter): string
    {
        return $parameter->hasType() ?
            sprintf('%s $%s', $parameter->getType(), $parameter->getName()) :
            sprintf('$%s', $parameter->getName());
    }
868373
public function render(array $parameters = []): string
    {
        return $this->twig->render('@ezdesign/component/script.html.twig', [
            'src' => $this->src,
            'type' => $this->type,
            'async' => $this->async,
            'defer' => $this->defer,
            'crossorigin' => $this->crossorigin,
            'integrity' => $this->integrity,
        ] + $parameters);
    }
1270671
protected function normalizeParameters($parameters)
    {
        $normalized = [];

        foreach ($parameters as $key => $value) {
            // Percent symbols (%) must be double-encoded.
            $key   = $this->encode($key);
            $value = $this->encode($value);

            $normalized[$key] = $value;
        }

        return $normalized;
    }
1323176
public function toUrlParams(array $parameters)
    {
        $buff = "";
        foreach ($parameters as $k => $v) {
            if ($k != "sign" && $v != "" && !is_array($v)) {
                $buff .= $k . "=" . $v . "&";
            }
        }

        $buff = trim($buff, "&");
        return $buff;
    }
1362884
public function render($name, array $parameters = [])
    {
        $storage = $this->load($name);
        $key = hash('sha256', serialize($storage));
        $this->current = $key;
        $this->parents[$key] = null;

        // attach the global variables
        $parameters = array_replace($this->getGlobals(), $parameters);
        // render
        if (false === $content = $this->evaluate($storage, $parameters)) {
            throw new \RuntimeException(sprintf('The template "%s" cannot be rendered.', $this->parser->parse($name)));
        }

        // decorator
        if ($this->parents[$key]) {
            $slots = $this->get('slots');
            $this->stack[] = $slots->get('_content');
            $slots->set('_content', $content);

            $content = $this->render($this->parents[$key], $parameters);

            $slots->set('_content', array_pop($this->stack));
        }

        return $content;
    }
979815
private function _renderArgs($args = [])
    {
        return '('.
            implode(',', array_map(function ($arg) {
                if ($arg instanceof jsExpressionable) {
                    return $arg->jsRender();
                }

                return $this->_json_encode($arg);
            }, $args)).
            ')';
    }
496644
private function _getParametersAsString(array $parameters)
    {
        $queryParameters = array();
        foreach ($parameters as $key => $value) {
            $queryParameters[] = $key . '=' . $this->_urlencode($value);
        }
        return implode('&', $queryParameters);
    }
1073094
protected function compileParameters(array $parameters)
    {
        return collect($parameters)->map(function ($value, $key) {
            if (is_array($value)) {
                $value = collect($value)->map(function ($value) {
                    return ProcessUtils::escapeArgument($value);
                })->implode(' ');
            } elseif (! is_numeric($value) && ! preg_match('/^(-.$|--.*)/i', $value)) {
                $value = ProcessUtils::escapeArgument($value);
            }

            return is_numeric($key) ? $value : "{$key}={$value}";
        })->implode(' ');
    }
1181366
private function _generateSignature($parameters = array())
    {
        $this->_headers = [];
        $canonical_uri = '/';

        $parameters['Action'] = $this->_action;
        ksort($parameters);

        $request_parameters = http_build_query($parameters, '', '&', PHP_QUERY_RFC3986);

        $canonical_headers = 'host:' . $this->_host . "\n" . 'x-amz-date:' . $this->_amz_date . "\n";
        $signed_headers = 'host;x-amz-date';
        $payload_hash = hash('sha256', '');

        // task1
        $canonical_request = $this->_method . "\n" . $canonical_uri . "\n" . $request_parameters . "\n" . $canonical_headers . "\n" . $signed_headers . "\n" . $payload_hash;

        // task2
        $credential_scope = $this->_date . '/' . $this->_region . '/' . self::SERVICE . '/aws4_request';
        $string_to_sign =  self::ALGORITHM . "\n" . $this->_amz_date . "\n" . $credential_scope . "\n" . hash('sha256', $canonical_request);

        // task3
        $signing_key = $this->_generateSignatureKey();
        $signature = hash_hmac('sha256', $string_to_sign, $signing_key);
        $this->_headers['Authorization'] = self::ALGORITHM . ' Credential=' . $this->_aws_key . '/' . $credential_scope . ', SignedHeaders=' . $signed_headers . ', Signature=' . $signature;
        $this->_headers['x-amz-date'] = $this->_amz_date;
        $this->_query_parameters = $request_parameters;
    }
1003868
protected function parseParameters($parameters)
    {
        if (isset($parameters[0])) {
            $params = json_decode($parameters[0], true);
            if ($params) {
                return $params;
            }
        }

        // If json couldn't be encoded return string as it was
        return $parameters;
    }
632559
public function buildJsParams($parameters)
    {
        if (! $parameters) {
            return '';
        }

        $extractedParams = $this->extractJsFunctions($parameters);

        $json_parameters = json_encode($extractedParams['parameters'], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);

        $json_parameters = str_replace($extractedParams['replacements'], $extractedParams['values'], $json_parameters);

        return trim($json_parameters, '{}');
    }
442035
public static function make(string $parameter): string
	{
		$parameter = str_replace('.', '_', $parameter);
		$parameter = str_replace(',', '_', $parameter);
		$parameter = str_replace(' ', '_', $parameter);
		$parameter = str_replace('-', '_', $parameter);
		$parameter = str_replace('(', '', $parameter);
		$parameter = str_replace(')', '', $parameter);
		$parameter = str_replace('*', '', $parameter);
		$parameter = str_replace('>', '_', $parameter);
		$parameter = str_replace('<', '_', $parameter);
		$parameter = str_replace('\'', '', $parameter);
		$parameter = str_replace('"', '', $parameter);
		$parameter = str_replace('__', '_', $parameter);
		$parameter = str_replace(':', '_', $parameter);

		return strtolower($parameter) . static::getNextIndex();
	}
963281
protected function renderParameterTypeHint($parameter)
    {
        $typeHint = $parameter->hasType() ? (string) $parameter->getType() : '';

        $typeHint = trim($typeHint);

        if ($typeHint) {
            // If the type is not a built in types, we should add a leading slash
            // in the type hint be make the class name not confusing.
            if (
                ! in_array($typeHint, [
                    'self', 'array', 'callable', 'bool', 'float', 'int', 'string',
                    'object', 'iterable', 'void'
                ])
            ) {
                $typeHint = '\\'.$typeHint;
            }

            if ($parameter->allowsNull()) {
                $typeHint = '?'.$typeHint;
            }

            $typeHint .= ' ';
        }

        return $typeHint;
    }
880825
public function render($matchedURITemplate, array $params = array())
    {
        // For current URI template
        $options = $this->mapManager->getDataByUriTemplate($matchedURITemplate);

        $class = $this->mapManager->getControllerByURITemplate($matchedURITemplate);
        $action = $this->mapManager->getActionByURITemplate($matchedURITemplate);

        return $this->call($class, $action, $params, $options);
    }
1101329
public function asset_render($params) {
        $group = isset($params['group']) ? $params['group'] : null;
        $raw = isset($params['raw']) ? $params['raw'] : false;
        return Asset::render($group, $raw);
    }