public function setStatusCode($statusCode, $message = '') { if (empty($message)) { if (!isset(self::$httpStatuses[$statusCode])) { throw new ResponseException('Invalid status code provided: "' . $statusCode . '".'); } else { $this->statusMessage = self::$httpStatuses[$statusCode]; } } else { $this->statusMessage = $message; } $this->statusCode = $statusCode; return $this; }