Beispiel #1
0
 /**
  * Merges default options into the array passed by reference and returns
  * an array of headers that need to be merged in after the request is
  * created.
  *
  * @param array $options Options to modify by reference
  *
  * @return array|null
  */
 private function mergeDefaults(&$options)
 {
     // Merging optimization for when no headers are present
     if (!isset($options['headers']) || !isset($this->defaults['headers'])) {
         $options = __puzzle_array_replace_recursive($this->defaults, $options);
         return null;
     }
     $defaults = $this->defaults;
     unset($defaults['headers']);
     $options = __puzzle_array_replace_recursive($defaults, $options);
     return $this->defaults['headers'];
 }
Beispiel #2
0
 private function applyCustomOptions(puzzle_message_RequestInterface $request, array &$options)
 {
     // Overwrite any generated options with custom options
     $config = $request->getConfig();
     if ($custom = $config['stream_context']) {
         if (!is_array($custom)) {
             throw new puzzle_exception_AdapterException('stream_context must be an array');
         }
         $options = __puzzle_array_replace_recursive($options, $custom);
     }
 }