@@ -57,7 +57,7 @@ |
||
57 | 57 | */ |
58 | 58 | protected function sqliteUpdate(): void |
59 | 59 | { |
60 | - Wallet::query()->each(static function (Wallet $wallet) { |
|
60 | + Wallet::query()->each(static function(Wallet $wallet) { |
|
61 | 61 | $wallet->refreshBalance(); |
62 | 62 | }); |
63 | 63 | } |
@@ -113,7 +113,7 @@ |
||
113 | 113 | */ |
114 | 114 | public function refresh(WalletModel $wallet): bool |
115 | 115 | { |
116 | - return app(LockService::class)->lock($this, __FUNCTION__, function () use ($wallet) { |
|
116 | + return app(LockService::class)->lock($this, __FUNCTION__, function() use ($wallet) { |
|
117 | 117 | $this->getBalance($wallet); |
118 | 118 | $balance = $wallet->getAvailableBalance(); |
119 | 119 | $wallet->balance = $balance; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function transfer(Wallet $from, Wallet $to, int $amount, ?array $meta = null, string $status = Transfer::STATUS_TRANSFER): Transfer |
30 | 30 | { |
31 | - return app(LockService::class)->lock($this, __FUNCTION__, function () use ($from, $to, $amount, $meta, $status) { |
|
31 | + return app(LockService::class)->lock($this, __FUNCTION__, function() use ($from, $to, $amount, $meta, $status) { |
|
32 | 32 | $this->verifyWithdraw($from, $amount); |
33 | 33 | return $this->forceTransfer($from, $to, $amount, $meta, $status); |
34 | 34 | }); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function forceTransfer(Wallet $from, Wallet $to, int $amount, ?array $meta = null, string $status = Transfer::STATUS_TRANSFER): Transfer |
46 | 46 | { |
47 | - return app(LockService::class)->lock($this, __FUNCTION__, function () use ($from, $to, $amount, $meta, $status) { |
|
47 | + return app(LockService::class)->lock($this, __FUNCTION__, function() use ($from, $to, $amount, $meta, $status) { |
|
48 | 48 | $fee = app(WalletService::class)->fee($to, $amount); |
49 | 49 | $withdraw = $this->forceWithdraw($from, $amount + $fee, $meta); |
50 | 50 | $deposit = $this->deposit($to, $amount, $meta); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function forceWithdraw(Wallet $wallet, int $amount, ?array $meta, bool $confirmed = true): Transaction |
76 | 76 | { |
77 | - return app(LockService::class)->lock($this, __FUNCTION__, function () use ($wallet, $amount, $meta, $confirmed) { |
|
77 | + return app(LockService::class)->lock($this, __FUNCTION__, function() use ($wallet, $amount, $meta, $confirmed) { |
|
78 | 78 | $walletService = app(WalletService::class); |
79 | 79 | $walletService->checkAmount($amount); |
80 | 80 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function deposit(Wallet $wallet, int $amount, ?array $meta, bool $confirmed = true): Transaction |
106 | 106 | { |
107 | - return app(LockService::class)->lock($this, __FUNCTION__, function () use ($wallet, $amount, $meta, $confirmed) { |
|
107 | + return app(LockService::class)->lock($this, __FUNCTION__, function() use ($wallet, $amount, $meta, $confirmed) { |
|
108 | 108 | $walletService = app(WalletService::class); |
109 | 109 | $walletService->checkAmount($amount); |
110 | 110 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function multiOperation(Wallet $self, array $operations): array |
158 | 158 | { |
159 | - return app(LockService::class)->lock($this, __FUNCTION__, function () use ($self, $operations) { |
|
159 | + return app(LockService::class)->lock($this, __FUNCTION__, function() use ($self, $operations) { |
|
160 | 160 | $amount = 0; |
161 | 161 | $objects = []; |
162 | 162 | foreach ($operations as $operation) { |
@@ -183,9 +183,9 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public function assemble(array $brings): array |
185 | 185 | { |
186 | - return app(LockService::class)->lock($this, __FUNCTION__, function () use ($brings) { |
|
186 | + return app(LockService::class)->lock($this, __FUNCTION__, function() use ($brings) { |
|
187 | 187 | $self = $this; |
188 | - return DB::transaction(static function () use ($self, $brings) { |
|
188 | + return DB::transaction(static function() use ($self, $brings) { |
|
189 | 189 | return $self->multiBrings($brings); |
190 | 190 | }); |
191 | 191 | }); |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | */ |
200 | 200 | public function multiBrings(array $brings): array |
201 | 201 | { |
202 | - return app(LockService::class)->lock($this, __FUNCTION__, function () use ($brings) { |
|
202 | + return app(LockService::class)->lock($this, __FUNCTION__, function() use ($brings) { |
|
203 | 203 | $objects = []; |
204 | 204 | foreach ($brings as $bring) { |
205 | 205 | $objects[] = $bring->create(); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | public function addBalance(Wallet $wallet, int $amount): bool |
219 | 219 | { |
220 | - return app(LockService::class)->lock($this, __FUNCTION__, static function () use ($wallet, $amount) { |
|
220 | + return app(LockService::class)->lock($this, __FUNCTION__, static function() use ($wallet, $amount) { |
|
221 | 221 | /** |
222 | 222 | * @var ProxyService $proxy |
223 | 223 | * @var WalletModel $wallet |
@@ -50,8 +50,8 @@ |
||
50 | 50 | */ |
51 | 51 | $from = app(WalletService::class)->getWallet($this); |
52 | 52 | |
53 | - return app(LockService::class)->lock($this, __FUNCTION__, function () use ($from, $to, $amount, $meta) { |
|
54 | - return DB::transaction(static function () use ($from, $to, $amount, $meta) { |
|
53 | + return app(LockService::class)->lock($this, __FUNCTION__, function() use ($from, $to, $amount, $meta) { |
|
54 | + return DB::transaction(static function() use ($from, $to, $amount, $meta) { |
|
55 | 55 | $rate = app(ExchangeService::class)->rate($from, $to); |
56 | 56 | $fee = app(WalletService::class)->fee($to, $amount); |
57 | 57 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function confirm(Transaction $transaction): bool |
22 | 22 | { |
23 | - return app(LockService::class)->lock($this, __FUNCTION__, function () use ($transaction) { |
|
23 | + return app(LockService::class)->lock($this, __FUNCTION__, function() use ($transaction) { |
|
24 | 24 | $self = $this; |
25 | 25 | return DB::transaction(static function() use ($self, $transaction) { |
26 | 26 | $wallet = app(WalletService::class) |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function forceConfirm(Transaction $transaction): bool |
67 | 67 | { |
68 | - return app(LockService::class)->lock($this, __FUNCTION__, function () use ($transaction) { |
|
68 | + return app(LockService::class)->lock($this, __FUNCTION__, function() use ($transaction) { |
|
69 | 69 | $self = $this; |
70 | - return DB::transaction(static function () use ($self, $transaction) { |
|
70 | + return DB::transaction(static function() use ($self, $transaction) { |
|
71 | 71 | |
72 | 72 | $wallet = app(WalletService::class) |
73 | 73 | ->getWallet($self); |
@@ -19,7 +19,7 @@ |
||
19 | 19 | */ |
20 | 20 | public function lock($self, string $name, \Closure $closure) |
21 | 21 | { |
22 | - return $this->lockProvider($self, $name, (int)config('wallet.lock.seconds')) |
|
22 | + return $this->lockProvider($self, $name, (int) config('wallet.lock.seconds')) |
|
23 | 23 | ->get($this->bindTo($self, $closure)); |
24 | 24 | } |
25 | 25 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public function forceWithdrawFloat(float $amount, ?array $meta = null, bool $confirmed = true): Transaction |
29 | 29 | { |
30 | 30 | $decimalPlaces = app(WalletService::class)->decimalPlaces($this); |
31 | - return $this->forceWithdraw((int)round($amount * $decimalPlaces), $meta, $confirmed); |
|
31 | + return $this->forceWithdraw((int) round($amount * $decimalPlaces), $meta, $confirmed); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public function depositFloat(float $amount, ?array $meta = null, bool $confirmed = true): Transaction |
42 | 42 | { |
43 | 43 | $decimalPlaces = app(WalletService::class)->decimalPlaces($this); |
44 | - return $this->deposit((int)round($amount * $decimalPlaces), $meta, $confirmed); |
|
44 | + return $this->deposit((int) round($amount * $decimalPlaces), $meta, $confirmed); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | public function withdrawFloat(float $amount, ?array $meta = null, bool $confirmed = true): Transaction |
55 | 55 | { |
56 | 56 | $decimalPlaces = app(WalletService::class)->decimalPlaces($this); |
57 | - return $this->withdraw((int)round($amount * $decimalPlaces), $meta, $confirmed); |
|
57 | + return $this->withdraw((int) round($amount * $decimalPlaces), $meta, $confirmed); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | public function canWithdrawFloat(float $amount): bool |
65 | 65 | { |
66 | 66 | $decimalPlaces = app(WalletService::class)->decimalPlaces($this); |
67 | - return $this->canWithdraw((int)round($amount * $decimalPlaces)); |
|
67 | + return $this->canWithdraw((int) round($amount * $decimalPlaces)); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | public function transferFloat(Wallet $wallet, float $amount, ?array $meta = null): Transfer |
78 | 78 | { |
79 | 79 | $decimalPlaces = app(WalletService::class)->decimalPlaces($this); |
80 | - return $this->transfer($wallet, (int)round($amount * $decimalPlaces), $meta); |
|
80 | + return $this->transfer($wallet, (int) round($amount * $decimalPlaces), $meta); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | public function safeTransferFloat(Wallet $wallet, float $amount, ?array $meta = null): ?Transfer |
90 | 90 | { |
91 | 91 | $decimalPlaces = app(WalletService::class)->decimalPlaces($this); |
92 | - return $this->safeTransfer($wallet, (int)round($amount * $decimalPlaces), $meta); |
|
92 | + return $this->safeTransfer($wallet, (int) round($amount * $decimalPlaces), $meta); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | public function forceTransferFloat(Wallet $wallet, float $amount, ?array $meta = null): Transfer |
102 | 102 | { |
103 | 103 | $decimalPlaces = app(WalletService::class)->decimalPlaces($this); |
104 | - return $this->forceTransfer($wallet, (int)round($amount * $decimalPlaces), $meta); |
|
104 | + return $this->forceTransfer($wallet, (int) round($amount * $decimalPlaces), $meta); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -51,7 +51,7 @@ |
||
51 | 51 | */ |
52 | 52 | public function gift(Wallet $to, Product $product, bool $force = null): Transfer |
53 | 53 | { |
54 | - return app(LockService::class)->lock($this, __FUNCTION__, function () use ($to, $product, $force) { |
|
54 | + return app(LockService::class)->lock($this, __FUNCTION__, function() use ($to, $product, $force) { |
|
55 | 55 | /** |
56 | 56 | * Who's giving? Let's call him Santa Claus |
57 | 57 | * @var Wallet $santa |