| Conditions | 3 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public function __invoke(string $username = '', int $amount = 0): string |
||
| 22 | { |
||
| 23 | try { |
||
| 24 | if ($amount === 0) { |
||
| 25 | return $this->json( |
||
| 26 | $this->getFacade()->getCallbackUrl($username), |
||
| 27 | ); |
||
| 28 | } |
||
| 29 | |||
| 30 | return $this->json( |
||
| 31 | $this->getFacade()->generateInvoice($username, $amount), |
||
| 32 | ); |
||
| 33 | } catch (Throwable $e) { |
||
| 34 | return $this->json([ |
||
| 35 | 'status' => 'ERROR', |
||
| 36 | 'message' => $e->getMessage(), |
||
| 37 | ]); |
||
| 48 |