예제 #1
0
 public function testAutomaticMessage()
 {
     $code = 201;
     $expected_message = 'Created';
     $http_status = new HttpStatus($code);
     $this->assertSame($code, $http_status->getCode());
     $this->assertSame($expected_message, $http_status->getMessage());
 }
예제 #2
0
 /**
  * Get (or set) the HTTP response code
  *
  * Simply calling this method without any arguments returns the current response code.
  * Calling with an integer argument, however, attempts to set the response code to what
  * was provided by the argument.
  *
  * @param int $code     The HTTP status code to send
  * @access public
  * @return int|Response
  */
 public function code($code = null)
 {
     if (null !== $code) {
         // Require that the response be unlocked before changing it
         $this->requireUnlocked();
         $this->status = new HttpStatus($code);
         return $this;
     }
     return $this->status->getCode();
 }