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