Beispiel #1
0
 /**
  * Set the status code
  * 
  * @param integer $code An http status code
  * @return sndsgd\api\Response
  */
 public function setStatusCode($code)
 {
     $this->statusCode = $code;
     $this->statusText = HttpCode::getStatusText($code);
     if ($this->statusText === null) {
         throw new InvalidArgumentException("invalid HTTP status code '{$code}'");
     }
     return $this;
 }
Beispiel #2
0
 /**
  * Get the status text
  * 
  * @return string|null
  * @return string The status code
  * @return null The provided status code was not found
  */
 public function getStatusText()
 {
     return Code::getStatusText($this->statusCode);
 }