Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 11 |
Lines | 16 |
Ratio | 100 % |
Changes | 0 |
1 | <?php |
||
29 | public function __invoke(Request $request): Response |
||
30 | { |
||
31 | if (!$request->query->has('channel')) { |
||
32 | throw new NotFoundHttpException('Cannot find product without channel provided'); |
||
33 | } |
||
34 | |||
35 | try { |
||
36 | return $this->viewHandler->handle(View::create($this->productLatestQuery->getLatestProducts( |
||
37 | $request->query->get('channel'), |
||
38 | $request->query->get('locale'), |
||
39 | $request->query->getInt('limit', 4) |
||
40 | ), Response::HTTP_OK)); |
||
41 | } catch (\InvalidArgumentException $exception) { |
||
42 | throw new NotFoundHttpException($exception->getMessage()); |
||
43 | } |
||
44 | } |
||
45 | } |
||
46 |