@@ -86,7 +86,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | /** |
@@ -41,7 +41,7 @@ |
||
| 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 | } |
@@ -29,7 +29,7 @@ |
||
| 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 | } |
@@ -35,20 +35,19 @@ |
||
| 35 | 35 | 'period' => 'required|integer|between:0,3', |
| 36 | 36 | 'name' => 'required|string|min:1', |
| 37 | 37 | 'fixed' => [ |
| 38 | - Rule::requiredIf((int)$values['type'] === 0 && (int)$values['period'] > 0), |
|
| 38 | + Rule::requiredIf((int) $values['type'] === 0 && (int) $values['period'] > 0), |
|
| 39 | 39 | 'in:1', |
| 40 | 40 | 'exclude', |
| 41 | 41 | ], |
| 42 | 42 | 'amount' => 'required_if:fixed,1|regex:/^\d+(\.\d{1,2})?$/', |
| 43 | 43 | ]); |
| 44 | - if($validator->fails()) |
|
| 44 | + if ($validator->fails()) |
|
| 45 | 45 | { |
| 46 | 46 | throw new ValidationException($validator); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $validated = $validator->validated(); |
| 50 | - $validated['amount'] = empty($values['fixed']) ? 0 : |
|
| 51 | - $this->localeService->convertMoneyToInt((float)$validated['amount']); |
|
| 50 | + $validated['amount'] = empty($values['fixed']) ? 0 : $this->localeService->convertMoneyToInt((float) $validated['amount']); |
|
| 52 | 51 | $validated['lendable'] = isset($values['lendable']); |
| 53 | 52 | |
| 54 | 53 | return $validated; |
@@ -34,16 +34,14 @@ |
||
| 34 | 34 | 'amount' => 'required_if:remit_amount,1|regex:/^\d+(\.\d{1,2})?$/', |
| 35 | 35 | 'auction' => 'required_if:remit_auction,1|regex:/^\d+(\.\d{1,2})?$/', |
| 36 | 36 | ]); |
| 37 | - if($validator->fails()) |
|
| 37 | + if ($validator->fails()) |
|
| 38 | 38 | { |
| 39 | 39 | throw new ValidationException($validator); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $validated = $validator->validated(); |
| 43 | - $validated['amount'] = empty($validated['amount']) ? 0 : |
|
| 44 | - $this->localeService->convertMoneyToInt((float)$validated['amount']); |
|
| 45 | - $validated['auction'] = empty($validated['auction']) ? 0 : |
|
| 46 | - $this->localeService->convertMoneyToInt((float)$validated['auction']); |
|
| 43 | + $validated['amount'] = empty($validated['amount']) ? 0 : $this->localeService->convertMoneyToInt((float) $validated['amount']); |
|
| 44 | + $validated['auction'] = empty($validated['auction']) ? 0 : $this->localeService->convertMoneyToInt((float) $validated['auction']); |
|
| 47 | 45 | return $validated; |
| 48 | 46 | } |
| 49 | 47 | } |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | 'debt' => 'required|integer|min:1', |
| 36 | 36 | 'amount' => 'required|regex:/^\d+(\.\d{1,2})?$/', |
| 37 | 37 | ]); |
| 38 | - if($validator->fails()) |
|
| 38 | + if ($validator->fails()) |
|
| 39 | 39 | { |
| 40 | 40 | throw new ValidationException($validator); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | $validated = $validator->validated(); |
| 44 | - $validated['amount'] = $this->localeService->convertMoneyToInt((float)$validated['amount']); |
|
| 44 | + $validated['amount'] = $this->localeService->convertMoneyToInt((float) $validated['amount']); |
|
| 45 | 45 | return $validated; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $validator = Validator::make($this->values($values), [ |
| 59 | 59 | 'debt' => 'required|integer|min:1', |
| 60 | 60 | ]); |
| 61 | - if($validator->fails()) |
|
| 61 | + if ($validator->fails()) |
|
| 62 | 62 | { |
| 63 | 63 | throw new ValidationException($validator); |
| 64 | 64 | } |
@@ -36,13 +36,13 @@ |
||
| 36 | 36 | 'amount' => 'required|regex:/^\d+(\.\d{1,2})?$/', |
| 37 | 37 | 'comment' => 'present|between:0,150', |
| 38 | 38 | ]); |
| 39 | - if($validator->fails()) |
|
| 39 | + if ($validator->fails()) |
|
| 40 | 40 | { |
| 41 | 41 | throw new ValidationException($validator); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | $validated = $validator->validated(); |
| 45 | - $validated['amount'] = $this->localeService->convertMoneyToInt((float)$validated['amount']); |
|
| 45 | + $validated['amount'] = $this->localeService->convertMoneyToInt((float) $validated['amount']); |
|
| 46 | 46 | return $validated; |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -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 | } |
@@ -33,13 +33,13 @@ |
||
| 33 | 33 | 'member' => 'required|integer|min:1', |
| 34 | 34 | 'amount' => 'required|regex:/^\d+(\.\d{1,2})?$/', |
| 35 | 35 | ]); |
| 36 | - if($validator->fails()) |
|
| 36 | + if ($validator->fails()) |
|
| 37 | 37 | { |
| 38 | 38 | throw new ValidationException($validator); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $validated = $validator->validated(); |
| 42 | - $validated['amount'] = $this->localeService->convertMoneyToInt((float)$validated['amount']); |
|
| 42 | + $validated['amount'] = $this->localeService->convertMoneyToInt((float) $validated['amount']); |
|
| 43 | 43 | return $validated; |
| 44 | 44 | } |
| 45 | 45 | } |