@@ -214,7 +214,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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); |
@@ -230,8 +230,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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(); |
@@ -40,8 +40,7 @@ |
||
| 40 | 40 | $pdf = $page->pdf($this->config); |
| 41 | 41 | |
| 42 | 42 | return $pdf->getBase64(); |
| 43 | - } |
|
| 44 | - finally |
|
| 43 | + } finally |
|
| 45 | 44 | { |
| 46 | 45 | $this->browser->close(); |
| 47 | 46 | } |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | */ |
| 63 | 63 | public function getRounds(int $page = 0): Collection |
| 64 | 64 | { |
| 65 | - if(!($tontine = $this->tenantService->tontine())) |
|
| 65 | + if (!($tontine = $this->tenantService->tontine())) |
|
| 66 | 66 | { |
| 67 | 67 | return collect([]); |
| 68 | 68 | } |
@@ -105,14 +105,14 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public function createSessions(array $values): bool |
| 107 | 107 | { |
| 108 | - foreach($values as &$value) |
|
| 108 | + foreach ($values as &$value) |
|
| 109 | 109 | { |
| 110 | 110 | $value['start_at'] = $value['date'] . ' ' . $value['start'] . ':00'; |
| 111 | 111 | $value['end_at'] = $value['date'] . ' ' . $value['end'] . ':00'; |
| 112 | 112 | } |
| 113 | 113 | DB::transaction(function() use($values) { |
| 114 | 114 | $sessions = $this->tenantService->round()->sessions()->createMany($values); |
| 115 | - foreach($sessions as $session) |
|
| 115 | + foreach ($sessions as $session) |
|
| 116 | 116 | { |
| 117 | 117 | $this->disableSessionOnPools($session); |
| 118 | 118 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | // Make sure the host belongs to the same tontine |
| 137 | 137 | $hostId = intval($values['host_id']); |
| 138 | 138 | $values['host_id'] = null; |
| 139 | - if($hostId > 0) |
|
| 139 | + if ($hostId > 0) |
|
| 140 | 140 | { |
| 141 | 141 | $values['host_id'] = $this->tenantService->tontine()->members()->find($hostId)->id; |
| 142 | 142 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | { |
| 172 | 172 | $session->delete(); |
| 173 | 173 | } |
| 174 | - catch(Exception $e) |
|
| 174 | + catch (Exception $e) |
|
| 175 | 175 | { |
| 176 | 176 | throw new MessageException(trans('tontine.session.errors.delete')); |
| 177 | 177 | } |
@@ -200,13 +200,13 @@ discard block |
||
| 200 | 200 | { |
| 201 | 201 | // When the remitments are planned, don't enable or disable a session |
| 202 | 202 | // if receivables already exist on the pool. |
| 203 | - if($pool->remit_planned && |
|
| 203 | + if ($pool->remit_planned && |
|
| 204 | 204 | $pool->subscriptions()->whereHas('receivables')->count() > 0) |
| 205 | 205 | { |
| 206 | 206 | return; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - if($session->disabled($pool)) |
|
| 209 | + if ($session->disabled($pool)) |
|
| 210 | 210 | { |
| 211 | 211 | // Enable the session for the pool. |
| 212 | 212 | $pool->disabledSessions()->detach($session->id); |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | $query->where('session_id', $session->id); |
| 220 | 220 | }) |
| 221 | 221 | ->count(); |
| 222 | - if($receivableQuery > 0) |
|
| 222 | + if ($receivableQuery > 0) |
|
| 223 | 223 | { |
| 224 | 224 | return; |
| 225 | 225 | } |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | $year = now()->format('Y'); |
| 263 | 263 | $date = Carbon::createFromDate($year, 1, 5, 'Africa/Douala')->locale('fr'); |
| 264 | 264 | $sessions = []; |
| 265 | - for($i = 0; $i < 12; $i++) |
|
| 265 | + for ($i = 0; $i < 12; $i++) |
|
| 266 | 266 | { |
| 267 | 267 | $session = new \stdClass(); |
| 268 | 268 | $session->title = 'Séance de ' . $date->isoFormat('MMMM YYYY'); |
@@ -170,8 +170,7 @@ |
||
| 170 | 170 | try |
| 171 | 171 | { |
| 172 | 172 | $session->delete(); |
| 173 | - } |
|
| 174 | - catch(Exception $e) |
|
| 173 | + } catch(Exception $e) |
|
| 175 | 174 | { |
| 176 | 175 | throw new MessageException(trans('tontine.session.errors.delete')); |
| 177 | 176 | } |
@@ -138,7 +138,7 @@ |
||
| 138 | 138 | // Delete the pool |
| 139 | 139 | $pool->delete(); |
| 140 | 140 | } |
| 141 | - catch(Exception $e) |
|
| 141 | + catch (Exception $e) |
|
| 142 | 142 | { |
| 143 | 143 | throw new MessageException(trans('tontine.errors.action') . |
| 144 | 144 | '<br/>' . trans('tontine.pool.errors.subscription')); |
@@ -137,8 +137,7 @@ |
||
| 137 | 137 | DB::table('pool_session_disabled')->where('pool_id', $pool->id)->delete(); |
| 138 | 138 | // Delete the pool |
| 139 | 139 | $pool->delete(); |
| 140 | - } |
|
| 141 | - catch(Exception $e) |
|
| 140 | + } catch(Exception $e) |
|
| 142 | 141 | { |
| 143 | 142 | throw new MessageException(trans('tontine.errors.action') . |
| 144 | 143 | '<br/>' . trans('tontine.pool.errors.subscription')); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | $figures = new stdClass(); |
| 70 | 70 | // Expected figures only for pools with fixed deposit amount |
| 71 | - if($pool->remit_planned /*$pool->deposit_fixed*/) |
|
| 71 | + if ($pool->remit_planned /*$pool->deposit_fixed*/) |
|
| 72 | 72 | { |
| 73 | 73 | $figures->expected = $this->getExpectedFigures($pool, $sessions, $subscriptions); |
| 74 | 74 | } |
@@ -76,11 +76,10 @@ discard block |
||
| 76 | 76 | // Set the subscriptions that will be pay at each session. |
| 77 | 77 | // Pad with 0's when the beneficiaries are not yet set. |
| 78 | 78 | $sessions->each(function($session) use($figures, $pool) { |
| 79 | - if($session->enabled($pool)) |
|
| 79 | + if ($session->enabled($pool)) |
|
| 80 | 80 | { |
| 81 | 81 | // Pick the subscriptions ids, and fill with 0's to the max available. |
| 82 | - $remitmentCount = !$pool->deposit_fixed ? 1 : |
|
| 83 | - $figures->expected[$session->id]->remitment->count; |
|
| 82 | + $remitmentCount = !$pool->deposit_fixed ? 1 : $figures->expected[$session->id]->remitment->count; |
|
| 84 | 83 | $session->beneficiaries = $session->payables->map(function($payable) { |
| 85 | 84 | return $payable->subscription_id; |
| 86 | 85 | })->pad($remitmentCount, 0); |
@@ -94,7 +93,7 @@ discard block |
||
| 94 | 93 | }); |
| 95 | 94 | $beneficiaries = $beneficiaries->pluck('member.name', 'id'); |
| 96 | 95 | // Do not show the list of subscriptions for pools with auctions |
| 97 | - if($pool->remit_auction) |
|
| 96 | + if ($pool->remit_auction) |
|
| 98 | 97 | { |
| 99 | 98 | $subscriptions = collect([]); |
| 100 | 99 | } |
@@ -97,8 +97,7 @@ |
||
| 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); |
@@ -48,25 +48,25 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function getRemitmentCount(int $sessionCount, int $subscriptionCount, int $sessionPosition): int |
| 50 | 50 | { |
| 51 | - if($sessionCount === 0 || $subscriptionCount === 0) |
|
| 51 | + if ($sessionCount === 0 || $subscriptionCount === 0) |
|
| 52 | 52 | { |
| 53 | 53 | return 0; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | // Greatest common divisor |
| 57 | - $gcd = (int)gmp_gcd($sessionCount, $subscriptionCount); |
|
| 58 | - $sessionsInLoop = (int)($sessionCount / $gcd); |
|
| 57 | + $gcd = (int) gmp_gcd($sessionCount, $subscriptionCount); |
|
| 58 | + $sessionsInLoop = (int) ($sessionCount / $gcd); |
|
| 59 | 59 | $positionInLoop = $sessionPosition % $sessionsInLoop; |
| 60 | - $subscriptionsInLoop = (int)($subscriptionCount / $gcd); |
|
| 60 | + $subscriptionsInLoop = (int) ($subscriptionCount / $gcd); |
|
| 61 | 61 | $extraSubscriptionsInLoop = $subscriptionsInLoop % $sessionsInLoop; |
| 62 | 62 | |
| 63 | 63 | // There's is an extra remitment when the modulo decreases compared to the previous session. |
| 64 | 64 | $prevModulo = ($positionInLoop * $extraSubscriptionsInLoop) % $sessionsInLoop; |
| 65 | - if($prevModulo > ($prevModulo + $extraSubscriptionsInLoop) % $sessionsInLoop) |
|
| 65 | + if ($prevModulo > ($prevModulo + $extraSubscriptionsInLoop) % $sessionsInLoop) |
|
| 66 | 66 | { |
| 67 | - return (int)floor($subscriptionCount / $sessionCount) + 1; |
|
| 67 | + return (int) floor($subscriptionCount / $sessionCount) + 1; |
|
| 68 | 68 | } |
| 69 | - return (int)floor($subscriptionCount / $sessionCount); |
|
| 69 | + return (int) floor($subscriptionCount / $sessionCount); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -107,9 +107,9 @@ discard block |
||
| 107 | 107 | $position = 0; |
| 108 | 108 | $cashier = 0; |
| 109 | 109 | $expectedFigures = []; |
| 110 | - foreach($sessions as $session) |
|
| 110 | + foreach ($sessions as $session) |
|
| 111 | 111 | { |
| 112 | - if($session->disabled($pool)) |
|
| 112 | + if ($session->disabled($pool)) |
|
| 113 | 113 | { |
| 114 | 114 | $expectedFigures[$session->id] = $this->makeFigures(''); |
| 115 | 115 | continue; |
@@ -120,8 +120,7 @@ discard block |
||
| 120 | 120 | $figures->cashier->recv = $cashier + $depositAmount; |
| 121 | 121 | $figures->deposit->count = $depositCount; |
| 122 | 122 | $figures->deposit->amount = $depositAmount; |
| 123 | - $figures->remitment->count = !$pool->deposit_fixed ? 1 : |
|
| 124 | - $this->getRemitmentCount($sessionCount, $subscriptionCount, $position++); |
|
| 123 | + $figures->remitment->count = !$pool->deposit_fixed ? 1 : $this->getRemitmentCount($sessionCount, $subscriptionCount, $position++); |
|
| 125 | 124 | $figures->remitment->amount = $remitmentAmount * $figures->remitment->count; |
| 126 | 125 | $figures->cashier->end = $cashier + $depositAmount - $figures->remitment->amount; |
| 127 | 126 | $cashier = $figures->cashier->end; |
@@ -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 | } |