Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2.0078 |
Changes | 0 |
1 | <?php |
||
47 | 28 | public function addBalance(Wallet $wallet, int $amount): bool |
|
48 | { |
||
49 | 28 | $newBalance = $wallet->getBalanceAttribute() + $amount; |
|
50 | 28 | $wallet->balance = $newBalance; |
|
|
|||
51 | |||
52 | 28 | if ($wallet->save()) { |
|
53 | 28 | $proxy = app(ProxyService::class); |
|
54 | 28 | $proxy->set($wallet->getKey(), $newBalance); |
|
55 | 28 | return true; |
|
56 | } |
||
57 | |||
58 | return false; |
||
59 | } |
||
62 |