Conditions | 6 |
Paths | 6 |
Total Lines | 29 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 42 |
Changes | 0 |
1 | <?php |
||
56 | public function sendHeaders() |
||
57 | { |
||
58 | if (empty($this->headers)) { |
||
59 | return; |
||
60 | } |
||
61 | |||
62 | $this->checkIfHeadersAlreadySent(); |
||
63 | |||
64 | foreach ($this->headers as $header) { |
||
65 | switch ($header) { |
||
66 | case '403': |
||
67 | header('HTTP/1.0 403 Forbidden'); |
||
68 | break; |
||
69 | |||
70 | case '404': |
||
71 | header('HTTP/1.0 404 Not Found'); |
||
72 | break; |
||
73 | |||
74 | case '500': |
||
75 | header('HTTP/1.0 500 Internal Server Error'); |
||
76 | break; |
||
77 | |||
78 | default: |
||
79 | throw new \Exception("Trying to sen unkown header type: '$header'."); |
||
80 | } |
||
81 | } |
||
82 | |||
83 | return $this; |
||
84 | } |
||
85 | |||
103 |