Example #1
0
 protected function handleOptions(array &$options)
 {
     parent::handleOptions($options);
     // Use a custom emitter if one is specified, and remove it from
     // options that are exposed through getConfig()
     if (isset($options['emitter'])) {
         $this->emitter = $options['emitter'];
         unset($options['emitter']);
     }
 }
Example #2
0
 private function getDefaultOptions(puzzle_message_RequestInterface $request)
 {
     $headers = puzzle_message_AbstractMessage::getHeadersAsString($request);
     $context = array('http' => array('method' => $request->getMethod(), 'header' => trim($headers), 'protocol_version' => $request->getProtocolVersion(), 'ignore_errors' => true, 'follow_location' => 0));
     if ($body = $request->getBody()) {
         $context['http']['content'] = (string) $body;
         // Prevent the HTTP adapter from adding a Content-Type header.
         if (!$request->hasHeader('Content-Type')) {
             $context['http']['header'] .= "\r\nContent-Type:";
         }
     }
     return $context;
 }
Example #3
0
 /**
  * Accepts and modifies the options provided to the response in the
  * constructor.
  *
  * @param array $options Options array passed by reference.
  */
 protected function handleOptions(array &$options = array())
 {
     parent::handleOptions($options);
     if (isset($options['reason_phrase'])) {
         $this->reasonPhrase = $options['reason_phrase'];
     }
 }
 /**
  * @expectedException InvalidArgumentException
  */
 public function testThrowsWhenMessageIsUnknown()
 {
     $m = $this->getMockBuilder('puzzle_message_AbstractMessage')->getMockForAbstractClass();
     puzzle_message_AbstractMessage::getStartLine($m);
 }