From aed8da779024fd80a41ee876a850bb85ebbadeb2 Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Mon, 29 Jul 2019 11:22:17 +0000 Subject: [PATCH] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- src/Commands/RefreshBalance.php | 4 ++-- src/Services/CommonService.php | 2 +- src/Services/WalletService.php | 4 ++-- src/Traits/CanConfirm.php | 4 ++-- src/Traits/CanExchange.php | 2 +- src/Traits/CartPay.php | 6 +++--- src/Traits/HasGift.php | 2 +- src/Traits/HasWallet.php | 6 +++--- src/Traits/HasWallets.php | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Commands/RefreshBalance.php b/src/Commands/RefreshBalance.php index 3f73f12c9..3024ad9e7 100644 --- a/src/Commands/RefreshBalance.php +++ b/src/Commands/RefreshBalance.php @@ -34,7 +34,7 @@ class RefreshBalance extends Command */ public function handle(): void { - DB::transaction(static function () { + DB::transaction(static function() { $wallet = config('wallet.wallet.table'); $trans = config('wallet.transaction.table'); @@ -43,7 +43,7 @@ public function handle(): void ->where('confirmed', true) ->groupBy('wallet_id'); - $joinClause = static function (JoinClause $join) use ($wallet) { + $joinClause = static function(JoinClause $join) use ($wallet) { $join->on("$wallet.id", '=', 'b.wallet_id'); }; diff --git a/src/Services/CommonService.php b/src/Services/CommonService.php index 7d3755abb..9850e8170 100644 --- a/src/Services/CommonService.php +++ b/src/Services/CommonService.php @@ -173,7 +173,7 @@ public function multiOperation(Wallet $self, array $operations): array public function assemble(array $brings): array { $self = $this; - return DB::transaction(static function () use ($self, $brings) { + return DB::transaction(static function() use ($self, $brings) { return $self->multiBrings($brings); }); } diff --git a/src/Services/WalletService.php b/src/Services/WalletService.php index 578e7830a..1c4e13ca2 100644 --- a/src/Services/WalletService.php +++ b/src/Services/WalletService.php @@ -35,7 +35,7 @@ public function fee(Wallet $wallet, int $amount): int $result = 0; if ($wallet instanceof Taxable) { - $result = (int)($amount * $wallet->getFeePercent() / 100); + $result = (int) ($amount * $wallet->getFeePercent() / 100); /** * Added minimum commission condition @@ -97,7 +97,7 @@ public function getBalance(Wallet $object): int $wallet = $this->getWallet($object); $proxy = app(ProxyService::class); if (!$proxy->has($wallet->getKey())) { - $proxy->set($wallet->getKey(), (int)$wallet->getOriginal('balance', 0)); + $proxy->set($wallet->getKey(), (int) $wallet->getOriginal('balance', 0)); } return $proxy[$wallet->getKey()]; diff --git a/src/Traits/CanConfirm.php b/src/Traits/CanConfirm.php index 2307d78ba..44924f802 100644 --- a/src/Traits/CanConfirm.php +++ b/src/Traits/CanConfirm.php @@ -20,7 +20,7 @@ trait CanConfirm public function confirm(Transaction $transaction): bool { $self = $this; - return DB::transaction(static function () use ($self, $transaction) { + return DB::transaction(static function() use ($self, $transaction) { $wallet = app(WalletService::class) ->getWallet($self); @@ -63,7 +63,7 @@ public function safeConfirm(Transaction $transaction): bool public function forceConfirm(Transaction $transaction): bool { $self = $this; - return DB::transaction(static function () use ($self, $transaction) { + return DB::transaction(static function() use ($self, $transaction) { $wallet = app(WalletService::class) ->getWallet($self); diff --git a/src/Traits/CanExchange.php b/src/Traits/CanExchange.php index 8b90f67ac..54709a43f 100644 --- a/src/Traits/CanExchange.php +++ b/src/Traits/CanExchange.php @@ -49,7 +49,7 @@ public function forceExchange(Wallet $to, int $amount, ?array $meta = null): Tra */ $from = app(WalletService::class)->getWallet($this); - return DB::transaction(static function () use ($from, $to, $amount, $meta) { + return DB::transaction(static function() use ($from, $to, $amount, $meta) { $rate = app(ExchangeService::class)->rate($from, $to); $fee = app(WalletService::class)->fee($to, $amount); diff --git a/src/Traits/CartPay.php b/src/Traits/CartPay.php index 475475354..4e6db7ce8 100644 --- a/src/Traits/CartPay.php +++ b/src/Traits/CartPay.php @@ -32,7 +32,7 @@ public function payFreeCart(Cart $cart): array ->verifyWithdraw($this, 0); $self = $this; - return DB::transaction(static function () use ($self, $cart) { + return DB::transaction(static function() use ($self, $cart) { $results = []; foreach ($cart->getItems() as $product) { $results[] = app(CommonService::class)->forceTransfer( @@ -75,7 +75,7 @@ public function payCart(Cart $cart, bool $force = null): array } $self = $this; - return DB::transaction(static function () use ($self, $cart, $force) { + return DB::transaction(static function() use ($self, $cart, $force) { $results = []; foreach ($cart->getItems() as $product) { if ($force) { @@ -138,7 +138,7 @@ public function safeRefundCart(Cart $cart, bool $force = null, bool $gifts = nul public function refundCart(Cart $cart, bool $force = null, bool $gifts = null): bool { $self = $this; - return DB::transaction(static function () use ($self, $cart, $force, $gifts) { + return DB::transaction(static function() use ($self, $cart, $force, $gifts) { $results = []; $transfers = $cart->alreadyBuy($self, $gifts); if (count($transfers) !== count($cart)) { diff --git a/src/Traits/HasGift.php b/src/Traits/HasGift.php index ae6984ea0..fe1c6eab0 100644 --- a/src/Traits/HasGift.php +++ b/src/Traits/HasGift.php @@ -61,7 +61,7 @@ public function gift(Wallet $to, Product $product, bool $force = null): Transfer * I think it is wrong to make the "assemble" method public. * That's why I address him like this! */ - return DB::transaction(static function () use ($santa, $to, $product, $force) { + return DB::transaction(static function() use ($santa, $to, $product, $force) { $amount = $product->getAmountProduct(); $meta = $product->getMetaProduct(); $fee = app(WalletService::class) diff --git a/src/Traits/HasWallet.php b/src/Traits/HasWallet.php index 9ea80c84a..c787df0aa 100644 --- a/src/Traits/HasWallet.php +++ b/src/Traits/HasWallet.php @@ -40,7 +40,7 @@ trait HasWallet public function deposit(int $amount, ?array $meta = null, bool $confirmed = true): Transaction { $self = $this; - return DB::transaction(static function () use ($self, $amount, $meta, $confirmed) { + return DB::transaction(static function() use ($self, $amount, $meta, $confirmed) { return app(CommonService::class) ->deposit($self, $amount, $meta, $confirmed); }); @@ -156,7 +156,7 @@ public function canWithdraw(int $amount): bool public function forceWithdraw(int $amount, ?array $meta = null, bool $confirmed = true): Transaction { $self = $this; - return DB::transaction(static function () use ($self, $amount, $meta, $confirmed) { + return DB::transaction(static function() use ($self, $amount, $meta, $confirmed) { return app(CommonService::class) ->forceWithdraw($self, $amount, $meta, $confirmed); }); @@ -174,7 +174,7 @@ public function forceWithdraw(int $amount, ?array $meta = null, bool $confirmed public function forceTransfer(Wallet $wallet, int $amount, ?array $meta = null): Transfer { $self = $this; - return DB::transaction(static function () use ($self, $amount, $wallet, $meta) { + return DB::transaction(static function() use ($self, $amount, $wallet, $meta) { return app(CommonService::class) ->forceTransfer($self, $wallet, $amount, $meta); }); diff --git a/src/Traits/HasWallets.php b/src/Traits/HasWallets.php index 87e07d75c..7037d1b56 100644 --- a/src/Traits/HasWallets.php +++ b/src/Traits/HasWallets.php @@ -105,7 +105,7 @@ public function createWallet(array $data): WalletModel */ public function hasWallet(string $slug): bool { - return (bool)$this->getWallet($slug); + return (bool) $this->getWallet($slug); } }