1 | <?php |
||
23 | class Response extends AbstractHttpMessage |
||
24 | { |
||
25 | const SWITCHING_PROTOCOLS = '101 Switching Protocols'; |
||
26 | const BAD_REQUEST = '400 Bad Request'; |
||
27 | |||
28 | /** |
||
29 | * @var string For example "404 Not Found" |
||
30 | */ |
||
31 | private $httpResponse; |
||
32 | |||
33 | /** |
||
34 | * @var int |
||
35 | */ |
||
36 | private $statusCode; |
||
37 | |||
38 | /** |
||
39 | * @var string |
||
40 | */ |
||
41 | private $reason; |
||
42 | |||
43 | public function __construct() |
||
47 | |||
48 | /** |
||
49 | * @param string $httpResponse |
||
50 | * @return Response |
||
51 | */ |
||
52 | public function setHttpResponse($httpResponse) |
||
58 | |||
59 | /** |
||
60 | * @return int |
||
61 | */ |
||
62 | public function getStatusCode(): int |
||
66 | |||
67 | /** |
||
68 | * @param int $statusCode |
||
69 | * @return Response |
||
70 | */ |
||
71 | public function setStatusCode(int $statusCode) |
||
77 | |||
78 | /** |
||
79 | * @return string |
||
80 | */ |
||
81 | public function getReason(): string |
||
85 | |||
86 | /** |
||
87 | * @param string $reason |
||
88 | * @return Response |
||
89 | */ |
||
90 | public function setReason(string $reason) |
||
96 | |||
97 | /** |
||
98 | * @return string |
||
99 | */ |
||
100 | public function getAcceptKey() |
||
104 | |||
105 | /** |
||
106 | * @param ConnectionInterface $stream |
||
107 | */ |
||
108 | public function send(ConnectionInterface $stream) |
||
121 | |||
122 | public static function createSwitchProtocolResponse() |
||
132 | |||
133 | /** |
||
134 | * @param string $data |
||
135 | * @return Response |
||
136 | * @throws HttpException |
||
137 | */ |
||
138 | public static function create(string &$data) : Response |
||
172 | |||
173 | /** |
||
174 | * @param string $firstLine |
||
175 | * @param Response $response |
||
176 | * @throws HttpException |
||
177 | */ |
||
178 | protected static function initResponse(string $firstLine, Response $response) |
||
198 | } |
||
199 |