@param array $postParameters

@return string
512798
public function postParametersToCurl(array $postParameters)
    {
        $this->formatedParameters = [];
        $curlPostParameters       = '--data "';

        foreach ($this->formatParameters($postParameters) as $key => $value) {
            $curlPostParameters .= sprintf('%s=%s&', $key, $value);
        }

        return substr($curlPostParameters, 0, -1).'"';
    }
930248
private function _httpPost(array $parameters)
    {

        $query = $this->_getParametersAsString($parameters);
        $url = parse_url ($this->_config['ServiceURL']);
	    $uri = array_key_exists('path', $url) ? $url['path'] : null;
        if (!isset ($uri)) {
                $uri = "/";
        }
        $scheme = '';

        switch ($url['scheme']) {
            case 'https':
                $scheme = 'https://';
                $port = array_key_exists('port', $url) && isset($url['port']) ? $url['port'] : 443;
                break;
            default:
                $scheme = '';
                $port = array_key_exists('port', $url) && isset($url['port']) ? $url['port'] : 80;
        }

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $scheme . $url['host'] . $uri);
        curl_setopt($ch, CURLOPT_PORT, $port);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
        
        # if a ca bundle is configured, use it as opposed to the default ca 
        # configured for the server
        if (!is_null($this->_merchantValues->getCaBundleFile())) {
        	curl_setopt($ch, CURLOPT_CAINFO, $this->_merchantValues->getCaBundleFile());
        }

        curl_setopt($ch, CURLOPT_USERAGENT, $this->_config['UserAgent']);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
        curl_setopt($ch, CURLOPT_HEADER, true);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        if ($this->_config['ProxyHost'] != null && $this->_config['ProxyPort'] != -1)
        {
            curl_setopt($ch, CURLOPT_PROXY, $this->_config['ProxyHost'] . ':' . $this->_config['ProxyPort']);
        } 

        $response = '';
        if (!$response = curl_exec($ch)) {
           $error_msg = "Unable to post request, underlying exception of " . curl_error($ch);
           curl_close($ch);

           throw new OffAmazonPaymentsService_Exception(array('Message' => $error_msg));    
        }

        curl_close($ch);

        list($other, $responseBody) = explode("\r\n\r\n", $response, 2);
        $other = preg_split("/\r\n|\n|\r/", $other);

        $headers = array();
        foreach ($other as $value) {
            if (strpos($value, ': ') !== FALSE) {
                list ($k, $v) = explode (': ', $value);
                if (array_key_exists($k, $headers)) {
                  $headers[$k] = $headers[$k] . "," . $v;
                } else {
                  $headers[$k] = $v;
                }
            } 
        }
 

        $responseHeaderMetadata = new OffAmazonPaymentsService_Model_ResponseHeaderMetadata(
              $headers['x-mws-request-id'],
              $headers['x-mws-response-context'],
              $headers['x-mws-timestamp']);

        list($protocol, $code, $text) = explode(' ', trim(array_shift($other)), 3);

        return array ('Status' => (int)$code, 'ResponseBody' => $responseBody, 'ResponseHeaderMetadata' => $responseHeaderMetadata);
    }
1267215
protected function prepareParams(array $params)
    {
        $result = $params;

        foreach ($result as $key => $val) {
            if (is_bool($val)) {
                $result[$key] = $val ? 1 : 0;
            }
        }

        return $result;
    }
1191669
public function format(ParameterBag $trackingParameters)
    {
        $uvp = null;

        if (
            $trackingParameters->has('u')
            && $trackingParameters->has('v')
            && $trackingParameters->has('p')
        ) {
            $uvp = sprintf(
                '%s~%s~%s',
                $trackingParameters->get('u'),
                $trackingParameters->get('v'),
                $trackingParameters->get('p')
            );
        }

        return [
            'uvp' => $uvp,
        ];
    }
454223
public function buildParameter(array $params)
	{
		$path = '';

		foreach ($params as $param)
		{
			$path .= $param;

			if (next($params) == true)
			{
				$path .= '|';
			}
		}

		return $path;
	}
459700
private function prepareMultipartParameters(array $params): array
    {
        $postDataMultipart = [];
        foreach ($params as $key => $value) {
            // If $value is not an array we cast it to an array
            foreach ((array) $value as $subValue) {
                $postDataMultipart[] = [
                    'name' => $key,
                    'content' => $subValue,
                ];
            }
        }

        return $postDataMultipart;
    }
1097419
protected function getSignature(array $params)
    {
        ksort($params);

        $srcStr = 'POSTcdn.api.qcloud.com/v2/index.php?'.urldecode(http_build_query($params));

        return base64_encode(hash_hmac('sha1', $srcStr, $this->getCredentials()['secretKey'], true));
    }
979261
private function findPostParams(\stdClass $postParams, ModelInterface $entity) {
        //Entity is passed in so children can access it
        $dataTransformer = $this->getDataTransformer($postParams);
        if(!is_null($dataTransformer)) {
            $dataTransformer->transform($entity);
            $postParams = $dataTransformer->getParams();
        }
        return $postParams;
    }
395202
protected function cleanParams(array $params)
    {
        $values = [];
        foreach ($params as $name => $details) {
            $this->cleanValueFrom($name, $details['value'], $values);
        }

        return $values;
    }
331670
public function getThumbnailPath(Post $post)
    {
        if (!$thumbnailPostMeta = $this->postMetaManager->getThumbnailPostId($post)) {
            return '';
        }

        /** @var $post Post */
        if (!$post = $this->find($thumbnailPostMeta->getValue())) {
            return '';
        }

        return $post->getGuid();
    }
65846
private function encodeParameters($parameters, $keyPrefix = null)
    {
        if(!is_array($parameters) && !is_object($parameters))
            return $this->urlEncode($parameters);

        $encodedData = [];

        foreach($parameters as $key => $value)
        {
            $encodedData[] = $this->encodeParam($key, $value, $keyPrefix);
        }

        // Also loop over getters.
        if (is_object($parameters) && empty($encodedData)) {
            foreach ((new \ReflectionClass($parameters))->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflectionMethod) {
                if ($reflectionMethod->getNumberOfRequiredParameters() === 0 && strncmp($reflectionMethod->getName(), 'get', 3) === 0) {
                    $key = lcfirst(substr($reflectionMethod->getName(), 3));
                    $value = $reflectionMethod->invoke($parameters);
                    $encodedData[] = $this->encodeParam($key, $value, $keyPrefix);

                }
            }

        }

        return implode('&', $encodedData);
    }
457361
private function formatParams(array $params) {
        foreach ($params as $key => $value) {
            if (is_array($value)) {
                $params[$key] = implode(',', $value);
            } else if (is_bool($value)) {
                $params[$key] = $value ? 1 : 0;
            }
        }
        return $params;
    }
1273418
protected function getCustomUrl(array $urlParameters = array())
    {
        $urlParameters = $this->addRequestVariablesToUrlParameters($urlParameters);

        if ($this->customUrl && count($urlParameters) > 0)
        {
            $params = http_build_query($urlParameters);

            if ('' != parse_url($this->customUrl, PHP_URL_QUERY))
            {
                // existing query string, append
                return $this->customUrl.'&'.$params;
            }

            return $this->customUrl.'?'.$params;
        }

        return $this->customUrl;
    }
891860
public function getPostTypeFieldsValues(string $postType, $post = null)
    {
        $fields = PostType::getFields($postType);
        $languages = Language::all();
        $values = [];

        foreach ($fields as $field){
            /**
             * prepare values for each field
             * used when this function is called in detailsJson (update form of the post)
             */
            if (isset($post) && $post) {
                $slug = $field->slug;
                if(!$field->translatable) {
                    if(array_key_exists($slug, $post->getAttributes())) {
                        if($field->type->inputType == "checkbox") { // if input type is checkbox the value should be array
                            $value = ($post->$slug) ? explode(",", $post->$slug) : [];
                            $field->value = $value;
                        }else if ($field->type->inputType == "date") { // if input type is date remove the php time form the string
                            $field->value = explode(" ", $post->$slug)[0];
                        }else{
                            $field->value = $post->$slug;
                        }
                    }
                }else{
                    if(gettype($post->$slug) != "array" && json_decode($post->$slug) == null) {
                        $value = [];
                    }else{
                        $value = (array) json_decode($post->$slug);
                    }
                    // if there is a new language this code puts the new language key in the details
                    foreach($languages as $lang){
                        if(!key_exists($lang->slug, $value)) {
                            if($field->type->inputType == "checkbox") {
                                $value[$lang->slug] = [];
                            }else{
                                $value[$lang->slug] = [];
                            }
                        }
                    }
                    $field->value = $value;
                }
            }


            /**
             * get data from database if custom field is "Dropdown from DB"
             */
            if($field->type->inputType == "db") {

                /**
                 * construct categories field (@If categories 0 it means it's value is all @else construct a array with categories slug)
                 * categories when field is dropdown from db (used to take posts of only a category)
                 */
                if(count($field->categories)) {
                    $categoriesTmp = [];
                    foreach ($field->categories as $category){
                        if($category->slug === 0) {
                            $field->categories = 0;
                            break;
                        }
                        $categoriesTmp[] = $category->slug;
                    }
                    $field->categories = $categoriesTmp;
                }else{
                    $field->categories = 0;
                }

                if($field->dbTable) {
                    $table = $field->dbTable->name;
                    $field->data = Language::filterRows(DB::table($table)->get(), false);
                    // if user add fullName as key
                    if($table == "users") {
                        $tmp = [];
                        foreach ($field->data as $userItem){
                            $userItem['fullName'] = $userItem['firstName']. " ". $userItem['lastName'];
                            $tmp[] = $userItem;
                        }
                        $field->data = $tmp;
                    }
                }
            }
            array_push($values, $field);
        }

        return $values;
    }
869190
protected function encodePayload(array $params)
  {
    $encoded = [];
    foreach ($params as $key => $value)
    {
      if (is_array($value))                 $encoded[$key] = $this->encodePayload($value);
      else if ($value instanceof \DateTime) $encoded[$key] = $value->format(\DateTime::ISO8601);
      else                                  $encoded[$key] = $value;
    }

    return $encoded;
  }
1146161
private function calculateStringToSignV2(array $parameters)
    {
        $data = 'POST';
        $data .= "\n";
        $data .= $this->mwsEndpointUrl;
        $data .= "\n";
        $data .= $this->mwsEndpointPath;
        $data .= "\n";
        $data .= $this->getParametersAsString($parameters);

        $this->logMessage($this->sanitizeRequestData($data));

        return $data;
    }
305396
protected function prepareParams(array $params)
	{
		$prepared = [];
		
		foreach($params as $k => $v)
		{
			if(is_array($v))
			{
				foreach(array_values($v) as $i => $val)
				{
					$prepared[sprintf('%s%u', $k, $i)] = $val;
				}
			}
			else
			{
				$prepared[(string)$k] = $v;
			}
		}
		
		return $prepared;
	}