Ejemplo n.º 1
0
 /**
  * Set the headers and the response code to a given $response, class is reset after.
  *
  * @param  HTTP\Response $response
  * @return boolean
  */
 private function prepareResponse(HTTP\Response $response)
 {
     if (!Manager::loaded()) {
         return false;
     }
     session_write_close();
     $values = Manager::values();
     if (isset($values['header'])) {
         if (isset($values['header']['code']) && $values['header']['code']) {
             $response->setResponseCode($values['header']['code']);
         }
         if (isset($values['header']['list'])) {
             foreach ($values['header']['list'] as $headers) {
                 foreach ($headers as $header) {
                     $response->addHeader($header, false);
                 }
             }
         }
     }
     Manager::reset();
 }
Ejemplo n.º 2
0
 public function testSetResponseCodeAndGetResponseCode()
 {
     $response = new Response();
     $response->setResponseCode(200);
     $this->assertSame(200, $response->getResponseCode());
 }