Prepare option data to be passed to the Guzzle request

@param array $params
@param array $options
@return array
179534
private function prepareData($params = [], $options = [])
    {
        if(array_get($options, 'content_type') == "json") {
            $data['json'] = $params; // pass data as array which gets json_encoded
        } else {
            $data['query'] = $this->prepareQueryString($params); // pass data as query string
        }

        return array_merge($data, $options);
    }
1113980
public static function fromArray(array $params)
    {
        $options = new Options();

        if (isset($params['verbose'])) {
            $options->verbose = (bool) $params['verbose'];
        }

        if (isset($params['generate-imported'])) {
            $options->generateImported = (bool) $params['generate-imported'];
        }

        if (isset($params['psr4'])) {
            $options->psr4 = $params['psr4'];
        }

        return $options;
    }
501375
protected function addCustomer(array $params, array $options)
    {
        $params['customer_name'] = Arr::get($options, 'name', '');
        $params['customer_email'] = Arr::get($options, 'email', '');

        return $params;
    }
307896
protected function fetch($url, array $params = [], array $curl_options = []){
		$requestOptions               = new RequestOptions;
		$requestOptions->curl_options = $curl_options;
		$requestOptions->ca_info      = $this->ca_info;

		return (new Request($requestOptions))->fetch(new URL($url, $params));
	}
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;
    }
1301300
public function options($url, $data = [], array $options = [])
    {
        $options = $this->_mergeOptions($options);
        $url = $this->buildUrl($url, [], $options);

        return $this->_doRequest(Request::METHOD_OPTIONS, $url, $data, $options);
    }
1271911
protected function addPayout($params, $options)
    {
        $params['name'] = Arr::get($options, 'name');
        $params['email'] = Arr::get($options, 'email');
        $params['phone'] = Arr::get($options, 'phone');

        return $params;
    }
83473
private function prepareQuery($params = []) {
		if(!is_array($params)) {
			return $params;
		}

		$query = [];

		foreach($params as $key => $value) {
			if(is_array($value)) {
				foreach($value as $element) {
					$query[] = sprintf(
						'%s[]=%s',
						$key,
						urlencode($element)
					);
				}
			} else {
				$query[] = sprintf(
					'%s=%s',
					$key,
					urlencode($value)
				);
			}
		}

		return implode("&",$query);
	}
965389
public function get($url, array $params = null, array $options = array())
	{
		return $this->request($url, 'GET', $params, $options);
	}
458597
public function loadParams(array $params)
    {
        $this->arguments = array();
        $this->options = array();

        foreach ($params as $param) {
            if (strpos($param, '-') !== false) {
                $this->options[] = $this->extractOption($param);
            } else {
                $this->arguments[] = $param;
            }
        }

        return $this;
    }
105608
public function fetch($sql, array $params, array $options = array())
    {
        $sth = $this->run($sql, $params);
        $result = $sth->fetch(PDO::FETCH_ASSOC);

        $this->prepareResult($result, $options);
        return empty($result) ? array() : (array) $result;
    }
299307
public function prepare($options = [])
    {
        if (request()->ajax()) {
            return $this->getArray($options);
        }

        return $this->getHtml($options);
    }
1304043
protected function _prepareMessage($data, array $options)
    {
        $attributes = [];

        $options += [
            'silent' => false,
            'compress' => true,
            'serializer' => extension_loaded('msgpack') ? 'msgpack' : 'json',
            'delivery_mode' => 1
        ];

        switch ($options['serializer']) {
            case 'json':
                $data = json_encode($data);
                $attributes['content_type'] = 'application/json';
                break;

            case 'text':
                $attributes['content_type'] = 'application/text';
                break;

            default:
                throw new RuntimeException('Unknown serializer: ' . $options['serializer']);
        }

        if (!empty($options['compress'])) {
            $data = gzcompress($data);
            $attributes += ['content_encoding' => 'gzip'];
        }

        if (!empty($options['delivery_mode'])) {
            $attributes['delivery_mode'] = $options['delivery_mode'];
        }

        return [$data, $attributes, $options];
    }
65407
protected function prepareOptions(array $options = [])
    {
        $helper = $this->formHelper;

        if (array_get($this->options, 'template') !== null) {
            $this->template = array_pull($this->options, 'template');
        }

        $options = $helper->mergeOptions($this->options, $options);

        if ($this->parent->haveErrorsEnabled()) {
            $this->addErrorClass($options);
        }

        if ($this->getOption('attr.multiple')) {
            $this->name = $this->name.'[]';
        }

        if ($this->getOption('required') === true) {
            $options['label_attr']['class'] .= ' ' . $this->formHelper
                ->getConfig('defaults.required_class', 'required');
            $options['attr']['required'] = 'required';
        }

        $options['wrapperAttrs'] = $helper->prepareAttributes($options['wrapper']);
        $options['errorAttrs'] = $helper->prepareAttributes($options['errors']);

        if ($options['is_child']) {
            $options['labelAttrs'] = $helper->prepareAttributes($options['label_attr']);
        }

        if ($options['help_block']['text']) {
            $options['help_block']['helpBlockAttrs'] = $helper->prepareAttributes(
                $options['help_block']['attr']
            );
        }

        return $options;
    }
999987
public static function create($params = null, $options = null)
    {
        $opts = \Stripe\Util\RequestOptions::parse($options);
        if (is_null($opts->apiBase)) {
            $opts->apiBase = Stripe::$apiUploadBase;
        }
        // Manually flatten params, otherwise curl's multipart encoder will
        // choke on nested arrays.
        // TODO: use array_column() once we drop support for PHP 5.4
        $flatParams = [];
        foreach (\Stripe\Util\Util::flattenParams($params) as $pair) {
            $flatParams[$pair[0]] = $pair[1];
        }
        return static::_create($flatParams, $opts);
    }
778963
public function getIndexUrl(array $params = array(), array $options = array())
    {
        return $this->url()->fromRoute($this->getEvent()->getRouteMatch()->getMatchedRouteName(),
            array_merge(array('action' => 'index'), $params),
            $options
        );
    }
336776
protected function prepareOptions(array $options = [])
    {
        $cookieName = time()."_".substr(md5(microtime()), 0, 5).".txt";
                
        $defaultConfig = array(
            'curl' => array(
                CURLOPT_COOKIEJAR      => $cookieName,
                CURLOPT_COOKIEFILE     => $cookieName,
            ),
        );
        $configOptions = array_merge_recursive($options, $defaultConfig);
        
        return $configOptions;
    }