| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 35 | * Maybe not very Silverstripe'sch, but at least this works |
||
| 36 | * |
||
| 37 | * @throws SS_HTTPResponse_Exception |
||
| 38 | */ |
||
| 39 | protected function throw503() |
||
| 40 | { |
||
| 41 | $message = 'Website is down for maintenance'; |
||
| 42 | $errorFile = $this->get503File(); |
||
| 43 | $content = is_file($errorFile) ? file_get_contents($errorFile) : '<h1>'.$message.'</h1>'; |
||
| 44 | |||
| 45 | throw new SS_HTTPResponse_Exception(new SS_HTTPResponse($content, 503, $message)); |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @return string |
||
| 50 | */ |
||
| 51 | protected function get503File() |
||
| 58 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.