Conditions | 3 |
Paths | 5 |
Total Lines | 19 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
28 | public function __invoke(string $username = ''): JsonResponse |
||
29 | { |
||
30 | try { |
||
31 | $amount = (int)$this->request->get('amount'); |
||
32 | |||
33 | if ($amount === 0) { |
||
34 | return new JsonResponse( |
||
35 | $this->getFacade()->getCallbackUrl($username), |
||
36 | ); |
||
37 | } |
||
38 | |||
39 | return new JsonResponse( |
||
40 | $this->getFacade()->generateInvoice($username, $amount), |
||
41 | ); |
||
42 | } catch (Throwable $e) { |
||
43 | dump($e); |
||
44 | return new JsonResponse([ |
||
45 | 'status' => 'ERROR', |
||
46 | 'message' => $e->getMessage(), |
||
47 | ]); |
||
51 |