@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | 'interest' => 'required|regex:/^\d+(\.\d{1,2})?$/', |
| 32 | 32 | ]); |
| 33 | 33 | $validator->after(function($validator) use($values) { |
| 34 | - if((float)$values['principal'] <= 0) |
|
| 34 | + if ((float) $values['principal'] <= 0) |
|
| 35 | 35 | { |
| 36 | 36 | $validator->errors()->add('principal', trans('validation.gt.numeric', [ |
| 37 | 37 | 'attribute' => trans('meeting.loan.labels.principal'), |
@@ -39,19 +39,18 @@ discard block |
||
| 39 | 39 | ])); |
| 40 | 40 | } |
| 41 | 41 | }); |
| 42 | - if($validator->fails()) |
|
| 42 | + if ($validator->fails()) |
|
| 43 | 43 | { |
| 44 | 44 | throw new ValidationException($validator); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | $validated = $validator->validated(); |
| 48 | - $validated['principal'] = $this->localeService->convertMoneyToInt((float)$validated['principal']); |
|
| 48 | + $validated['principal'] = $this->localeService->convertMoneyToInt((float) $validated['principal']); |
|
| 49 | 49 | // Interest rates must be saved as int, so the value is multiplied by 100. |
| 50 | 50 | $validated['interest_rate'] = $validated['interest_type'] === 'f' ? |
| 51 | - 0 : (int)(100 * $validated['interest']); |
|
| 51 | + 0 : (int) (100 * $validated['interest']); |
|
| 52 | 52 | $validated['interest'] = $validated['interest_type'] === 'f' ? |
| 53 | - $this->localeService->convertMoneyToInt((float)$validated['interest']) : |
|
| 54 | - (int)($validated['principal'] * $validated['interest'] / 100); |
|
| 53 | + $this->localeService->convertMoneyToInt((float) $validated['interest']) : (int) ($validated['principal'] * $validated['interest'] / 100); |
|
| 55 | 54 | |
| 56 | 55 | return $validated; |
| 57 | 56 | } |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | protected static function booted() |
| 33 | 33 | { |
| 34 | 34 | // Scope for user defined funds. Always applied by default. |
| 35 | - static::addGlobalScope('user', function (Builder $builder) { |
|
| 35 | + static::addGlobalScope('user', function(Builder $builder) { |
|
| 36 | 36 | $builder->where('title', '<>', ''); |
| 37 | 37 | }); |
| 38 | 38 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | 'notes' => 'nullable|string', |
| 21 | 21 | ]); |
| 22 | 22 | |
| 23 | - if($validator->fails()) |
|
| 23 | + if ($validator->fails()) |
|
| 24 | 24 | { |
| 25 | 25 | throw new ValidationException($validator); |
| 26 | 26 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function getReceivableAmount(Receivable $receivable): int |
| 39 | 39 | { |
| 40 | - if($receivable->subscription->pool->deposit_fixed) |
|
| 40 | + if ($receivable->subscription->pool->deposit_fixed) |
|
| 41 | 41 | { |
| 42 | 42 | return $receivable->subscription->pool->amount; |
| 43 | 43 | } |
@@ -88,8 +88,7 @@ discard block |
||
| 88 | 88 | ->where('receivables.session_id', $session->id) |
| 89 | 89 | ->where('subscriptions.pool_id', $pool->id); |
| 90 | 90 | |
| 91 | - return !$pool->deposit_fixed ? $query->sum('deposits.amount') : |
|
| 92 | - $pool->amount * $query->count(); |
|
| 91 | + return !$pool->deposit_fixed ? $query->sum('deposits.amount') : $pool->amount * $query->count(); |
|
| 93 | 92 | } |
| 94 | 93 | |
| 95 | 94 | /** |
@@ -100,7 +99,7 @@ discard block |
||
| 100 | 99 | */ |
| 101 | 100 | public function getPayableAmount(Pool $pool, Session $session): int |
| 102 | 101 | { |
| 103 | - if(!$pool->deposit_fixed) |
|
| 102 | + if (!$pool->deposit_fixed) |
|
| 104 | 103 | { |
| 105 | 104 | // Sum the amounts for all deposits |
| 106 | 105 | return $this->getPoolDepositAmount($pool, $session); |
@@ -124,7 +123,7 @@ discard block |
||
| 124 | 123 | */ |
| 125 | 124 | public function getPoolRemitmentAmount(Pool $pool, Session $session): int |
| 126 | 125 | { |
| 127 | - if(!$pool->deposit_fixed) |
|
| 126 | + if (!$pool->deposit_fixed) |
|
| 128 | 127 | { |
| 129 | 128 | // Sum the amounts for all deposits |
| 130 | 129 | return $this->getPoolDepositAmount($pool, $session); |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function getFund(int $fundId, bool $onlyActive = false, bool $withDefault = false): ?Fund |
| 90 | 90 | { |
| 91 | - if($withDefault && $fundId === $this->tenantService->tontine()->default_fund->id) |
|
| 91 | + if ($withDefault && $fundId === $this->tenantService->tontine()->default_fund->id) |
|
| 92 | 92 | { |
| 93 | 93 | return $this->getDefaultFund(); |
| 94 | 94 | } |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | * |
| 165 | 165 | * @return Builder|Relation |
| 166 | 166 | */ |
| 167 | - private function getFundSessionsQuery(Session $currentSession, Fund $fund): Builder|Relation |
|
| 167 | + private function getFundSessionsQuery(Session $currentSession, Fund $fund): Builder | Relation |
|
| 168 | 168 | { |
| 169 | 169 | // Will return all the tontine sessions, |
| 170 | 170 | // or all those after the last closing, if there's any. |
@@ -175,12 +175,12 @@ discard block |
||
| 175 | 175 | // The closing sessions before te current session. |
| 176 | 176 | $closingSessions = $this->tenantService->tontine()->sessions() |
| 177 | 177 | ->whereDate('start_at', '<', $lastSessionDate) |
| 178 | - ->whereHas('closings', function(Builder|Relation $query) use($fund) { |
|
| 178 | + ->whereHas('closings', function(Builder | Relation $query) use($fund) { |
|
| 179 | 179 | $query->round()->where('fund_id', $fund->id); |
| 180 | 180 | }) |
| 181 | 181 | ->orderByDesc('start_at') |
| 182 | 182 | ->get(); |
| 183 | - if($closingSessions->count() === 0) |
|
| 183 | + if ($closingSessions->count() === 0) |
|
| 184 | 184 | { |
| 185 | 185 | // All the closing sessions are after the current session. |
| 186 | 186 | return $sessionsQuery; |
@@ -60,10 +60,10 @@ discard block |
||
| 60 | 60 | private function getRefundFilter(Session $current, bool $withCurrent): Closure |
| 61 | 61 | { |
| 62 | 62 | return $withCurrent ? |
| 63 | - function(PartialRefund|Refund $refund) use($current) { |
|
| 63 | + function(PartialRefund | Refund $refund) use($current) { |
|
| 64 | 64 | return $refund->session->start_at <= $current->start_at; |
| 65 | 65 | } : |
| 66 | - function(PartialRefund|Refund $refund) use($current) { |
|
| 66 | + function(PartialRefund | Refund $refund) use($current) { |
|
| 67 | 67 | return $refund->session->start_at < $current->start_at; |
| 68 | 68 | }; |
| 69 | 69 | } |
@@ -121,10 +121,10 @@ discard block |
||
| 121 | 121 | // Take refunds before the end session and sort by session date. |
| 122 | 122 | $partialRefunds = $this->getPartialRefunds($principalDebt, $endSession, false) |
| 123 | 123 | ->sortBy('session.start_at'); |
| 124 | - foreach($partialRefunds as $refund) |
|
| 124 | + foreach ($partialRefunds as $refund) |
|
| 125 | 125 | { |
| 126 | 126 | $sessionCount = $this->getSessionCount($startSession, $refund->session); |
| 127 | - $interestAmount += (int)($loanAmount * $interestRate * $sessionCount); |
|
| 127 | + $interestAmount += (int) ($loanAmount * $interestRate * $sessionCount); |
|
| 128 | 128 | // For the next loop |
| 129 | 129 | $loanAmount -= $refund->amount; |
| 130 | 130 | $startSession = $refund->session; |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $lastSession = $this->getLastSession($principalDebt, $endSession); |
| 134 | 134 | $sessionCount = $this->getSessionCount($startSession, $lastSession); |
| 135 | 135 | |
| 136 | - return $interestAmount + (int)($loanAmount * $interestRate * $sessionCount); |
|
| 136 | + return $interestAmount + (int) ($loanAmount * $interestRate * $sessionCount); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -158,10 +158,10 @@ discard block |
||
| 158 | 158 | // Take refunds before the current session and sort by session date. |
| 159 | 159 | $partialRefunds = $this->getPartialRefunds($principalDebt, $endSession, false) |
| 160 | 160 | ->sortBy('session.start_at'); |
| 161 | - foreach($partialRefunds as $refund) |
|
| 161 | + foreach ($partialRefunds as $refund) |
|
| 162 | 162 | { |
| 163 | 163 | $sessionCount = $this->getSessionCount($startSession, $refund->session); |
| 164 | - $interestAmount += (int)($loanAmount * (pow(1 + $interestRate, $sessionCount) - 1)); |
|
| 164 | + $interestAmount += (int) ($loanAmount * (pow(1 + $interestRate, $sessionCount) - 1)); |
|
| 165 | 165 | // For the next loop |
| 166 | 166 | $loanAmount -= $refund->amount - $interestAmount; |
| 167 | 167 | $startSession = $refund->session; |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | $lastSession = $this->getLastSession($principalDebt, $endSession); |
| 171 | 171 | $sessionCount = $this->getSessionCount($startSession, $lastSession); |
| 172 | 172 | |
| 173 | - return $interestAmount + (int)($loanAmount * (pow(1 + $interestRate, $sessionCount) - 1)); |
|
| 173 | + return $interestAmount + (int) ($loanAmount * (pow(1 + $interestRate, $sessionCount) - 1)); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | /** |
@@ -183,14 +183,13 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | public function getDebtTotalAmount(Debt $debt, Session $session): int |
| 185 | 185 | { |
| 186 | - if($debt->is_principal || $debt->refund || $debt->loan->fixed_interest) |
|
| 186 | + if ($debt->is_principal || $debt->refund || $debt->loan->fixed_interest) |
|
| 187 | 187 | { |
| 188 | 188 | return $debt->amount; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | return $debt->loan->simple_interest ? |
| 192 | - $this->getSimpleInterestAmount($debt, $session) : |
|
| 193 | - $this->getCompoundInterestAmount($debt, $session); |
|
| 192 | + $this->getSimpleInterestAmount($debt, $session) : $this->getCompoundInterestAmount($debt, $session); |
|
| 194 | 193 | } |
| 195 | 194 | |
| 196 | 195 | /** |
@@ -203,8 +202,7 @@ discard block |
||
| 203 | 202 | */ |
| 204 | 203 | public function getDebtPaidAmount(Debt $debt, Session $session): int |
| 205 | 204 | { |
| 206 | - return $debt->refund !== null ? $debt->amount : |
|
| 207 | - $this->getPartialRefunds($debt, $session, true)->sum('amount'); |
|
| 205 | + return $debt->refund !== null ? $debt->amount : $this->getPartialRefunds($debt, $session, true)->sum('amount'); |
|
| 208 | 206 | } |
| 209 | 207 | |
| 210 | 208 | /** |
@@ -233,7 +231,7 @@ discard block |
||
| 233 | 231 | public function getDebtDueAmount(Debt $debt, Session $session, bool $withCurrent): int |
| 234 | 232 | { |
| 235 | 233 | $refundFilter = $this->getRefundFilter($session, $withCurrent); |
| 236 | - if($debt->refund !== null && $refundFilter($debt->refund)) |
|
| 234 | + if ($debt->refund !== null && $refundFilter($debt->refund)) |
|
| 237 | 235 | { |
| 238 | 236 | return 0; // The debt was refunded before the current session. |
| 239 | 237 | } |
@@ -144,11 +144,11 @@ discard block |
||
| 144 | 144 | $principal = $values['principal']; |
| 145 | 145 | $interest = $values['interest']; |
| 146 | 146 | // Create an entry for each type of debt |
| 147 | - if($principal > 0) |
|
| 147 | + if ($principal > 0) |
|
| 148 | 148 | { |
| 149 | 149 | $loan->debts()->create(['type' => Debt::TYPE_PRINCIPAL, 'amount' => $principal]); |
| 150 | 150 | } |
| 151 | - if($interest > 0) |
|
| 151 | + if ($interest > 0) |
|
| 152 | 152 | { |
| 153 | 153 | $loan->debts()->create(['type' => Debt::TYPE_INTEREST, 'amount' => $interest]); |
| 154 | 154 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $interest = $values['interest']; |
| 179 | 179 | $loan->debts()->principal()->update(['amount' => $principal]); |
| 180 | 180 | // The interest debt may need to be created or deleted. |
| 181 | - if($interest <= 0) |
|
| 181 | + if ($interest <= 0) |
|
| 182 | 182 | { |
| 183 | 183 | $loan->debts()->where('type', Debt::TYPE_INTEREST)->delete(); |
| 184 | 184 | return; |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | */ |
| 198 | 198 | public function deleteLoan(Session $session, int $loanId): void |
| 199 | 199 | { |
| 200 | - if(($loan = $session->loans()->find($loanId)) !== null) |
|
| 200 | + if (($loan = $session->loans()->find($loanId)) !== null) |
|
| 201 | 201 | { |
| 202 | 202 | DB::transaction(function() use($loan) { |
| 203 | 203 | $loan->refunds()->delete(); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * |
| 46 | 46 | * @return Builder|Relation |
| 47 | 47 | */ |
| 48 | - private function getDebtsQuery(Session $session, Fund $fund, ?bool $onlyPaid): Builder|Relation |
|
| 48 | + private function getDebtsQuery(Session $session, Fund $fund, ?bool $onlyPaid): Builder | Relation |
|
| 49 | 49 | { |
| 50 | 50 | $prevSessions = $this->fundService->getFundSessionIds($session, $fund) |
| 51 | 51 | ->filter(fn(int $sessionId) => $sessionId !== $session->id); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $query->where('session_id', $session->id); |
| 67 | 67 | }); |
| 68 | 68 | }); |
| 69 | - if($prevSessions->count() === 0) |
|
| 69 | + if ($prevSessions->count() === 0) |
|
| 70 | 70 | { |
| 71 | 71 | return; |
| 72 | 72 | } |
@@ -168,13 +168,13 @@ discard block |
||
| 168 | 168 | { |
| 169 | 169 | // Already refunded |
| 170 | 170 | // Cannot refund the principal debt in the same session. |
| 171 | - if(!$session->opened || $debt->refund !== null || |
|
| 171 | + if (!$session->opened || $debt->refund !== null || |
|
| 172 | 172 | $debt->is_principal && $debt->loan->session->id === $session->id) |
| 173 | 173 | { |
| 174 | 174 | return false; |
| 175 | 175 | } |
| 176 | 176 | // Cannot refund the interest debt before the principal. |
| 177 | - if($debt->is_interest && !$debt->loan->fixed_interest) |
|
| 177 | + if ($debt->is_interest && !$debt->loan->fixed_interest) |
|
| 178 | 178 | { |
| 179 | 179 | return $debt->loan->principal_debt->refund !== null; |
| 180 | 180 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | public function createRefund(Debt $debt, Session $session): void |
| 196 | 196 | { |
| 197 | - if(!$this->canCreateRefund($debt, $session)) |
|
| 197 | + if (!$this->canCreateRefund($debt, $session)) |
|
| 198 | 198 | { |
| 199 | 199 | throw new MessageException(trans('meeting.refund.errors.cannot_refund')); |
| 200 | 200 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | DB::transaction(function() use($debt, $session, $refund) { |
| 206 | 206 | $refund->save(); |
| 207 | 207 | // For simple or compound interest, also save the final amount. |
| 208 | - if($debt->is_interest && !$debt->loan->fixed_interest) |
|
| 208 | + if ($debt->is_interest && !$debt->loan->fixed_interest) |
|
| 209 | 209 | { |
| 210 | 210 | $debt->amount = $this->debtCalculator->getDebtDueAmount($debt, $session, true); |
| 211 | 211 | $debt->save(); |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | private function canDeleteRefund(Debt $debt, Session $session): bool |
| 223 | 223 | { |
| 224 | 224 | // A refund can only be deleted in the same session it was created. |
| 225 | - if(!$session->opened || !$debt->refund || $debt->refund->session_id !== $session->id) |
|
| 225 | + if (!$session->opened || !$debt->refund || $debt->refund->session_id !== $session->id) |
|
| 226 | 226 | { |
| 227 | 227 | return false; |
| 228 | 228 | } |
@@ -240,11 +240,11 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | public function deleteRefund(Debt $debt, Session $session): void |
| 242 | 242 | { |
| 243 | - if(!$this->canDeleteRefund($debt, $session)) |
|
| 243 | + if (!$this->canDeleteRefund($debt, $session)) |
|
| 244 | 244 | { |
| 245 | 245 | throw new MessageException(trans('meeting.refund.errors.cannot_refund')); |
| 246 | 246 | } |
| 247 | - if(!$this->paymentService->isEditable($debt->refund)) |
|
| 247 | + if (!$this->paymentService->isEditable($debt->refund)) |
|
| 248 | 248 | { |
| 249 | 249 | throw new MessageException(trans('meeting.refund.errors.cannot_delete')); |
| 250 | 250 | } |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | private function canCreatePartialRefund(Debt $debt, Session $session): bool |
| 308 | 308 | { |
| 309 | 309 | // Cannot refund the principal debt in the same session. |
| 310 | - if(!$session->opened || $debt->refund !== null || |
|
| 310 | + if (!$session->opened || $debt->refund !== null || |
|
| 311 | 311 | ($debt->is_principal && $debt->loan->session->id === $session->id)) |
| 312 | 312 | { |
| 313 | 313 | return false; |
@@ -360,12 +360,12 @@ discard block |
||
| 360 | 360 | */ |
| 361 | 361 | public function createPartialRefund(Debt $debt, Session $session, int $amount): void |
| 362 | 362 | { |
| 363 | - if(!$this->canCreatePartialRefund($debt, $session)) |
|
| 363 | + if (!$this->canCreatePartialRefund($debt, $session)) |
|
| 364 | 364 | { |
| 365 | 365 | throw new MessageException(trans('meeting.refund.errors.cannot_delete')); |
| 366 | 366 | } |
| 367 | 367 | // A partial refund must not totally refund a debt |
| 368 | - if($amount >= $this->debtCalculator->getDebtDueAmount($debt, $session, true)) |
|
| 368 | + if ($amount >= $this->debtCalculator->getDebtDueAmount($debt, $session, true)) |
|
| 369 | 369 | { |
| 370 | 370 | throw new MessageException(trans('meeting.refund.errors.pr_amount')); |
| 371 | 371 | } |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | private function canDeletePartialRefund(PartialRefund $refund, Session $session): bool |
| 387 | 387 | { |
| 388 | 388 | // A partial refund cannot be deleted if the debt is already refunded. |
| 389 | - if(!$session->opened || $refund->debt->refund !== null) |
|
| 389 | + if (!$session->opened || $refund->debt->refund !== null) |
|
| 390 | 390 | { |
| 391 | 391 | return false; |
| 392 | 392 | } |
@@ -406,11 +406,11 @@ discard block |
||
| 406 | 406 | { |
| 407 | 407 | $refund = PartialRefund::where('session_id', $session->id) |
| 408 | 408 | ->with(['debt.refund'])->find($refundId); |
| 409 | - if(!$refund) |
|
| 409 | + if (!$refund) |
|
| 410 | 410 | { |
| 411 | 411 | throw new MessageException(trans('meeting.refund.errors.not_found')); |
| 412 | 412 | } |
| 413 | - if($refund->debt->refund !== null || !$this->paymentService->isEditable($refund)) |
|
| 413 | + if ($refund->debt->refund !== null || !$this->paymentService->isEditable($refund)) |
|
| 414 | 414 | { |
| 415 | 415 | throw new MessageException(trans('meeting.refund.errors.cannot_delete')); |
| 416 | 416 | } |
@@ -51,31 +51,31 @@ discard block |
||
| 51 | 51 | int $profitAmount): Collection |
| 52 | 52 | { |
| 53 | 53 | // Set savings durations and distributions |
| 54 | - foreach($savings as $saving) |
|
| 54 | + foreach ($savings as $saving) |
|
| 55 | 55 | { |
| 56 | 56 | $saving->duration = $this->getSavingDuration($sessions, $saving); |
| 57 | 57 | $saving->distribution = $saving->amount * $saving->duration; |
| 58 | 58 | $saving->profit = 0; |
| 59 | 59 | } |
| 60 | 60 | // Reduce the distributions |
| 61 | - $distributionGcd = (int)$savings->reduce(function($gcd, $saving) { |
|
| 62 | - if($gcd === 0) |
|
| 61 | + $distributionGcd = (int) $savings->reduce(function($gcd, $saving) { |
|
| 62 | + if ($gcd === 0) |
|
| 63 | 63 | { |
| 64 | 64 | return $saving->distribution; |
| 65 | 65 | } |
| 66 | - if($saving->duration === 0) |
|
| 66 | + if ($saving->duration === 0) |
|
| 67 | 67 | { |
| 68 | 68 | return $gcd; |
| 69 | 69 | } |
| 70 | 70 | return gmp_gcd($gcd, $saving->distribution); |
| 71 | 71 | }, $savings->first()->distribution); |
| 72 | - if($distributionGcd > 0) |
|
| 72 | + if ($distributionGcd > 0) |
|
| 73 | 73 | { |
| 74 | - $sum = (int)($savings->sum('distribution') / $distributionGcd); |
|
| 75 | - foreach($savings as $saving) |
|
| 74 | + $sum = (int) ($savings->sum('distribution') / $distributionGcd); |
|
| 75 | + foreach ($savings as $saving) |
|
| 76 | 76 | { |
| 77 | 77 | $saving->distribution /= $distributionGcd; |
| 78 | - $saving->profit = (int)($profitAmount * $saving->distribution / $sum); |
|
| 78 | + $saving->profit = (int) ($profitAmount * $saving->distribution / $sum); |
|
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | ->orderBy('sessions.start_at', 'asc') |
| 105 | 105 | ->with(['session', 'member']) |
| 106 | 106 | ->get(); |
| 107 | - if($savings->count() === 0) |
|
| 107 | + if ($savings->count() === 0) |
|
| 108 | 108 | { |
| 109 | 109 | return $savings; |
| 110 | 110 | } |
@@ -124,13 +124,13 @@ discard block |
||
| 124 | 124 | // The part value makes sense only iwhen there is more than 2 savings |
| 125 | 125 | // with distribution greater than 0. |
| 126 | 126 | $savings = $savings->filter(fn($saving) => $saving->distribution > 0); |
| 127 | - if($savings->count() < 2) |
|
| 127 | + if ($savings->count() < 2) |
|
| 128 | 128 | { |
| 129 | 129 | return 0; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | $saving = $savings->first(); |
| 133 | - return (int)($saving->amount * $saving->duration / $saving->distribution); |
|
| 133 | + return (int) ($saving->amount * $saving->duration / $saving->distribution); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |