@param array       $parameters
@param string|null $keyString
@param boolean     $nested

@return array
18960
public function formatParameters(array $parameters, $keyString = null, $nested = false)
    {
        foreach ($parameters as $key => $value) {
            if (null !== $keyString && true === $nested) {
                $keyString = sprintf('%s[%s]', $keyString, $key);
            } else {
                $keyString = $key;
            }

            if (is_array($value)) {
                $this->formatParameters($value, $keyString, true);

                continue;
            } else {
                $this->formatedParameters[$keyString] = $value;
            }
        }

        return $this->formatedParameters;
    }
735540
public function prepare(string $method, array $parameters)
    {
        // Delete any empty key
        $parameters = $this->deleteEmptyKeys($parameters);

        // Add the API Key
        $parameters['apiKey'] = $this->flow->getCredentials()->apiKey;

        // Sort the parameters
        ksort($parameters);

        // Return the final data
        switch ($method) {
            case 'get':
                return $this->prepareGet($parameters);
            case 'post':
                return $this->preparePost($parameters);
            default:
                return null;
        }
    }
1270721
protected function renderParameters(array $parameters, $recursion=false)
    {

        $isOperatorFormat = $this->toStringFormat == 'operator';

        $separator = $isOperatorFormat ? ', ' : ',';

        $rendered = [];

        foreach ($parameters as $parameter) {

            if ($parameter === null) {
                $rendered[] = 'null';
                continue;
            }

            if (is_resource($parameter)) {
                $rendered[] = $this->toStringFormat == 'operator' ? 'resource of type ' . get_resource_type($parameter) : get_resource_type($parameter);
                continue;
            }

            if (is_object($parameter)) {
                $rendered[] = get_class($parameter);
                continue;
            }

            if (!is_array($parameter)) {
                $rendered[] = "$parameter";
                continue;
            }

            if (count($parameter) > 80  || $recursion  || !$this->containsOnlyScalars($parameter)) {
                $rendered[] = '[' . $this->renderParameters($parameter) . ']';
                continue;
            }

            if ($isOperatorFormat) {
                $rendered[] = '(' . $this->renderParameters($parameter, true) . ')';
                continue;
            }

            $rendered[] = $this->renderParameters($parameter, true);

        }

        return implode($separator, $rendered);
    }
1141832
function _setParams( $params, $defaults=FALSE ) {
    if( !is_array( $params))
      $params = array();
    $input = array();
    foreach( $params as $paramKey => $paramValue ) {
      if( is_array( $paramValue )) {
        foreach( $paramValue as $pkey => $pValue ) {
          if(( '"' == substr( $pValue, 0, 1 )) && ( '"' == substr( $pValue, -1 )))
            $paramValue[$pkey] = substr( $pValue, 1, ( strlen( $pValue ) - 2 ));
        }
      }
      elseif(( '"' == substr( $paramValue, 0, 1 )) && ( '"' == substr( $paramValue, -1 )))
        $paramValue = substr( $paramValue, 1, ( strlen( $paramValue ) - 2 ));
      if( 'VALUE' == strtoupper( $paramKey ))
        $input['VALUE']                 = strtoupper( $paramValue );
      else
        $input[strtoupper( $paramKey )] = $paramValue;
    }
    if( is_array( $defaults )) {
      foreach( $defaults as $paramKey => $paramValue ) {
        if( !isset( $input[$paramKey] ))
          $input[$paramKey] = $paramValue;
      }
    }
    return (0 < count( $input )) ? $input : null;
  }
1346567
private function getAllChildKeys($data, $maps, $parent_keys, $parent_types, & $result, & $keys, $current_key = [], $current_type = null) {
		if ($current_type == '11') {
			$data = ['__11__' => $data];
		}
		foreach ($data as $k => $v) {
			$new_key = $current_key;
			if ($current_type != '11') {
				$new_key[] = $k;
			}
			if (count($parent_keys) == 1) {
				$new_key[] = $parent_keys[0];
				// put values into result
				$result[] = $new_key;
				// generate keys
				$temp = [];
				foreach ($maps[0] as $k3 => $v3) {
					$temp[] = $v[$k3];
				}
				// we need to preserve a data type if its just one column key
				if (count($temp) == 1) {
					$keys[] = $temp[0];
				} else {
					$keys[] = implode('::', $temp);
				}
			} else {
				// remove extra level
				$parent_keys_temp = $parent_keys;
				$v2 = array_shift($parent_keys_temp);
				$parent_types_temp = $parent_types;
				array_shift($parent_types_temp);
				$maps_temp = $maps;
				array_shift($maps_temp);
				// generate key
				$new_key[] = $v2;
				$this->getAllChildKeys($v[$v2], $maps_temp, $parent_keys_temp, $parent_types_temp, $result, $keys, $new_key, $parent_types[0]);
			}
		}
	}
285788
protected function buildDSNString(array &$parameters)
    {
        if (\array_key_exists(self::UNIX_SOCKET, $parameters)) {
            return self::UNIX_SOCKET."=".$parameters[self::UNIX_SOCKET];
        }
        return parent::buildDSNString($parameters);
    }
569961
static public function show($raw_sql, $parameters)
    {
        $keys = array();
        $values = array();

        /*
         * Get longest keys first, sot the regex replacement doesn't
         * cut markers (ex : replace ":username" with "'joe'name"
         * if we have a param name :user )
         */
        $isNamedMarkers = false;
        if (count($parameters) && is_string(key($parameters))) {
            uksort($parameters, function($k1, $k2) {
                return strlen($k2) - strlen($k1);
            });
            $isNamedMarkers = true;
        }
        foreach ($parameters as $key => $value) {

            // check if named parameters (':param') or anonymous parameters ('?') are used
            if (is_string($key)) {
                $keys[] = '/:'.ltrim($key, ':').'/';
            } else {
                $keys[] = '/[?]/';
            }

            // bring parameter into human-readable format
            if (is_string($value)) {
                $values[] = "'" . addslashes($value) . "'";
            } elseif(is_int($value)) {
                $values[] = strval($value);
            } elseif (is_float($value)) {
                $values[] = strval($value);
            } elseif (is_array($value)) {
                $values[] = implode(',', $value);
            } elseif (is_null($value)) {
                $values[] = 'NULL';
            }
        }
        if ($isNamedMarkers) {
            return preg_replace($keys, $values, $raw_sql);
        } else {
            return preg_replace($keys, $values, $raw_sql, 1, $count);
        }
    }
946672
static function availableClassListJsArray( $parameters = false )
    {
        $iniMenu = eZINI::instance( 'contentstructuremenu.ini' );
        $falseValue = "''";

        if ( $iniMenu->hasVariable( 'TreeMenu', 'CreateHereMenu' ) )
        {
            $createHereMenu = $iniMenu->variable( 'TreeMenu', 'CreateHereMenu' );
        }
        else
        {
            $createHereMenu = 'simplified';
        }

        if ( $createHereMenu != 'simplified' and $createHereMenu != 'full' )
            return $falseValue;

        $ini = eZINI::instance( 'content.ini' );
        list( $usersClassGroupID, $setupClassGroupID ) = $ini->variableMulti( 'ClassGroupIDs', array( 'Users', 'Setup' ) );
        $userRootNode = $ini->variable( 'NodeSettings', 'UserRootNode' );
        $groupIDs = false;
        $filterType = 'include';

        if ( !is_array( $parameters ) )
            return $falseValue;

        $node = isset( $parameters['node'] ) ? $parameters['node'] : false;
        if ( is_object( $node ) )
        {
            if ( $createHereMenu == 'full' and !$node->canCreate() )
                return $falseValue;

            $obj = $node->object();
            $contentClass = $obj->attribute( 'content_class' );
            if ( !$contentClass->attribute( 'is_container' ) )
            {
                return $falseValue;
            }

            $pathArray = $node->pathArray();
        }
        else
        {
            // If current object is not container we should not return class list, should not display "create here" menu.
            if ( isset( $parameters['is_container'] ) and !$parameters['is_container'] )
                return $falseValue;

            // Check if current user can create under this node
            if ( $createHereMenu == 'full' and isset( $parameters['node_id'] ) )
            {
                $node = eZContentObjectTreeNode::fetch( $parameters['node_id'] );
                if ( is_object( $node ) and !$node->canCreate() )
                    return $falseValue;
            }
            $pathString = isset( $parameters['path_string'] ) ? $parameters['path_string'] : false;
            if ( !$pathString )
                return $falseValue;

            $pathItems = explode( '/', $pathString );
            $pathArray = array();
            foreach ( $pathItems as $pathItem )
            {
                if ( $pathItem != '' )
                    $pathArray[] = (int) $pathItem;
            }
        }

        if ( in_array( $userRootNode, $pathArray ) )
        {
            $groupIDs = array( $usersClassGroupID );
        }
        else
        {
            $groupIDs = array( $usersClassGroupID, $setupClassGroupID );
            $filterType = 'exclude';
        }

        if ( $createHereMenu == 'simplified' )
        {
            $classes = eZContentClass::fetchAllClasses( false, $filterType == 'include', $groupIDs );
            return eZContentObjectTreeNode::getClassesJsArray( false, $filterType == 'include', $groupIDs, false, $classes );
        }

        return eZContentObjectTreeNode::getClassesJsArray( $node, $filterType == 'include', $groupIDs );
    }
116894
public static function query(array $parameters = null, bool $mergeGetVariables = true)
    {
        if ($mergeGetVariables) {
            if ($parameters === null) {
                $parameters = $_GET;
            } else {
                $parameters = array_replace_recursive($_GET, $parameters);
            }
        }

        if (empty($parameters)) {
            return null;
        }

        $query = http_build_query($parameters, '', '&');

        return ($query === '') ? '' : ('?' . $query);
    }
1353400
protected function summary(array $parameters = [])
    {
        ksort($parameters);
        $summary = '';
        foreach ($parameters as $value) {
            $summary .= $value;
        }
        $summary .= $this->config('private_key');

        return md5($summary);
    }
76262
protected function createStringCallback($callback, array $parameters)
    {
        if (function_exists($callback)) {
            return $this->createCallableCallback($callback, $parameters);
        } else {
            return $this->createClassesCallback($callback, $parameters);
        }
    }
988201
public static function queryString($params, $parent = null, $callback = 'rawurlencode', $ignoreNonValues = true)
    {
        $params = self::flattenRequestVars($params, $parent);
        $ret = [];
        foreach ($params as $pair) {
            list($name, $value) = $pair;
            if (!$value && $ignoreNonValues) {
                continue;
            }
            if ($callback) {
                $value = call_user_func($callback, $value);
            }
            $ret[] = sprintf('%s=%s', $name, $value);
        }
        return implode('&', $ret);
    }
55531
private function prepareParameters(array $parameters, $escape = true)
    {
        $filtered = array();
        foreach ($parameters as $key => $value) {
            if (is_array($value)) {
                $value = $this->prepareParameters($value, $escape);
            } elseif ($value instanceof Reference || is_string($value) && 0 === strpos($value, '@')) {
                $value = '@'.$value;
            }

            $filtered[$key] = $value;
        }

        return $escape ? $this->escape($filtered) : $filtered;
    }
1110852
public function getSdkCommand($parameters = [])
    {
        if ($this instanceof Query) {
            return parent::getSdkCommand($parameters);
        }

        if (isset($parameters['TotalSegments'])) {
            $segments = $parameters['TotalSegments'];
        } elseif (isset($this->parameters['TotalSegments'])) {
            $segments = $this->parameters['TotalSegments'];
        }

        if (isset($segments)) {
            $commands = [];
            for ($i = 0; $i < $segments; $i++) {
                $commandParams            = $parameters;
                $commandParams['Segment'] = $i;
                $commands[]               = parent::getSdkCommand($commandParams);
            }

            return $commands;
        }

        return parent::getSdkCommand($parameters);
    }
445162
private function getParameterValues ($function, array $parameters = []) {
        $functionParams = [];
        $parameterIndex = 0;
        foreach ($function->getParameters() as $parameter) {
            $parameterName = $parameter->getName();
            $parameterValue = null;

            if (array_key_exists($parameterName, $parameters)) {
                $parameterValue = $parameters[$parameterName];
            }
            else if ($parameter->hasType()) {
                $type = $parameter->getType();
                if (!$type->isBuiltin()) {
                    $typeName = (string)$type;
                    if (array_key_exists($typeName, $parameters)) {
                        $parameterValue = $parameters[$typeName];
                    }
                    else if (!$parameter->isDefaultValueAvailable()) {
                        $typeClass = new ReflectionClass($typeName);
                        foreach ($typeClass->getMethods(ReflectionMethod::IS_STATIC) as $staticMethod) {
                            if ($staticMethod->getReturnType() != null && ((string)$staticMethod->getReturnType() == $typeName) && $staticMethod->getNumberOfParameters() == 0) {
                                $parameterValue = $staticMethod->invoke(null);
                                break;
                            }
                        }
                    }
                }
            }

            if ($parameterValue == null) {
                if (array_key_exists($parameterIndex, $parameters)) {
                    $parameterValue = $parameters[$parameterIndex];
                    $parameterIndex++;
                }
                else if ($parameter->isDefaultValueAvailable()) {
                    $parameterValue = $parameter->getDefaultValue();
                }
            }
            $functionParams[] = $parameterValue;
        }
        return $functionParams;
    }
690258
protected function buildDSNString(array &$parameters)
    {
        $dsn = [];
        foreach ($this->keys as $keyName) {
            if (\array_key_exists($keyName, $parameters) && \strlen($parameters[$keyName]) > 0) {
                $dsn[] = "{$keyName}={$parameters[$keyName]}";
            }
        }

        return \implode(";", $dsn);
    }
327367
protected function _params_filter($parameters = array()){
    $params = array();
    foreach($parameters as $key => $val) {
        if ($key == "Signature" ||$val === "" || $val === NULL){
          continue;
        } else {
          $params[$key] = $parameters[$key];
        }
    }
    ksort($params);
    reset($params);
    return $params;
  }