| Conditions | 4 |
| Paths | 9 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | public function __invoke(string $username = '', int $amount = 0): string |
||
| 28 | { |
||
| 29 | try { |
||
| 30 | if ($amount === 0) { |
||
| 31 | $amount = (int)$this->request->get('amount'); |
||
| 32 | } |
||
| 33 | |||
| 34 | if ($amount === 0) { |
||
| 35 | return $this->json( |
||
| 36 | $this->getFacade()->getCallbackUrl($username), |
||
| 37 | ); |
||
| 38 | } |
||
| 39 | |||
| 40 | return $this->json( |
||
| 41 | $this->getFacade()->generateInvoice($username, $amount), |
||
| 42 | ); |
||
| 43 | } catch (Throwable $e) { |
||
| 44 | return $this->error($e); |
||
| 45 | } |
||
| 61 |