Passed
Pull Request — main (#55)
by Thierry
05:38
created
app/Listeners/FeedbackListener.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
      */
18 18
     public function handle(NewFeedback $event)
19 19
     {
20
-        if(!($mailTo = env('MAIL_FEEDBACK_TO')))
20
+        if (!($mailTo = env('MAIL_FEEDBACK_TO')))
21 21
         {
22 22
             return;
23 23
         }
Please login to merge, or discard this patch.
app/Exceptions/Handler.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -82,12 +82,12 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function register()
84 84
     {
85
-        $this->reportable(function (Throwable $e) {
85
+        $this->reportable(function(Throwable $e) {
86 86
             //
87 87
         });
88 88
 
89 89
         // Redirect to the login page
90
-        $this->renderable(function (AuthenticationException $e) {
90
+        $this->renderable(function(AuthenticationException $e) {
91 91
             $jaxon = app()->make(Jaxon::class);
92 92
             $ajaxResponse = $jaxon->ajaxResponse();
93 93
             $ajaxResponse->redirect(route('login'));
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         });
97 97
 
98 98
         // Show the error message in a dialog
99
-        $this->renderable(function (MessageException $e) {
99
+        $this->renderable(function(MessageException $e) {
100 100
             $jaxon = app()->make(Jaxon::class);
101 101
             $ajaxResponse = $jaxon->ajaxResponse();
102 102
             $ajaxResponse->dialog->error($e->getMessage(), trans('common.titles.error'));
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         });
106 106
 
107 107
         // Show the warning message in a dialog, and show the sessions page.
108
-        $this->renderable(function (PlanningRoundException $e) {
108
+        $this->renderable(function(PlanningRoundException $e) {
109 109
             $this->getCallableObject(Round::class)->home();
110 110
 
111 111
             $jaxon = app()->make(Jaxon::class);
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         });
117 117
 
118 118
         // Show the warning message in a dialog, and show the pools page.
119
-        $this->renderable(function (PlanningPoolException $e) {
119
+        $this->renderable(function(PlanningPoolException $e) {
120 120
             $this->getCallableObject(Pool::class)->home();
121 121
 
122 122
             $jaxon = app()->make(Jaxon::class);
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         });
128 128
 
129 129
         // Show the warning message in a dialog, and show the members page.
130
-        $this->renderable(function (TontineMemberException $e) {
130
+        $this->renderable(function(TontineMemberException $e) {
131 131
             $this->getCallableObject(Member::class)->home();
132 132
 
133 133
             $jaxon = app()->make(Jaxon::class);
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         });
139 139
 
140 140
         // Show the warning message in a dialog, and show the sessions page.
141
-        $this->renderable(function (MeetingRoundException $e) {
141
+        $this->renderable(function(MeetingRoundException $e) {
142 142
             $this->getCallableObject(Session::class)->home();
143 143
 
144 144
             $jaxon = app()->make(Jaxon::class);
Please login to merge, or discard this patch.
app/Ajax/CallableClass.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -56,12 +56,12 @@  discard block
 block discarded – undo
56 56
         string $bagName, string $attrName = 'page'): array
57 57
     {
58 58
         $perPage = 10;
59
-        $pageCount = (int)floor($itemCount / $perPage) + ($itemCount % $perPage > 0 ? 1 : 0);
60
-        if($pageNumber < 1)
59
+        $pageCount = (int) floor($itemCount / $perPage) + ($itemCount % $perPage > 0 ? 1 : 0);
60
+        if ($pageNumber < 1)
61 61
         {
62 62
             $pageNumber = $this->bag($bagName)->get($attrName, 1);
63 63
         }
64
-        if($pageNumber > $pageCount)
64
+        if ($pageNumber > $pageCount)
65 65
         {
66 66
             $pageNumber = $pageCount;
67 67
         }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     protected function checkRoundSessions()
152 152
     {
153 153
         $round = $this->tenantService->round();
154
-        if(!$round || $round->sessions->count() === 0)
154
+        if (!$round || $round->sessions->count() === 0)
155 155
         {
156 156
             throw new PlanningRoundException(trans('tontine.errors.checks.sessions'));
157 157
         }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
         $this->checkRoundSessions();
166 166
 
167 167
         $round = $this->tenantService->round();
168
-        if(!$round || $round->pools->count() === 0)
168
+        if (!$round || $round->pools->count() === 0)
169 169
         {
170 170
             throw new PlanningPoolException(trans('tontine.errors.checks.pools'));
171 171
         }
@@ -180,13 +180,13 @@  discard block
 block discarded – undo
180 180
         $this->checkRoundSessions();
181 181
 
182 182
         $tontine = $this->tenantService->tontine();
183
-        if(!$tontine || $tontine->members()->active()->count() === 0)
183
+        if (!$tontine || $tontine->members()->active()->count() === 0)
184 184
         {
185 185
             throw new TontineMemberException(trans('tontine.errors.checks.members'));
186 186
         }
187 187
 
188 188
         $round = $this->tenantService->round();
189
-        if(!$round || $round->sessions->filter(fn($session) =>
189
+        if (!$round || $round->sessions->filter(fn($session) =>
190 190
             ($session->opened || $session->closed))->count() === 0)
191 191
         {
192 192
             throw new MeetingRoundException(trans('tontine.errors.checks.opened_sessions'));
Please login to merge, or discard this patch.
src/Service/BalanceCalculator.php 1 patch
Spacing   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function getReceivableAmount(Receivable $receivable): int
37 37
     {
38
-        if($receivable->subscription->pool->deposit_fixed)
38
+        if ($receivable->subscription->pool->deposit_fixed)
39 39
         {
40 40
             return $receivable->subscription->pool->amount;
41 41
         }
@@ -86,8 +86,7 @@  discard block
 block discarded – undo
86 86
             ->where('receivables.session_id', $session->id)
87 87
             ->where('subscriptions.pool_id', $pool->id);
88 88
 
89
-        return !$pool->deposit_fixed ? $query->sum('deposits.amount') :
90
-            $pool->amount * $query->count();
89
+        return !$pool->deposit_fixed ? $query->sum('deposits.amount') : $pool->amount * $query->count();
91 90
     }
92 91
 
93 92
     /**
@@ -98,7 +97,7 @@  discard block
 block discarded – undo
98 97
      */
99 98
     public function getPayableAmount(Pool $pool, Session $session): int
100 99
     {
101
-        if(!$pool->deposit_fixed)
100
+        if (!$pool->deposit_fixed)
102 101
         {
103 102
             // Sum the amounts for all deposits
104 103
             return $this->getPoolDepositAmount($pool, $session);
@@ -122,7 +121,7 @@  discard block
 block discarded – undo
122 121
      */
123 122
     public function getPoolRemitmentAmount(Pool $pool, Session $session): int
124 123
     {
125
-        if(!$pool->deposit_fixed)
124
+        if (!$pool->deposit_fixed)
126 125
         {
127 126
             // Sum the amounts for all deposits
128 127
             return $this->getPoolDepositAmount($pool, $session);
@@ -282,7 +281,7 @@  discard block
 block discarded – undo
282 281
             ->join('debts', 'partial_refunds.debt_id', '=', 'debts.id')
283 282
             ->join('loans', 'debts.loan_id', '=', 'loans.id')
284 283
             ->whereIn('partial_refunds.session_id', $sessionIds)
285
-            ->whereNotExists(function (Builder $query) {
284
+            ->whereNotExists(function(Builder $query) {
286 285
                 $query->select(DB::raw(1))->from('refunds')
287 286
                     ->whereColumn('refunds.debt_id', 'debts.id');
288 287
             })
Please login to merge, or discard this patch.
src/Service/Planning/SubscriptionService.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @return Builder|Relation
50 50
      */
51
-    public function getQuery(Pool $pool, string $search, ?bool $filter): Builder|Relation
51
+    public function getQuery(Pool $pool, string $search, ?bool $filter): Builder | Relation
52 52
     {
53 53
         return $this->tenantService->tontine()->members()->active()
54 54
             ->when($filter === true, function(Builder $query) use($pool) {
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
             ->withCount('receivables')
157 157
             ->get()
158 158
             ->sortBy('receivables_count');
159
-        if($subscriptions->count() === 0)
159
+        if ($subscriptions->count() === 0)
160 160
         {
161 161
             throw new MessageException(trans('tontine.subscription.errors.not_found'));
162 162
         }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      */
206 206
     public function unsetPayableSession(Subscription $subscription)
207 207
     {
208
-        if(($subscription->payable->session_id))
208
+        if (($subscription->payable->session_id))
209 209
         {
210 210
             $subscription->payable->session()->dissociate();
211 211
             $subscription->payable->save();
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
     private function canChangeBeneficiary(Session $session, ?Subscription $subscription): bool
222 222
     {
223 223
         // Can't change the beneficiary if the session is closed,
224
-        if($session->closed)
224
+        if ($session->closed)
225 225
         {
226 226
             return false;
227 227
         }
@@ -246,17 +246,17 @@  discard block
 block discarded – undo
246 246
         $session = $pool->sessions()->find($sessionId);
247 247
         $currSubscription = null;
248 248
         $nextSubscription = null;
249
-        if($currSubscriptionId > 0)
249
+        if ($currSubscriptionId > 0)
250 250
         {
251 251
             $currSubscription = $pool->subscriptions()
252 252
                 ->with('payable')
253 253
                 ->find($currSubscriptionId);
254
-            if(!$this->canChangeBeneficiary($session, $currSubscription))
254
+            if (!$this->canChangeBeneficiary($session, $currSubscription))
255 255
             {
256 256
                 return false;
257 257
             }
258 258
         }
259
-        if($nextSubscriptionId > 0)
259
+        if ($nextSubscriptionId > 0)
260 260
         {
261 261
             $nextSubscription = $pool->subscriptions()
262 262
                 ->with('payable')
@@ -265,12 +265,12 @@  discard block
 block discarded – undo
265 265
 
266 266
         DB::transaction(function() use($session, $currSubscription, $nextSubscription) {
267 267
             // If the beneficiary already has a session assigned, first remove it.
268
-            if($currSubscription !== null)
268
+            if ($currSubscription !== null)
269 269
             {
270 270
                 $this->unsetPayableSession($currSubscription);
271 271
             }
272 272
             // If there is a new session assigned to the beneficiary, then save it.
273
-            if($nextSubscription !== null)
273
+            if ($nextSubscription !== null)
274 274
             {
275 275
                 $this->setPayableSession($nextSubscription, $session);
276 276
             }
Please login to merge, or discard this patch.
src/Service/Meeting/Pool/DepositService.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      *
30 30
      * @return Builder|Relation
31 31
      */
32
-    private function getQuery(Pool $pool, Session $session): Builder|Relation
32
+    private function getQuery(Pool $pool, Session $session): Builder | Relation
33 33
     {
34 34
         return $session->receivables()
35 35
             ->select('receivables.*')
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     public function createDeposit(Pool $pool, Session $session, int $receivableId): void
101 101
     {
102 102
         $receivable = $this->getReceivable($pool, $session, $receivableId);
103
-        if(!$receivable || $receivable->deposit || !$pool->deposit_fixed)
103
+        if (!$receivable || $receivable->deposit || !$pool->deposit_fixed)
104 104
         {
105 105
             throw new MessageException(trans('tontine.subscription.errors.not_found'));
106 106
         }
@@ -124,14 +124,14 @@  discard block
 block discarded – undo
124 124
     public function saveDepositAmount(Pool $pool, Session $session, int $receivableId, int $amount): void
125 125
     {
126 126
         $receivable = $this->getReceivable($pool, $session, $receivableId);
127
-        if(!$receivable || $pool->deposit_fixed)
127
+        if (!$receivable || $pool->deposit_fixed)
128 128
         {
129 129
             throw new MessageException(trans('tontine.subscription.errors.not_found'));
130 130
         }
131 131
 
132
-        if($receivable->deposit !== null)
132
+        if ($receivable->deposit !== null)
133 133
         {
134
-            if((!$receivable->deposit->editable))
134
+            if ((!$receivable->deposit->editable))
135 135
             {
136 136
                 throw new MessageException(trans('tontine.errors.editable'));
137 137
             }
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
     public function deleteDeposit(Pool $pool, Session $session, int $receivableId): void
161 161
     {
162 162
         $receivable = $this->getReceivable($pool, $session, $receivableId);
163
-        if(!$receivable || !$receivable->deposit)
163
+        if (!$receivable || !$receivable->deposit)
164 164
         {
165 165
             throw new MessageException(trans('tontine.subscription.errors.not_found'));
166 166
         }
167
-        if((!$receivable->deposit->editable))
167
+        if ((!$receivable->deposit->editable))
168 168
         {
169 169
             throw new MessageException(trans('tontine.errors.editable'));
170 170
         }
@@ -182,13 +182,13 @@  discard block
 block discarded – undo
182 182
     public function createAllDeposits(Pool $pool, Session $session): void
183 183
     {
184 184
         $receivables = $this->getQuery($pool, $session)->whereDoesntHave('deposit')->get();
185
-        if($receivables->count() === 0)
185
+        if ($receivables->count() === 0)
186 186
         {
187 187
             return;
188 188
         }
189 189
 
190 190
         DB::transaction(function() use($session, $receivables) {
191
-            foreach($receivables as $receivable)
191
+            foreach ($receivables as $receivable)
192 192
             {
193 193
                 $deposit = new Deposit();
194 194
                 $deposit->receivable()->associate($receivable);
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
             ->filter(function($receivable) {
216 216
                 return $receivable->deposit->editable;
217 217
             });
218
-        if($receivables->count() === 0)
218
+        if ($receivables->count() === 0)
219 219
         {
220 220
             return;
221 221
         }
Please login to merge, or discard this patch.
src/Service/Meeting/Pool/RemitmentService.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      *
40 40
      * @return Builder|Relation
41 41
      */
42
-    private function getQuery(Pool $pool, Session $session): Builder|Relation
42
+    private function getQuery(Pool $pool, Session $session): Builder | Relation
43 43
     {
44 44
         return $session->payables()
45 45
             ->select('payables.*')
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
             ->each(function($payable) use($amount) {
80 80
                 $payable->amount = $amount;
81 81
             });
82
-        if(!$pool->remit_planned)
82
+        if (!$pool->remit_planned)
83 83
         {
84 84
             return $payables;
85 85
         }
86 86
 
87 87
         // When the number of remitments is planned, the list is padded to the expected number.
88 88
         $remitmentCount = $this->summaryService->getSessionRemitmentCount($pool, $session);
89
-        $emptyPayable = (object)[
89
+        $emptyPayable = (object) [
90 90
             'id' => 0,
91 91
             'member' =>trans('tontine.remitment.labels.not-assigned'),
92 92
             'amount' => $amount,
@@ -122,18 +122,18 @@  discard block
 block discarded – undo
122 122
      */
123 123
     public function savePlannedRemitment(Pool $pool, Session $session, int $payableId): void
124 124
     {
125
-        if(!$pool->remit_planned || $pool->remit_auction)
125
+        if (!$pool->remit_planned || $pool->remit_auction)
126 126
         {
127 127
             // Only when remitments are planned and without auctions.
128 128
             return;
129 129
         }
130 130
         // The payable is supposed to already have been associated to the session.
131 131
         $payable = $this->getPayable($pool, $session, $payableId);
132
-        if(!$payable)
132
+        if (!$payable)
133 133
         {
134 134
             throw new MessageException(trans('tontine.subscription.errors.not_found'));
135 135
         }
136
-        if($payable->remitment)
136
+        if ($payable->remitment)
137 137
         {
138 138
             return;
139 139
         }
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
             ->whereDoesntHave('remitment')
159 159
             ->whereIn('subscription_id', $pool->subscriptions()->pluck('id'))
160 160
             ->find($payableId);
161
-        if(!$payable)
161
+        if (!$payable)
162 162
         {
163 163
             throw new MessageException(trans('tontine.subscription.errors.not_found'));
164 164
         }
165
-        if($payable->session_id !== null && $payable->session_id !== $session->id)
165
+        if ($payable->session_id !== null && $payable->session_id !== $session->id)
166 166
         {
167 167
             // The selected member is already planned on another session.
168 168
             throw new MessageException(trans('tontine.remitment.errors.planning'));
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
             // Create the remitment.
176 176
             $remitment = $payable->remitment()->create([]);
177 177
 
178
-            if($pool->remit_auction && $auction > 0)
178
+            if ($pool->remit_auction && $auction > 0)
179 179
             {
180 180
                 // Create the corresponding auction.
181 181
                 Auction::create([
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         $payable = $this->getQuery($pool, $session)
203 203
             ->with(['remitment', 'remitment.auction'])
204 204
             ->find($payableId);
205
-        if(!$payable || !($remitment = $payable->remitment))
205
+        if (!$payable || !($remitment = $payable->remitment))
206 206
         {
207 207
             return;
208 208
         }
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
             $remitment->auction()->delete();
213 213
             $remitment->delete();
214 214
             // Detach from the session, but only if the remitment was not planned.
215
-            if(!$pool->remit_planned || $pool->remit_auction)
215
+            if (!$pool->remit_planned || $pool->remit_auction)
216 216
             {
217 217
                 $payable->session()->dissociate();
218 218
                 $payable->save();
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
             ->with(['payable', 'member'])
238 238
             ->select('subscriptions.*')
239 239
             ->get();
240
-        if($pool->remit_planned && !$pool->remit_auction)
240
+        if ($pool->remit_planned && !$pool->remit_auction)
241 241
         {
242 242
             // Only the beneficiaries that are not yet planned.
243 243
             return $subscriptions
Please login to merge, or discard this patch.
src/Validation/Meeting/SavingValidator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,13 +34,13 @@
 block discarded – undo
34 34
             'amount' => 'required|regex:/^\d+(\.\d{1,2})?$/',
35 35
             'fund' => 'required|integer|min:0',
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'] = $this->localeService->convertMoneyToInt((float)$validated['amount']);
43
+        $validated['amount'] = $this->localeService->convertMoneyToInt((float) $validated['amount']);
44 44
         return $validated;
45 45
     }
46 46
 }
Please login to merge, or discard this patch.
app/Ajax/Web/Meeting/Saving/Member.php 1 patch
Spacing   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -46,9 +46,8 @@  discard block
 block discarded – undo
46 46
 
47 47
     protected function getFundId()
48 48
     {
49
-        $this->fundId = (int)($this->target()->method() === 'home' ?
50
-            $this->target()->args()[0] :
51
-            $this->bag('meeting.saving')->get('fund.id', 0));
49
+        $this->fundId = (int) ($this->target()->method() === 'home' ?
50
+            $this->target()->args()[0] : $this->bag('meeting.saving')->get('fund.id', 0));
52 51
     }
53 52
 
54 53
     /**
@@ -137,7 +136,7 @@  discard block
 block discarded – undo
137 136
      */
138 137
     public function editSaving(int $memberId)
139 138
     {
140
-        if($this->session->closed)
139
+        if ($this->session->closed)
141 140
         {
142 141
             $this->notify->warning(trans('meeting.warnings.session.closed'));
143 142
             return $this->response;
@@ -170,14 +169,14 @@  discard block
 block discarded – undo
170 169
      */
171 170
     public function saveSaving(int $memberId, string $amount)
172 171
     {
173
-        if($this->session->closed)
172
+        if ($this->session->closed)
174 173
         {
175 174
             $this->notify->warning(trans('meeting.warnings.session.closed'));
176 175
             return $this->response;
177 176
         }
178 177
 
179 178
         $amount = str_replace(',', '.', trim($amount));
180
-        if($amount === '')
179
+        if ($amount === '')
181 180
         {
182 181
             $this->savingService->deleteSaving($this->session, 0, $memberId);
183 182
 
Please login to merge, or discard this patch.