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 | /** @var array */ |
||
36 | private $parameters; |
||
37 | |||
38 | /** |
||
39 | * Sets status code. |
||
40 | * |
||
41 | * @param int $status |
||
42 | * |
||
43 | * @throws InvalidArgumentException |
||
44 | * |
||
45 | * @return $this |
||
46 | */ |
||
47 | 6 | public function setStatus($status) |
|
57 | |||
58 | /** |
||
59 | * Gets status code. |
||
60 | * |
||
61 | * @return int |
||
62 | */ |
||
63 | 5 | public function getStatus() |
|
67 | |||
68 | /** |
||
69 | * Gets reason for the status set. |
||
70 | * |
||
71 | * @return false|string |
||
72 | */ |
||
73 | 1 | public function getStatusReason() |
|
77 | |||
78 | /** |
||
79 | * Sets matched middleware. |
||
80 | * |
||
81 | * @param string $matchedMiddleware |
||
82 | * |
||
83 | * @return $this |
||
84 | */ |
||
85 | 5 | public function setMatchedMiddleware($matchedMiddleware) |
|
91 | |||
92 | /** |
||
93 | * Gets matched middleware. |
||
94 | * |
||
95 | * @return string |
||
96 | */ |
||
97 | 5 | public function getMatchedMiddleware() |
|
101 | |||
102 | /** |
||
103 | * Sets the parameters. |
||
104 | * |
||
105 | * @param array $parameters |
||
106 | * |
||
107 | * @return $this |
||
108 | */ |
||
109 | 5 | public function setParameters(array $parameters) |
|
115 | |||
116 | /** |
||
117 | * Gets the parameters. |
||
118 | * |
||
119 | * @return array |
||
120 | */ |
||
121 | 3 | public function getParameters() |
|
125 | } |
||
126 |