1 | <?php |
||
14 | class Emitter |
||
15 | { |
||
16 | /** |
||
17 | * Checks to see if content has previously been sent. |
||
18 | * |
||
19 | * If either headers have been sent or the output buffer contains content, |
||
20 | * raises an exception. |
||
21 | * |
||
22 | * @throws RuntimeException if headers have already been sent. |
||
23 | * @throws RuntimeException if output is present in the output buffer. |
||
24 | */ |
||
25 | private function assertNoPreviousOutput() |
||
35 | |||
36 | /** |
||
37 | * Emit the status line. |
||
38 | * |
||
39 | * Emits the status line using the protocol version and status code from |
||
40 | * the response; if a reason phrase is available, it, too, is emitted. |
||
41 | * |
||
42 | * It is important to mention that this method should be called after |
||
43 | * `emitHeaders()` in order to prevent PHP from changing the status code of |
||
44 | * the emitted response. |
||
45 | * |
||
46 | * @param PSRResponse $response |
||
47 | * |
||
48 | * @see \Laminas\Diactoros\Response\SapiEmitterTrait::emitHeaders() |
||
49 | */ |
||
50 | private function emitStatusLine(PSRResponse $response) |
||
62 | |||
63 | /** |
||
64 | * Emit response headers. |
||
65 | * |
||
66 | * Loops through each header, emitting each; if the header value |
||
67 | * is an array with multiple values, ensures that each is sent |
||
68 | * in such a way as to create aggregate headers (instead of replace |
||
69 | * the previous). |
||
70 | * |
||
71 | * @param PSRResponse $response |
||
72 | */ |
||
73 | private function emitHeaders(PSRResponse $response) |
||
90 | |||
91 | /** |
||
92 | * Filter a header name to wordcase |
||
93 | * |
||
94 | * @param string $header |
||
95 | * @return string |
||
96 | */ |
||
97 | private function filterHeader($header) |
||
103 | |||
104 | /** |
||
105 | * Emits a response for a PHP SAPI environment. |
||
106 | * |
||
107 | * Emits the status line and headers via the header() function, and the |
||
108 | * body content via the output buffer. |
||
109 | * |
||
110 | * @param PSRResponse $response |
||
111 | */ |
||
112 | public function emit(PSRResponse $response, $maxBufferLength = 8192) |
||
142 | |||
143 | /** |
||
144 | * Parse content-range header |
||
145 | * http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.16 |
||
146 | * |
||
147 | * @param string $header |
||
148 | * @return false|array [unit, first, last, length]; returns false if no |
||
149 | * content range or an invalid content range is provided |
||
150 | */ |
||
151 | private function parseContentRange($header) |
||
163 | /** |
||
164 | * Emit a range of the message body. |
||
165 | * |
||
166 | * @param array $range |
||
167 | * @param PSRResponse $response |
||
168 | * @param int $maxBufferLength |
||
169 | */ |
||
170 | private function emitBodyRange(array $range, PSRResponse $response, $maxBufferLength) |
||
202 | } |
||
203 |
This checks looks for assignemnts to variables using the
list(...)
function, where not all assigned variables are subsequently used.Consider the following code example.
Only the variables
$a
and$c
are used. There was no need to assign$b
.Instead, the list call could have been.