| Total Complexity | 6 |
| Total Lines | 76 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 13 | class Response extends Message |
||
| 14 | {
|
||
| 15 | /** HTTP 1.1 code */ |
||
| 16 | const |
||
| 17 | S200_OK = 200, |
||
| 18 | S301_MOVED_PERMANENTLY = 301, |
||
| 19 | S302_FOUND = 302, |
||
| 20 | S304_NOT_MODIFIED = 304, |
||
| 21 | S307_TEMPORARY_REDIRECT = 307, |
||
| 22 | S400_BAD_REQUEST = 400, |
||
| 23 | S401_UNAUTHORIZED = 401, |
||
| 24 | S403_FORBIDDEN = 403, |
||
| 25 | S404_NOT_FOUND = 404, |
||
| 26 | S422_UNPROCESSABLE_ENTITY = 422; |
||
| 27 | |||
| 28 | /** @var int */ |
||
| 29 | private $code; |
||
| 30 | |||
| 31 | /** @var Response */ |
||
| 32 | private $previous; |
||
| 33 | |||
| 34 | |||
| 35 | /** |
||
| 36 | * @param int |
||
| 37 | * @param array |
||
| 38 | * @param string |
||
| 39 | */ |
||
| 40 | public function __construct($code, array $headers, $content) |
||
| 44 | } |
||
| 45 | |||
| 46 | |||
| 47 | /** |
||
| 48 | * HTTP code. |
||
| 49 | * @return int |
||
| 50 | */ |
||
| 51 | public function getCode() |
||
| 52 | {
|
||
| 53 | return $this->code; |
||
| 54 | } |
||
| 55 | |||
| 56 | |||
| 57 | /** |
||
| 58 | * @param int |
||
| 59 | * @return bool |
||
| 60 | */ |
||
| 61 | public function isCode($code) |
||
| 62 | {
|
||
| 63 | return $this->code === (int) $code; |
||
| 64 | } |
||
| 65 | |||
| 66 | |||
| 67 | /** |
||
| 68 | * @return Response|NULL |
||
| 69 | */ |
||
| 70 | public function getPrevious() |
||
| 73 | } |
||
| 74 | |||
| 75 | |||
| 76 | /** |
||
| 77 | * @param Response|null $previous |
||
| 78 | * @return self |
||
| 79 | * |
||
| 80 | */ |
||
| 81 | public function setPrevious(Response $previous = NULL) |
||
| 92 |