1 | <?php |
||
11 | abstract class AbstractResponse implements ResponseInterface |
||
12 | { |
||
13 | /** HTTP response code for OK */ |
||
14 | const RESPONSE_OK = 200; |
||
15 | /** HTTP response code for a bad request */ |
||
16 | const RESPONSE_BAD_REQUEST = 400; |
||
17 | /** HTTP response code for unauthorized */ |
||
18 | const RESPONSE_UNAUTHORIZED = 401; |
||
19 | /** HTTP response code for forbidden */ |
||
20 | const RESPONSE_FORBIDDEN = 403; |
||
21 | /** HTTP response code for not found */ |
||
22 | const RESPONSE_NOT_FOUND = 404; |
||
23 | /** HTTP response code for method not allowed */ |
||
24 | const RESPONSE_METHOD_NOT_ALLOWED = 405; |
||
25 | /** HTTP response code for too many requests in a period of time |
||
26 | * See: http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#429 */ |
||
27 | const RESPONSE_RATE_LIMITED = 429; |
||
28 | /** HTTP response code for a server error */ |
||
29 | const RESPONSE_SERVER_ERROR = 500; |
||
30 | /** HTTP response code for server unavailable */ |
||
31 | const RESPONSE_SERVICE_UNAVAILABLE = 503; |
||
32 | |||
33 | /** |
||
34 | * Constructor for the response. |
||
35 | * @param mixed $responseObject A response object that can be serialized to a string. |
||
36 | * @param int $statusCode The HTTP response. |
||
37 | */ |
||
38 | 23 | public function __construct($responseObject, $statusCode = self::RESPONSE_OK) |
|
43 | } |
||
44 |