Lines Matching refs:options

101      * @param array $options Request options to apply to the given
106 public function sendAsync(RequestInterface $request, array $options = []) argument
109 $options = $this->prepareDefaults($options);
112 … $request->withUri($this->buildUri($request->getUri(), $options), $request->hasHeader('Host')),
113 $options
120 * @param array $options Request options to apply to the given
126 public function send(RequestInterface $request, array $options = []) argument
128 $options[RequestOptions::SYNCHRONOUS] = true;
129 return $this->sendAsync($request, $options)->wait();
142 * @param array $options Request options to apply. See \GuzzleHttp\RequestOptions.
146 public function requestAsync($method, $uri = '', array $options = []) argument
148 $options = $this->prepareDefaults($options);
150 $headers = isset($options['headers']) ? $options['headers'] : [];
151 $body = isset($options['body']) ? $options['body'] : null;
152 $version = isset($options['version']) ? $options['version'] : '1.1';
154 $uri = $this->buildUri($uri, $options);
160 unset($options['headers'], $options['body'], $options['version']);
162 return $this->transfer($request, $options);
174 * @param array $options Request options to apply. See \GuzzleHttp\RequestOptions.
179 public function request($method, $uri = '', array $options = []) argument
181 $options[RequestOptions::SYNCHRONOUS] = true;
182 return $this->requestAsync($method, $uri, $options)->wait();
283 * @param array $options Options to modify by reference
287 private function prepareDefaults(array $options) argument
299 if (array_key_exists('headers', $options)) {
301 if ($options['headers'] === null) {
303 unset($options['headers']);
304 } elseif (!is_array($options['headers'])) {
310 $result = $options + $defaults;
328 * @param array $options See \GuzzleHttp\RequestOptions.
332 private function transfer(RequestInterface $request, array $options) argument
335 if (isset($options['save_to'])) {
336 $options['sink'] = $options['save_to'];
337 unset($options['save_to']);
341 if (isset($options['exceptions'])) {
342 $options['http_errors'] = $options['exceptions'];
343 unset($options['exceptions']);
346 $request = $this->applyOptions($request, $options);
348 $handler = $options['handler'];
351 return Promise\promise_for($handler($request, $options));
361 * @param array $options
365 private function applyOptions(RequestInterface $request, array &$options) argument
371 if (isset($options['headers'])) {
372 $modify['set_headers'] = $options['headers'];
373 unset($options['headers']);
376 if (isset($options['form_params'])) {
377 if (isset($options['multipart'])) {
384 $options['body'] = http_build_query($options['form_params'], '', '&');
385 unset($options['form_params']);
387 … $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']);
388 $options['_conditional']['Content-Type'] = 'application/x-www-form-urlencoded';
391 if (isset($options['multipart'])) {
392 $options['body'] = new Psr7\MultipartStream($options['multipart']);
393 unset($options['multipart']);
396 if (isset($options['json'])) {
397 $options['body'] = \GuzzleHttp\json_encode($options['json']);
398 unset($options['json']);
400 … $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']);
401 $options['_conditional']['Content-Type'] = 'application/json';
404 if (!empty($options['decode_content'])
405 && $options['decode_content'] !== true
408 … $options['_conditional'] = Psr7\_caseless_remove(['Accept-Encoding'], $options['_conditional']);
409 $modify['set_headers']['Accept-Encoding'] = $options['decode_content'];
412 if (isset($options['body'])) {
413 if (is_array($options['body'])) {
416 $modify['body'] = Psr7\stream_for($options['body']);
417 unset($options['body']);
420 if (!empty($options['auth']) && is_array($options['auth'])) {
421 $value = $options['auth'];
432 $options['curl'][CURLOPT_HTTPAUTH] = CURLAUTH_DIGEST;
433 $options['curl'][CURLOPT_USERPWD] = "$value[0]:$value[1]";
436 $options['curl'][CURLOPT_HTTPAUTH] = CURLAUTH_NTLM;
437 $options['curl'][CURLOPT_USERPWD] = "$value[0]:$value[1]";
442 if (isset($options['query'])) {
443 $value = $options['query'];
451 unset($options['query']);
455 if (isset($options['sink'])) {
457 if (is_bool($options['sink'])) {
466 … $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']);
467 $options['_conditional']['Content-Type'] = 'multipart/form-data; boundary='
472 if (isset($options['_conditional'])) {
475 foreach ($options['_conditional'] as $k => $v) {
482 unset($options['_conditional']);