Completed
Push — master ( e964f8...9c0f53 )
by Moecasts
04:26
created
src/Tax.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
      * @param float $amount
17 17
      * @return float
18 18
      */
19
-    public static function fee(Assemblable $assemblable, Wallet $wallet,float $amount): float
19
+    public static function fee(Assemblable $assemblable, Wallet $wallet, float $amount): float
20 20
     {
21 21
         if ($assemblable instanceof Taxing) {
22 22
             return (float) ($amount * $wallet->coefficient($wallet->currency) * $assemblable->getFeePercent() / 100);
Please login to merge, or discard this patch.
src/Models/Wallet.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
     protected function change(string $type, int $amount, ?array $meta, bool $confirmed): Transaction
70 70
     {
71
-        return DB::transaction(function () use ($type, $amount, $meta, $confirmed) {
71
+        return DB::transaction(function() use ($type, $amount, $meta, $confirmed) {
72 72
             if ($confirmed) {
73 73
                 $this->addBalance($amount);
74 74
             }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     {
105 105
         $this->exists or $this->save();
106 106
 
107
-        if (! WalletProxy::has($this->getKey())) {
107
+        if (!WalletProxy::has($this->getKey())) {
108 108
             $balance = $this->attributes['balance'] / $this->coefficient($this->attributes['currency']);
109 109
             WalletProxy::set($this->getKey(), (float) ($balance ?? 0));
110 110
         }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     {
126 126
         $wallet = $transferable->getReceiptWallet($this->currency);
127 127
 
128
-        return DB::transaction(function () use ($transferable, $amount, $wallet, $meta, $action) {
128
+        return DB::transaction(function() use ($transferable, $amount, $wallet, $meta, $action) {
129 129
             $fee = Tax::fee($transferable, $wallet, $amount);
130 130
             $withdraw = $this->withdraw($amount + $fee, $meta);
131 131
             $deposit = $wallet->deposit($amount, $meta);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
     public function withdraw(float $amount, ?array $meta = null, bool $confirmed = true): Transaction
137 137
     {
138
-        if (! $this->canWithdraw($amount)) {
138
+        if (!$this->canWithdraw($amount)) {
139 139
             throw new InsufficientFunds(trans('wallet::errors.insufficient_funds'));
140 140
         }
141 141
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
     {
178 178
         $wallet = $transferable->getReceiptWallet($this->currency);
179 179
 
180
-        return DB::transaction(function () use ($transferable, $amount, $wallet, $meta, $action) {
180
+        return DB::transaction(function() use ($transferable, $amount, $wallet, $meta, $action) {
181 181
             $fee = Tax::fee($transferable, $wallet, $amount);
182 182
             $withdraw = $this->forceWithdraw($amount + $fee, $meta);
183 183
             $deposit = $wallet->deposit($amount, $meta);
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
 
192 192
         $exchangeRate = config('wallet.exchange.' . $this->currency . '.' . $currency);
193 193
 
194
-        if (! $exchangeRate ||
195
-            ! $this->holder instanceof Exchangeable) {
194
+        if (!$exchangeRate ||
195
+            !$this->holder instanceof Exchangeable) {
196 196
             throw new ExchangeInvalid(trans('wallet::errors.exchange_unsupported'));
197 197
         }
198 198
 
199 199
         $exchangedAmount = $amount * $exchangeRate;
200 200
 
201
-        return DB::transaction(function () use ($wallet, $amount, $exchangedAmount, $meta, $action) {
201
+        return DB::transaction(function() use ($wallet, $amount, $exchangedAmount, $meta, $action) {
202 202
             $fee = Tax::fee($this->holder, $wallet, $amount);
203 203
             $withdraw = $this->withdraw($amount + $fee, $meta);
204 204
             $deposit = $wallet->deposit($exchangedAmount, $meta);
@@ -221,13 +221,13 @@  discard block
 block discarded – undo
221 221
 
222 222
         $exchangeRate = config('wallet.exchange.' . $this->currency . '.' . $currency);
223 223
 
224
-        if (! $exchangeRate) {
224
+        if (!$exchangeRate) {
225 225
             throw new ExchangeInvalid(trans('wallet::errors.exchange_unsupported'));
226 226
         }
227 227
 
228 228
         $exchangedAmount = $amount * $exchangeRate;
229 229
 
230
-        return DB::transaction(function () use ($wallet, $amount, $exchangedAmount, $meta, $action) {
230
+        return DB::transaction(function() use ($wallet, $amount, $exchangedAmount, $meta, $action) {
231 231
             $fee = Tax::fee($this->holder, $wallet, $amount);
232 232
             $withdraw = $this->forceWithdraw($amount + $fee, $meta);
233 233
             $deposit = $wallet->deposit($exchangedAmount, $meta);
@@ -256,6 +256,6 @@  discard block
 block discarded – undo
256 256
 
257 257
     public function coefficient(string $currency = ''): float
258 258
     {
259
-        return config('wallet.coefficient.' . $currency , 100.);
259
+        return config('wallet.coefficient.' . $currency, 100.);
260 260
     }
261 261
 }
Please login to merge, or discard this patch.