Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
29 | 68 | public function incBalance($object, int $amount): int |
|
30 | { |
||
31 | 68 | $wallet = app(WalletService::class)->getWallet($object); |
|
32 | 68 | $proxy = app(ProxyService::class); |
|
33 | 68 | $balance = $wallet->balance + $amount; |
|
34 | |||
35 | 68 | if ($proxy->has($wallet->getKey())) { |
|
36 | 68 | $balance = $proxy->get($wallet->getKey()) + $amount; |
|
37 | } |
||
38 | |||
39 | 68 | $this->setBalance($object, $balance); |
|
40 | 68 | return $balance; |
|
41 | } |
||
54 |