1 | <?php |
||
23 | class Render implements HandlerInterface |
||
24 | { |
||
25 | /** |
||
26 | * Known handled content types. |
||
27 | * |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $knownContentTypes = [ |
||
31 | 'text/html', |
||
32 | 'text/json', |
||
33 | 'application/json', |
||
34 | 'text/xml', |
||
35 | 'application/xml', |
||
36 | ]; |
||
37 | |||
38 | /** |
||
39 | * {@inheritdoc} |
||
40 | */ |
||
41 | public function __invoke(ServerRequestInterface $request, ResponseInterface $response, WatcherInterface $watcher) |
||
79 | |||
80 | /** |
||
81 | * Render HTML maintenance message. |
||
82 | * |
||
83 | * @param WatcherInterface $watcher |
||
84 | * |
||
85 | * @return string |
||
86 | */ |
||
87 | protected function renderHtml(WatcherInterface $watcher) |
||
102 | |||
103 | /** |
||
104 | * Render JSON maintenance message. |
||
105 | * |
||
106 | * @param WatcherInterface $watcher |
||
107 | * |
||
108 | * @return string |
||
109 | */ |
||
110 | protected function renderJson(WatcherInterface $watcher) |
||
114 | |||
115 | /** |
||
116 | * Render XML maintenance message. |
||
117 | * |
||
118 | * @param WatcherInterface $watcher |
||
119 | * |
||
120 | * @return string |
||
121 | */ |
||
122 | protected function renderXml(WatcherInterface $watcher) |
||
129 | |||
130 | /** |
||
131 | * Retrieve custom maintenance message. |
||
132 | * |
||
133 | * @param WatcherInterface $watcher |
||
134 | * |
||
135 | * @return string |
||
136 | */ |
||
137 | protected function getMaintenanceMessage(WatcherInterface $watcher) |
||
148 | |||
149 | /** |
||
150 | * Determine content type using Accept header. |
||
151 | * |
||
152 | * @param ServerRequestInterface $request |
||
153 | * |
||
154 | * @return string |
||
155 | */ |
||
156 | protected function determineContentType(ServerRequestInterface $request) |
||
174 | } |
||
175 |