1 | <?php |
||
19 | class Result |
||
20 | { |
||
21 | const CODE_FOUND = 200; |
||
22 | const CODE_NOT_FOUND = 404; |
||
23 | const CODE_BAD_METHOD = 405; |
||
24 | |||
25 | /** @var int */ |
||
26 | private $status; |
||
27 | /** @var string */ |
||
28 | private $matchedMiddleware; |
||
29 | /** @var array */ |
||
30 | private $statusReason = [ |
||
31 | self::CODE_FOUND => 'Resource found.', |
||
32 | self::CODE_NOT_FOUND => 'The requested resource cannot be found.', |
||
33 | self::CODE_BAD_METHOD => 'Bad request method was used by the client.' |
||
34 | ]; |
||
35 | |||
36 | /** |
||
37 | * Sets status code. |
||
38 | * |
||
39 | * @param int $status |
||
40 | * |
||
41 | * @throws InvalidArgumentException |
||
42 | * |
||
43 | * @return $this |
||
44 | */ |
||
45 | 2 | public function setStatus($status) |
|
55 | |||
56 | /** |
||
57 | * Gets status code. |
||
58 | * |
||
59 | * @return int |
||
60 | */ |
||
61 | 1 | public function getStatus() |
|
65 | |||
66 | /** |
||
67 | * Gets reason for the status set. |
||
68 | * |
||
69 | * @return false|string |
||
70 | */ |
||
71 | 1 | public function getStatusReason() |
|
75 | |||
76 | /** |
||
77 | * Sets matched middleware. |
||
78 | * |
||
79 | * @param string $matchedMiddleware |
||
80 | */ |
||
81 | 1 | public function setMatchedMiddleware($matchedMiddleware) |
|
85 | |||
86 | /** |
||
87 | * Gets matched middleware. |
||
88 | * |
||
89 | * @return string |
||
90 | */ |
||
91 | 1 | public function getMatchedMiddleware() |
|
95 | } |
||
96 |