jsonValue = $jsonValue; switch ($this->jsonValue) { case self::$BAD_REQUEST: $this->httpErrorMsg = '400 Bad Request'; $this->httpErrorcode = 400; break; case self::$UNAUTHORIZED: $this->httpErrorMsg = '401 Unauthorized'; $this->httpErrorcode = 401; break; case self::$FORBIDDEN: $this->httpErrorMsg = '403 Forbidden'; $this->httpErrorcode = 403; break; case self::$NOT_FOUND: $this->httpErrorMsg = '404 Not Found'; $this->httpErrorcode = 404; break; case self::$NOT_IMPLEMENTED: $this->httpErrorMsg = '501 Not Implemented'; $this->httpErrorcode = 501; break; case self::$LIMIT_EXCEEDED: //FIXME or should this be a 507 Insufficient Storage (WebDAV, RFC 4918) ? $this->httpErrorMsg = '509 Limit Exceeeded'; $this->httpErrorcode = 509; break; case self::$INTERNAL_ERROR: default: $this->httpErrorMsg = '500 Internal Server Error'; $this->httpErrorcode = 500; break; } } /** * * Converts the ResponseError to a String representation */ public function toString() { return $this->jsonValue; } /** * Get the HTTP error code. * @return the Http Error code. */ public function getHttpErrorCode() { return $this->httpErrorCode; } /** * Get the HTTP error response header. * @return the Http response header. */ public function getHttpErrorMsg() { return $this->httpErrorMsg; } }