Conditions | 4 |
Paths | 5 |
Total Lines | 23 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
15 | 9 | public function __invoke(ResourceObject $ro, array $server) |
|
16 | { |
||
17 | 9 | if ($this->isNotModified($ro, $server)) { |
|
18 | 1 | $this->transfer304($ro); |
|
19 | |||
20 | 1 | return; |
|
21 | } |
||
22 | |||
23 | // render |
||
24 | 8 | if (! $ro->view) { |
|
25 | 8 | $ro->toString(); |
|
26 | } |
||
27 | |||
28 | // header |
||
29 | 8 | foreach ($ro->headers as $label => $value) { |
|
30 | 8 | header("{$label}: {$value}", false); |
|
31 | } |
||
32 | |||
33 | // code |
||
34 | 8 | http_response_code($ro->code); |
|
35 | |||
36 | // body |
||
37 | 8 | echo $ro->view; |
|
38 | 8 | } |
|
75 |