示例#1
0
 /**
  * Restore a \Phalcon\Http\Response\Headers object
  *
  * @param array $data
  * @return \Phalcon\Http\Response\Headers
  * @throws Exception
  */
 public static function __set_state($data)
 {
     if (is_array($data) === false) {
         throw new Exception('Invalid parameter type.');
     }
     $headers = new Headers();
     if (isset($data['_headers']) === true && is_array($data['_headers']) === true) {
         foreach ($data['_headers'] as $key => $value) {
             //@note this doesn't work for raw headers!
             $headers->set($key, $value);
         }
     }
     return $headers;
 }
示例#2
0
 public function set($name, $value)
 {
     parent::set($name, $value);
 }
 /**
  * Tests toArray in response headers
  *
  * @author Nikolaos Dimopoulos <*****@*****.**>
  * @since  2014-10-05
  */
 public function testHttpResponseHeadersToArray()
 {
     $this->specify("toArray in Response Headers is not correct", function () {
         $responseHeaders = new PhResponseHeaders();
         $responseHeaders->set('Content-Type', 'text/html');
         $expected = $responseHeaders->toArray();
         $actual = ['Content-Type' => 'text/html'];
         expect($actual)->equals($expected);
     });
 }