Conditions | 5 |
Paths | 8 |
Total Lines | 30 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
7 | public function showAction() |
||
8 | { |
||
9 | $text = $this->container->getParameter('bzion.miscellaneous.maintenance'); |
||
10 | |||
11 | if (is_string($text)) { |
||
12 | $defaultText = $text; |
||
13 | } else { |
||
14 | $defaultText = "Services are currently down for maintenance. Please try again later."; |
||
15 | } |
||
16 | |||
17 | if ($this->isJson()) { |
||
18 | return new JsonResponse(array( |
||
19 | 'success' => false, |
||
20 | 'content' => $defaultText |
||
21 | )); |
||
22 | } |
||
23 | |||
24 | // Return plain text if we were using a controller that didn't return |
||
25 | // HTML |
||
26 | $attributes = $this->getRequest()->attributes; |
||
27 | if ($attributes->has('_controller')) { |
||
28 | if (\Controller::getController($attributes) instanceof \PlainTextController) { |
||
29 | return $defaultText; |
||
30 | } |
||
31 | } |
||
32 | |||
33 | return array( |
||
34 | 'text' => $text |
||
35 | ); |
||
36 | } |
||
37 | } |
||
38 |