Inheritance: implements ArrayAccess, implements Countable
Exemplo n.º 1
0
 /**
  * @param string  $body
  * @param string  $headers
  * @param Request $request
  * @param array   $meta_data
  */
 public function __construct($body, $headers, Request $request, array $meta_data = array())
 {
     $this->request = $request;
     $this->raw_headers = $headers;
     $this->raw_body = $body;
     $this->meta_data = $meta_data;
     $this->code = $this->_parseCode($headers);
     $this->reason = Http::reason($this->code);
     $this->headers = Response\Headers::fromString($headers);
     $this->_interpretHeaders();
     $this->body = $this->_parse($body);
 }
Exemplo n.º 2
0
 function test_parseHeaders()
 {
     $parse_headers = Response\Headers::fromString(self::SAMPLE_JSON_HEADER);
     $this->assertCount(3, $parse_headers);
     $this->assertEquals('application/json', $parse_headers['Content-Type']);
     $this->assertTrue(isset($parse_headers['Connection']));
 }
Exemplo n.º 3
0
 /**
  * Parse text headers from response into
  * array of key value pairs
  *
  * @param string $headers raw headers
  *
  * @return array parse headers
  */
 public function _parseHeaders($headers)
 {
     return Headers::fromString($headers)->toArray();
 }