Conditions | 2 |
Paths | 2 |
Total Lines | 22 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2.1922 |
Changes | 0 |
1 | <?php |
||
31 | 1 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
32 | { |
||
33 | 1 | $dbConfig = $request->getAttribute(ResourceMiddlewareInterface::DATA_RESOURCE); |
|
34 | |||
35 | 1 | if (!$dbConfig) { |
|
36 | return new JsonResponse([ |
||
37 | 'data' => [ |
||
38 | 'configuration' => null, |
||
39 | ], |
||
40 | 'success' => false, |
||
41 | 'msg' => new DangerMessage('Could not load DB Configuration.'), |
||
42 | ], 400); |
||
43 | } |
||
44 | |||
45 | 1 | return new JsonResponse([ |
|
46 | 1 | 'data' => [ |
|
47 | 1 | 'configuration' => $this->extraction->extract($dbConfig), |
|
48 | ], |
||
49 | 'success' => true, |
||
50 | 'msg' => null, |
||
51 | 1 | ], 200); |
|
52 | } |
||
53 | } |
||
54 |