@@ -71,7 +71,7 @@ |
||
| 71 | 71 | */ |
| 72 | 72 | public function getTable(): string |
| 73 | 73 | { |
| 74 | - if (! $this->table) { |
|
| 74 | + if (!$this->table) { |
|
| 75 | 75 | $this->table = config('wallet.transaction.table', 'transactions'); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function getTable(): string |
| 75 | 75 | { |
| 76 | - if (! $this->table) { |
|
| 76 | + if (!$this->table) { |
|
| 77 | 77 | $this->table = config('wallet.wallet.table', 'wallets'); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * Must be updated only if the model does not exist |
| 93 | 93 | * or the slug is empty. |
| 94 | 94 | */ |
| 95 | - if (! $this->exists && ! array_key_exists('slug', $this->attributes)) { |
|
| 95 | + if (!$this->exists && !array_key_exists('slug', $this->attributes)) { |
|
| 96 | 96 | $this->attributes['slug'] = Str::slug($name); |
| 97 | 97 | } |
| 98 | 98 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public function lock($self, string $name, \Closure $closure) |
| 35 | 35 | { |
| 36 | - return $this->lockProvider($self, $name, (int) config('wallet.lock.seconds', 1)) |
|
| 36 | + return $this->lockProvider($self, $name, (int)config('wallet.lock.seconds', 1)) |
|
| 37 | 37 | ->get($this->bindTo($self, $closure)); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | protected function bindTo($self, \Closure $closure): \Closure |
| 47 | 47 | { |
| 48 | 48 | $reflect = new \ReflectionFunction($closure); |
| 49 | - if (strpos((string) $reflect, 'static') === false) { |
|
| 49 | + if (strpos((string)$reflect, 'static') === false) { |
|
| 50 | 50 | return $closure->bindTo($self); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -82,9 +82,9 @@ discard block |
||
| 82 | 82 | // @codeCoverageIgnoreStart |
| 83 | 83 | if ($enabled && $store instanceof LockProvider) { |
| 84 | 84 | $class = \get_class($self); |
| 85 | - $uniqId = $class.$this->uniqId; |
|
| 85 | + $uniqId = $class . $this->uniqId; |
|
| 86 | 86 | if ($self instanceof Model) { |
| 87 | - $uniqId = $class.$self->getKey(); |
|
| 87 | + $uniqId = $class . $self->getKey(); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | return $store->lock("$name.$uniqId", $seconds); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | $wallet = $object; |
| 114 | 114 | |
| 115 | - if (! ($object instanceof WalletModel)) { |
|
| 115 | + if (!($object instanceof WalletModel)) { |
|
| 116 | 116 | /** |
| 117 | 117 | * @var HasWallet $object |
| 118 | 118 | */ |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $wallet->balance = $balance; |
| 141 | 141 | |
| 142 | 142 | return app(Storable::class)->setBalance($wallet, $balance) && |
| 143 | - (! $math->compare($whatIs, $balance) || $wallet->save()); |
|
| 143 | + (!$math->compare($whatIs, $balance) || $wallet->save()); |
|
| 144 | 144 | }); |
| 145 | 145 | } |
| 146 | 146 | } |
@@ -148,11 +148,11 @@ discard block |
||
| 148 | 148 | /** |
| 149 | 149 | * @var HasWallet $wallet |
| 150 | 150 | */ |
| 151 | - if ($amount && ! $wallet->balance) { |
|
| 151 | + if ($amount && !$wallet->balance) { |
|
| 152 | 152 | throw new BalanceIsEmpty(trans('wallet::errors.wallet_empty')); |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - if (! $wallet->canWithdraw($amount, $allowZero)) { |
|
| 155 | + if (!$wallet->canWithdraw($amount, $allowZero)) { |
|
| 156 | 156 | throw new InsufficientFunds(trans('wallet::errors.insufficient_funds')); |
| 157 | 157 | } |
| 158 | 158 | } |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | throw $throwable; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - if (! $result) { |
|
| 249 | + if (!$result) { |
|
| 250 | 250 | app(Storable::class) |
| 251 | 251 | ->setBalance($wallet, $wallet->getAvailableBalance()); |
| 252 | 252 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | public function add($first, $second, ?int $scale = null): string |
| 23 | 23 | { |
| 24 | - return (string) BigDecimal::of($first) |
|
| 24 | + return (string)BigDecimal::of($first) |
|
| 25 | 25 | ->plus(BigDecimal::of($second)) |
| 26 | 26 | ->toScale($this->scale($scale), RoundingMode::DOWN); |
| 27 | 27 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function sub($first, $second, ?int $scale = null): string |
| 33 | 33 | { |
| 34 | - return (string) BigDecimal::of($first) |
|
| 34 | + return (string)BigDecimal::of($first) |
|
| 35 | 35 | ->minus(BigDecimal::of($second)) |
| 36 | 36 | ->toScale($this->scale($scale), RoundingMode::DOWN); |
| 37 | 37 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function div($first, $second, ?int $scale = null): string |
| 43 | 43 | { |
| 44 | - return (string) BigDecimal::of($first) |
|
| 44 | + return (string)BigDecimal::of($first) |
|
| 45 | 45 | ->dividedBy(BigDecimal::of($second), $this->scale($scale), RoundingMode::DOWN); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function mul($first, $second, ?int $scale = null): string |
| 52 | 52 | { |
| 53 | - return (string) BigDecimal::of($first) |
|
| 53 | + return (string)BigDecimal::of($first) |
|
| 54 | 54 | ->multipliedBy(BigDecimal::of($second)) |
| 55 | 55 | ->toScale($this->scale($scale), RoundingMode::DOWN); |
| 56 | 56 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public function pow($first, $second, ?int $scale = null): string |
| 62 | 62 | { |
| 63 | - return (string) BigDecimal::of($first) |
|
| 63 | + return (string)BigDecimal::of($first) |
|
| 64 | 64 | ->power($second) |
| 65 | 65 | ->toScale($this->scale($scale), RoundingMode::DOWN); |
| 66 | 66 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function ceil($number): string |
| 72 | 72 | { |
| 73 | - return (string) BigDecimal::of($number) |
|
| 73 | + return (string)BigDecimal::of($number) |
|
| 74 | 74 | ->dividedBy(BigDecimal::one(), 0, RoundingMode::CEILING); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function floor($number): string |
| 81 | 81 | { |
| 82 | - return (string) BigDecimal::of($number) |
|
| 82 | + return (string)BigDecimal::of($number) |
|
| 83 | 83 | ->dividedBy(BigDecimal::one(), 0, RoundingMode::FLOOR); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function round($number, int $precision = 0): string |
| 90 | 90 | { |
| 91 | - return (string) BigDecimal::of($number) |
|
| 91 | + return (string)BigDecimal::of($number) |
|
| 92 | 92 | ->dividedBy(BigDecimal::one(), $precision, RoundingMode::HALF_UP); |
| 93 | 93 | } |
| 94 | 94 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function abs($number): string |
| 100 | 100 | { |
| 101 | - return (string) BigDecimal::of($number)->abs(); |
|
| 101 | + return (string)BigDecimal::of($number)->abs(); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | protected function scale(?int $scale = null): int |
| 117 | 117 | { |
| 118 | 118 | if ($this->scale === null) { |
| 119 | - $this->scale = (int) config('wallet.math.scale', 64); |
|
| 119 | + $this->scale = (int)config('wallet.math.scale', 64); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | return $scale ?? $this->scale; |