@@ -18,7 +18,7 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | public function lock($self, string $name, \Closure $closure) |
| 20 | 20 | { |
| 21 | - return $this->lockProvider($name, (int)config('wallet.lock.seconds')) |
|
| 21 | + return $this->lockProvider($name, (int) config('wallet.lock.seconds')) |
|
| 22 | 22 | ->get($this->bindTo($self, $closure)); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -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 | |