Passed
Pull Request — main (#55)
by Thierry
05:38
created
app/Ajax/Web/Faker.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     {
51 51
         $count = intval($this->bag('faker')->get('charge.count'));
52 52
         $charges = $this->chargeService->getFakeCharges($count);
53
-        for($i = 0; $i < $count; $i++)
53
+        for ($i = 0; $i < $count; $i++)
54 54
         {
55 55
             $this->jq("#charge_type_$i")->val($charges[$i]->type);
56 56
             $this->jq("#charge_period_$i")->val($charges[$i]->period);
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     {
70 70
         $count = intval($this->bag('faker')->get('pool.count'));
71 71
         $pools = $this->poolService->getFakePools($count);
72
-        for($i = 0; $i < $count; $i++)
72
+        for ($i = 0; $i < $count; $i++)
73 73
         {
74 74
             $this->jq("#pool_title_$i")->val($pools[$i]->title);
75 75
             $this->jq("#pool_amount_$i")->val($pools[$i]->amount);
Please login to merge, or discard this patch.
src/Service/Tontine/TontineService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -185,7 +185,7 @@
 block discarded – undo
185 185
     public function deleteTontine(int $id)
186 186
     {
187 187
         $tontine = $this->tenantService->user()->tontines()->find($id);
188
-        if(!$tontine)
188
+        if (!$tontine)
189 189
         {
190 190
             return;
191 191
         }
Please login to merge, or discard this patch.
src/Service/Tontine/ChargeService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@
 block discarded – undo
141 141
      */
142 142
     public function deleteCharge(Charge $charge)
143 143
     {
144
-        if($charge->bills_count > 0)
144
+        if ($charge->bills_count > 0)
145 145
         {
146 146
             throw new MessageException(trans('tontine.charge.errors.cannot_delete'));
147 147
         }
Please login to merge, or discard this patch.
src/Service/Meeting/Credit/DebtCalculator.php 1 patch
Spacing   +11 added lines, -12 removed lines patch added patch discarded remove patch
@@ -33,19 +33,19 @@  discard block
 block discarded – undo
33 33
      */
34 34
     public function debtIsEditable(Session $session, Debt $debt): bool
35 35
     {
36
-        if(!$session->opened ||
36
+        if (!$session->opened ||
37 37
             ($debt->is_principal && $debt->loan->session->id === $session->id))
38 38
         {
39 39
             // Cannot refund the principal debt in the same session.
40 40
             return false;
41 41
         }
42 42
         // Refunded
43
-        if($debt->refund !== null)
43
+        if ($debt->refund !== null)
44 44
         {
45 45
             // Editable only if refunded in the current session
46 46
             return $debt->refund->session_id === $session->id;
47 47
         }
48
-        if($debt->is_interest && !$debt->loan->fixed_interest)
48
+        if ($debt->is_interest && !$debt->loan->fixed_interest)
49 49
         {
50 50
             // Cannot refund the interest debt before the principal.
51 51
             return $debt->loan->principal_debt->refund !== null;
@@ -112,10 +112,10 @@  discard block
 block discarded – undo
112 112
                 return $refund->session->start_at < $session->start_at;
113 113
             })
114 114
             ->sortBy('session.start_at');
115
-        foreach($partialRefunds as $refund)
115
+        foreach ($partialRefunds as $refund)
116 116
         {
117 117
             $sessionCount = $this->getSessionCount($fromSession, $refund->session);
118
-            $interestAmount += (int)($loanAmount * $interestRate * $sessionCount);
118
+            $interestAmount += (int) ($loanAmount * $interestRate * $sessionCount);
119 119
             // For the next loop
120 120
             $loanAmount -= $refund->amount;
121 121
             $fromSession = $refund->session;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         $lastSession = $this->getLastSession($session, $principalDebt);
125 125
         $sessionCount = $this->getSessionCount($fromSession, $lastSession);
126 126
 
127
-        return $interestAmount + (int)($loanAmount * $interestRate * $sessionCount);
127
+        return $interestAmount + (int) ($loanAmount * $interestRate * $sessionCount);
128 128
     }
129 129
 
130 130
     /**
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
                 return $refund->session->start_at < $session->start_at;
150 150
             })
151 151
             ->sortBy('session.start_at');
152
-        foreach($partialRefunds as $refund)
152
+        foreach ($partialRefunds as $refund)
153 153
         {
154 154
             $sessionCount = $this->getSessionCount($fromSession, $refund->session);
155
-            $interestAmount += (int)($loanAmount * (pow(1 + $interestRate, $sessionCount) - 1));
155
+            $interestAmount += (int) ($loanAmount * (pow(1 + $interestRate, $sessionCount) - 1));
156 156
             // For the next loop
157 157
             $loanAmount -= $refund->amount - $interestAmount;
158 158
             $fromSession = $refund->session;
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
         $lastSession = $this->getLastSession($session, $principalDebt);
162 162
         $sessionCount = $this->getSessionCount($fromSession, $lastSession);
163 163
 
164
-        return $interestAmount + (int)($loanAmount * (pow(1 + $interestRate, $sessionCount) - 1));
164
+        return $interestAmount + (int) ($loanAmount * (pow(1 + $interestRate, $sessionCount) - 1));
165 165
     }
166 166
 
167 167
     /**
@@ -174,14 +174,13 @@  discard block
 block discarded – undo
174 174
      */
175 175
     public function getDebtAmount(Session $session, Debt $debt): int
176 176
     {
177
-        if($debt->is_principal || $debt->refund || $debt->loan->fixed_interest)
177
+        if ($debt->is_principal || $debt->refund || $debt->loan->fixed_interest)
178 178
         {
179 179
             return $debt->amount;
180 180
         }
181 181
 
182 182
         return $debt->loan->simple_interest ?
183
-            $this->getSimpleInterestAmount($session, $debt) :
184
-            $this->getCompoundInterestAmount($session, $debt);
183
+            $this->getSimpleInterestAmount($session, $debt) : $this->getCompoundInterestAmount($session, $debt);
185 184
     }
186 185
 
187 186
     /**
Please login to merge, or discard this patch.
src/Service/Meeting/Cash/DisbursementService.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         $member = $this->getMember($values['member']);
215 215
         $charge = $this->getCharge($values['charge']);
216 216
         $category = $this->getCategory($values['category']);
217
-        if(!$category)
217
+        if (!$category)
218 218
         {
219 219
             throw new MessageException(trans('meeting.category.errors.not_found'));
220 220
         }
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
         $disbursement = new Disbursement();
223 223
         $disbursement->amount = $values['amount'];
224 224
         $disbursement->comment = trim($values['comment']);
225
-        if(($member))
225
+        if (($member))
226 226
         {
227 227
             $disbursement->member()->associate($member);
228 228
         }
229
-        if(($charge))
229
+        if (($charge))
230 230
         {
231 231
             $disbursement->charge_lendable = $charge->lendable;
232 232
             $disbursement->charge()->associate($charge);
@@ -254,19 +254,19 @@  discard block
 block discarded – undo
254 254
         $member = $this->getMember($values['member']);
255 255
         $charge = $this->getCharge($values['charge']);
256 256
         $category = $this->getCategory($values['category']);
257
-        if(!$category)
257
+        if (!$category)
258 258
         {
259 259
             throw new MessageException(trans('meeting.category.errors.not_found'));
260 260
         }
261 261
         $disbursement = $session->disbursements()->find($disbursementId);
262
-        if(!$disbursement)
262
+        if (!$disbursement)
263 263
         {
264 264
             throw new MessageException(trans('meeting.disbursement.errors.not_found'));
265 265
         }
266 266
 
267 267
         $disbursement->amount = $values['amount'];
268 268
         $disbursement->comment = trim($values['comment']);
269
-        if(($member))
269
+        if (($member))
270 270
         {
271 271
             $disbursement->member()->associate($member);
272 272
         }
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
         {
275 275
             $disbursement->member()->dissociate();
276 276
         }
277
-        if(($charge))
277
+        if (($charge))
278 278
         {
279 279
             $disbursement->charge_lendable = $charge->lendable;
280 280
             $disbursement->charge()->associate($charge);
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -230,8 +230,7 @@  discard block
 block discarded – undo
230 230
         {
231 231
             $disbursement->charge_lendable = $charge->lendable;
232 232
             $disbursement->charge()->associate($charge);
233
-        }
234
-        else
233
+        } else
235 234
         {
236 235
             $disbursement->charge_lendable = true;
237 236
         }
@@ -269,8 +268,7 @@  discard block
 block discarded – undo
269 268
         if(($member))
270 269
         {
271 270
             $disbursement->member()->associate($member);
272
-        }
273
-        else
271
+        } else
274 272
         {
275 273
             $disbursement->member()->dissociate();
276 274
         }
@@ -278,8 +276,7 @@  discard block
 block discarded – undo
278 276
         {
279 277
             $disbursement->charge_lendable = $charge->lendable;
280 278
             $disbursement->charge()->associate($charge);
281
-        }
282
-        else
279
+        } else
283 280
         {
284 281
             $disbursement->charge_lendable = true;
285 282
             $disbursement->charge()->dissociate();
Please login to merge, or discard this patch.
src/Service/Planning/SummaryService.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -97,8 +97,7 @@
 block discarded – undo
97 97
         if($pool->remit_auction)
98 98
         {
99 99
             $subscriptions = collect([]);
100
-        }
101
-        else
100
+        } else
102 101
         {
103 102
             $subscriptions = $subscriptions->pluck('member.name', 'id')->sort();
104 103
             $subscriptions->prepend('', 0);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
         $figures = new stdClass();
64 64
         // Expected figures only for pools with fixed deposit amount
65
-        if($pool->remit_planned /*$pool->deposit_fixed*/)
65
+        if ($pool->remit_planned /*$pool->deposit_fixed*/)
66 66
         {
67 67
             $depositCount = $subscriptions->count();
68 68
             $figures->expected = $this->getExpectedFigures($pool, $sessions, $depositCount);
@@ -71,11 +71,10 @@  discard block
 block discarded – undo
71 71
         // Set the subscriptions that will be pay at each session.
72 72
         // Pad with 0's when the beneficiaries are not yet set.
73 73
         $sessions->each(function($session) use($figures, $pool) {
74
-            if($session->enabled($pool))
74
+            if ($session->enabled($pool))
75 75
             {
76 76
                 // Pick the subscriptions ids, and fill with 0's to the max available.
77
-                $remitmentCount = !$pool->deposit_fixed ? 1 :
78
-                    $figures->expected[$session->id]->remitment->count;
77
+                $remitmentCount = !$pool->deposit_fixed ? 1 : $figures->expected[$session->id]->remitment->count;
79 78
                 $session->beneficiaries = $session->payables->map(function($payable) {
80 79
                     return $payable->subscription_id;
81 80
                 })->pad($remitmentCount, 0);
@@ -89,7 +88,7 @@  discard block
 block discarded – undo
89 88
         });
90 89
         $beneficiaries = $beneficiaries->pluck('member.name', 'id');
91 90
         // Do not show the list of subscriptions for pools with auctions
92
-        if($pool->remit_auction)
91
+        if ($pool->remit_auction)
93 92
         {
94 93
             $subscriptions = collect([]);
95 94
         }
Please login to merge, or discard this patch.
src/Service/LocaleService.php 1 patch
Spacing   +8 added lines, -9 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         $localizedCurrencies = include($this->currenciesDataDir . "/{$this->locale}/currency.php");
87 87
 
88 88
         $currencies = [];
89
-        foreach($country['currency'] as $currency)
89
+        foreach ($country['currency'] as $currency)
90 90
         {
91 91
             $currencyCode = $currency['iso_4217_code'];
92 92
             $currencies[$currencyCode] = $localizedCurrencies[$currencyCode];
@@ -108,17 +108,17 @@  discard block
 block discarded – undo
108 108
         $localizedCurrencies = include($this->currenciesDataDir . "/{$this->locale}/currency.php");
109 109
 
110 110
         $countryNames = [];
111
-        foreach($countries as $code)
111
+        foreach ($countries as $code)
112 112
         {
113
-            if(isset($localizedCountries[$code]))
113
+            if (isset($localizedCountries[$code]))
114 114
             {
115 115
                 $countryNames[$code] = $localizedCountries[$code];
116 116
             }
117 117
         }
118 118
         $currencyNames = [];
119
-        foreach($currencies as $code)
119
+        foreach ($currencies as $code)
120 120
         {
121
-            if(isset($localizedCurrencies[$code]))
121
+            if (isset($localizedCurrencies[$code]))
122 122
             {
123 123
                 $currencyNames[$code] = $localizedCurrencies[$code];
124 124
             }
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
      */
168 168
     private function decimalFormatter(): NumberFormatter
169 169
     {
170
-        if($this->formatter === null)
170
+        if ($this->formatter === null)
171 171
         {
172 172
             $this->formatter = new NumberFormatter($this->_locale(), NumberFormatter::DECIMAL);
173 173
             $precision = $this->currency->getPrecision();
@@ -188,8 +188,7 @@  discard block
 block discarded – undo
188 188
     public function formatMoney(int $amount, bool $showSymbol = true): string
189 189
     {
190 190
         $money = new Money($amount, $this->currency);
191
-        return $showSymbol ? $money->formatLocale($this->_locale()) :
192
-            $this->decimalFormatter()->format($money->getValue());
191
+        return $showSymbol ? $money->formatLocale($this->_locale()) : $this->decimalFormatter()->format($money->getValue());
193 192
     }
194 193
 
195 194
     /**
@@ -199,7 +198,7 @@  discard block
 block discarded – undo
199 198
      */
200 199
     public function convertMoneyToInt(float $amount): int
201 200
     {
202
-        return (int)(new Money($amount, $this->currency, true))->getAmount();
201
+        return (int) (new Money($amount, $this->currency, true))->getAmount();
203 202
     }
204 203
 
205 204
     /**
Please login to merge, or discard this patch.
src/Validation/Tontine/MemberValidator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
             'registered_at' => 'nullable|date_format:Y-m-d',
42 42
             'birthday' => 'nullable|date_format:Y-m-d',
43 43
         ]);
44
-        if($validator->fails())
44
+        if ($validator->fails())
45 45
         {
46 46
             throw new ValidationException($validator);
47 47
         }
Please login to merge, or discard this patch.
src/Validation/Tontine/TontineValidator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
             'country_code' => ['required', new CountryCode()],
30 30
             'currency_code' => ['required', new CurrencyCode()],
31 31
         ]);
32
-        if($validator->fails())
32
+        if ($validator->fails())
33 33
         {
34 34
             throw new ValidationException($validator);
35 35
         }
Please login to merge, or discard this patch.