Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
12 | 3 | public function __invoke(Application $app, Request $request) |
|
13 | { |
||
14 | 3 | $store = $this->getStore($app); |
|
15 | |||
16 | 3 | if (!$store->contains($request->getRequestUri())) { |
|
17 | 1 | throw new NotFoundHttpException("Not Found"); |
|
18 | } |
||
19 | |||
20 | 2 | $resource = $store->fetch($request->getRequestUri()); |
|
21 | 2 | if ($resource === false) { |
|
22 | 1 | throw new ServiceUnavailableHttpException(null, "Failed to retrieve resource"); |
|
23 | } |
||
24 | |||
25 | 1 | return $app->json($resource); |
|
26 | } |
||
27 | } |
||
28 |