Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
71.43% |
10 / 14 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| StatusGet | |
71.43% |
10 / 14 |
|
0.00% |
0 / 1 |
2.09 | |
0.00% |
0 / 1 |
| readResponse | |
71.43% |
10 / 14 |
|
0.00% |
0 / 1 |
2.09 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package ZMS API |
| 5 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG |
| 6 | **/ |
| 7 | |
| 8 | namespace BO\Zmsapi; |
| 9 | |
| 10 | use BO\Slim\Render; |
| 11 | use BO\Zmsdb\Status; |
| 12 | |
| 13 | class StatusGet extends BaseController |
| 14 | { |
| 15 | /** |
| 16 | * @SuppressWarnings(Param) |
| 17 | * @return String |
| 18 | */ |
| 19 | public function readResponse( |
| 20 | \Psr\Http\Message\RequestInterface $request, |
| 21 | \Psr\Http\Message\ResponseInterface $response, |
| 22 | array $args |
| 23 | ) { |
| 24 | $validator = $request->getAttribute('validator'); |
| 25 | $includeProcessStats = $validator->getParameter('includeProcessStats')->isNumber()->setDefault(1)->getValue(); |
| 26 | $status = (new Status())->readEntity(\App::$now, $includeProcessStats); |
| 27 | $status['version'] = Helper\Version::getArray(); |
| 28 | if (\App::DEBUG) { |
| 29 | $status['opcache'] = [ |
| 30 | 'config' => opcache_get_configuration(), |
| 31 | 'status' => opcache_get_status(false) |
| 32 | ]; |
| 33 | } |
| 34 | |
| 35 | $message = Response\Message::create($request); |
| 36 | $message->data = $status; |
| 37 | |
| 38 | $response = Render::withLastModified($response, time(), '0'); |
| 39 | $response = Render::withJson($response, $message->setUpdatedMetaData(), $message->getStatuscode()); |
| 40 | return $response; |
| 41 | } |
| 42 | } |