コード例 #1
0
 /**
  * This method will enforce that the status code will always be in the 200 range.
  *
  * @param $status
  */
 public function setStatusCode($status, $text = null)
 {
     if ($status < 200 || $status > 299) {
         throw new \Exception('Success operations should have a 2xx status code.');
     }
     parent::setStatusCode($status, $text);
 }
コード例 #2
0
 /**
  * This method will enforce that the status code will always be in the >= 400 range.
  *
  * @param $status
  */
 public function setStatusCode($status, $text = null)
 {
     if ($status < 400) {
         throw new Exception('Error operations should have a status code in the 4xx or 5xx range.');
     }
     parent::setStatusCode($status, $text);
 }