1 | <?php |
||
36 | class HttpResponseSender { |
||
37 | |||
38 | /* @var string */ |
||
39 | private $headerFunction; |
||
40 | |||
41 | /** |
||
42 | * @param string $headerFunction |
||
43 | * @throws \InvalidArgumentException |
||
44 | */ |
||
45 | 2 | public function __construct($headerFunction = "header") { |
|
51 | |||
52 | /** |
||
53 | * Sends the http response to the output buffer. |
||
54 | * @param \Brickoo\Component\Http\HttpResponse |
||
55 | * @return void |
||
56 | */ |
||
57 | 2 | public function send(HttpResponse $response) { |
|
66 | |||
67 | /** |
||
68 | * Sends the status headers line to the output buffer. |
||
69 | * @param string $httpStatus |
||
70 | * @param string $httpVersion |
||
71 | * @return void |
||
72 | */ |
||
73 | 1 | private function sendStatus($httpStatus, $httpVersion) { |
|
78 | |||
79 | /** |
||
80 | * Send the message headers to the output buffer. |
||
81 | * @param \Brickoo\Component\Http\HttpMessageHeader $messageHeader |
||
82 | * @return \Brickoo\Component\Http\HttpResponseSender |
||
83 | */ |
||
84 | 1 | private function sendMessageHeader(HttpMessageHeader $messageHeader) { |
|
92 | |||
93 | /** |
||
94 | * Sends the body to the output buffer. |
||
95 | * @param \Brickoo\Component\Http\HttpMessageBody $messageBody |
||
96 | * @return \Brickoo\Component\Http\HttpResponseSender |
||
97 | */ |
||
98 | 1 | private function sendHttpMessageBody(HttpMessageBody $messageBody) { |
|
102 | |||
103 | /** |
||
104 | * Checks if the status code does allow message body content. |
||
105 | * @param \Brickoo\Component\Http\HttpResponse $response |
||
106 | * @throws StatusCodeDoesNotAllowMessageBodyException |
||
107 | * @return \Brickoo\Component\Http\HttpResponseSender |
||
108 | */ |
||
109 | 2 | private function checkStatusAllowsHttpMessageBodyContent(HttpResponse $response) { |
|
116 | |||
117 | /** |
||
118 | * Check if the status does not allow to have message body content. |
||
119 | * @param integer $statusCode |
||
120 | * @return boolean check result |
||
121 | */ |
||
122 | 1 | private function statusDoesNotAllowBody($statusCode) { |
|
129 | } |
||
130 |