1 | <?php |
||
12 | trait Psr7 { |
||
13 | /** |
||
14 | * Provides output to PSR-7 response object |
||
15 | * |
||
16 | * @param \Psr\Http\Message\ResponseInterface $response |
||
17 | * |
||
18 | * @return \Psr\Http\Message\ResponseInterface |
||
19 | */ |
||
20 | function output_to_psr7 ($response) { |
||
21 | $this->to_psr7_body($response); |
||
22 | $response = $this->to_psr7_headers($response); |
||
23 | /** @noinspection ExceptionsAnnotatingAndHandlingInspection */ |
||
24 | return $response |
||
25 | ->withProtocolVersion(explode('/', $this->protocol, 2)[1]) |
||
26 | ->withStatus($this->code); |
||
27 | } |
||
28 | /** |
||
29 | * @param \Psr\Http\Message\ResponseInterface $response |
||
30 | */ |
||
31 | protected function to_psr7_body ($response) { |
||
48 | /** |
||
49 | * @param \Psr\Http\Message\ResponseInterface $response |
||
50 | * |
||
51 | * @return \Psr\Http\Message\ResponseInterface $response |
||
52 | */ |
||
53 | protected function to_psr7_headers ($response) { |
||
63 | } |
||
64 |