Serializes parameters.

@param array $params

@return array
160066
protected function serializeParams(array $params)
    {
        $serialized = array();
        foreach ($params as $param) {
            $serialized[] = $this->serializer->serialize($param);
        }

        return $serialized;
    }
450611
private function decorateArrayValue(array $params) : string
    {
        $params_out = [];
        foreach($params as $key => $param) {
            if (is_string($key)){
                $params_out[] = "'$key' =>" . $this->decorateValue($param);
            }
            else{
                $params_out[] = $this->decorateValue($param);
            }
        }
        return '[' . implode(',',$params_out) . ']';
    }
955385
protected static function formatParams($params)
    {
        $reslt = '';
        //
        for ($i = 0; $i < count($params); $i++) {
            $reslt .= '$'.$params[$i];
            if ($i < count($params) - 1) {
                $reslt .= ',';
            }
        }

        return $reslt;
    }
748927
protected function getHeaders($params)
    {
        $headers = array();
        
        foreach ($params as $name => $value) {
            if (substr($name, 0, 5) === 'HTTP_') {
                $key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))));
                $headers[$key] = $value;
            }
        }
        
        return $headers;
    }
331326
public function prepareParam(array $param = null)
    {
        if (!$param) {
            return [];
        }
        $ret = [];

        foreach ($param as $key => $value) {
            if (is_array($value)) {
                $keyString = md5($key);
                foreach ($value as $subKey => $subValue) {
                    $ret[] =[':' . $keyString.$subKey , $subValue];
                }
            } else {
                $ret[] = [':' . md5($key), $value];
            }

        }

        return $ret;
    }
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)) . ']';
    }
1276598
private function formatSqlByParams(array $params)
    {
        if (empty($params)) {
            return;
        }
        foreach ($params as $key => $value) {
            $this->sql .= " $key=" . $value;
        }
    }
1294939
public function transformParams(array $params): array
    {
        $newParams = [];
        foreach ($params as $key => $value) {
            $newParams['%' . $key . '%'] = $value;
        }

        return $newParams;
    }
536227
private function parametersToData(array $parameters)
    {
        $data = array();

        foreach ($parameters as $parameter) {
            $data[$parameter->getName()] = $this->parameterToData($parameter);
        }

        return (object) $data;
    }
397424
protected function setState(array $params):array{

		if(!isset($params['state'])){
			$params['state'] = sha1(random_bytes(256));
		}

		$this->storage->storeCSRFState($this->serviceName, $params['state']);

		return $params;
	}
1249147
protected function _parseApiParams($params)
  {
    $apiparams = [];
    if (count($params) === 0) {
      return $apiparams;
    }

    if (is_array($params[0])) {
      // given parameters are array
      $apiparams = $params[0];
      return $apiparams;
    }

    // user gave us query-style params
    parse_str($params[0], $apiparams);
    if (! is_array($apiparams)) {
      $apiparams = [];
    }

    return $apiparams;
  }
736852
public function encodeParameters($types, $params)
    {
        // change json to array
        if ($types instanceof stdClass && isset($types->inputs)) {
            $types = Utils::jsonToArray($types, 2);
        }
        if (is_array($types) && isset($types['inputs'])) {
            $inputTypes = $types;
            $types = [];

            foreach ($inputTypes['inputs'] as $input) {
                if (isset($input['type'])) {
                    $types[] = $input['type'];
                }
            }
        }
        if (count($types) !== count($params)) {
            throw new InvalidArgumentException('encodeParameters number of types must equal to number of params.');
        }
        $typesLength = count($types);
        $solidityTypes = $this->getSolidityTypes($types);
        $encodes = array_fill(0, $typesLength, '');

        foreach ($solidityTypes as $key => $type) {
            $encodes[$key] = call_user_func([$type, 'encode'], $params[$key], $types[$key]);
        }
        $dynamicOffset = 0;

        foreach ($solidityTypes as $key => $type) {
            $staticPartLength = $type->staticPartLength($types[$key]);
            $roundedStaticPartLength = floor(($staticPartLength + 31) / 32) * 32;

            if ($type->isDynamicType($types[$key]) || $type->isDynamicArray($types[$key])) {
                $dynamicOffset += 32;
            } else {
                $dynamicOffset += $roundedStaticPartLength;
            }
        }
        return '0x' . $this->encodeMultiWithOffset($types, $solidityTypes, $encodes, $dynamicOffset);
    }
670932
public function getCompiledParams(array $params)
    {
        foreach ($params as $k => $p) {
            if (is_array($p)) {
                $params[$k] = $p[0];
            }
        }

        return $params;
    }
1094861
protected function toHeader(array $params)
    {
        $out    = '';
        $last   = end($params);

        foreach ($params as $k => $v) {
            $out .= $k.'="'.$v.'"';

            if ($v != $last) {
                $out .= ',';
            }
        }

        return $out;
    }
353409
protected function prepareParams($params)
    {
        if (isset($params['settings']['charset'])) {
            if (false === strpos($params['dsn'], ';charset=')) {
                $params['dsn'] .= ';charset=' . $params['settings']['charset'];
                unset($params['settings']['charset']);
            }
        }

        return parent::prepareParams($params);
    }
627558
public function setParams(array $params)
    {
        foreach ($this->params as $param) {
            if (!array_key_exists($param, $params)) {
                $methodName = 'unset'.ucfirst($param);

                if (method_exists($this, $methodName)) {
                    call_user_func(
                        [$this, $methodName]
                    );
                    continue;
                }
            }

            if (property_exists($this, $param)) {
                $methodName = 'set'.ucfirst($param);

                if (method_exists($this, $methodName)) {
                    call_user_func(
                        [$this, $methodName],
                        $params[$param]
                    );
                }
            }
        }

        return $this;
    }
159021
private function preParseParams(array $params)
    {
        if (!array_key_exists('fields', $params) || !is_array($params['fields'])) {
            return $params;
        }

        $fields = [];
        foreach ($params['fields'] as $index => $field) {
            if (!is_numeric($index)) {
                $fields[$index] = $field;
                continue;
            }

            $modifier = 1;
            /** @noinspection SubStrUsedAsArrayAccessInspection */
            $firstChar = substr($field, 0, 1);
            if ($firstChar === '+' || $firstChar === '-') {
                $modifier = $firstChar === '+' ? 1 : 0;
                $field = substr($field, 1);
            }
            $fields[$field] = $modifier;
        }
        $params['fields'] = $fields;

        return $params;
    }