Passed
Pull Request — main (#51)
by Thierry
13:39
created
app/Ajax/Web/Planning/Subscription/Member.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,8 +50,7 @@  discard block
 block discarded – undo
50 50
      */
51 51
     protected function getPool()
52 52
     {
53
-        $poolId = $this->target()->method() === 'home' ? $this->target()->args()[0] :
54
-            intval($this->bag('subscription')->get('pool.id'));
53
+        $poolId = $this->target()->method() === 'home' ? $this->target()->args()[0] : intval($this->bag('subscription')->get('pool.id'));
55 54
         $this->pool = $this->poolService->getPool($poolId);
56 55
     }
57 56
 
@@ -71,7 +70,7 @@  discard block
 block discarded – undo
71 70
         $this->response->html('pool-subscription-members', $html);
72 71
         $this->jq('#btn-subscription-members-filter')->click($this->rq()->filter());
73 72
         $this->jq('#btn-subscription-members-refresh')->click($this->rq()->home($poolId));
74
-        if($this->pool->remit_planned)
73
+        if ($this->pool->remit_planned)
75 74
         {
76 75
             $this->jq('#btn-subscription-beneficiaries')
77 76
                 ->click($this->cl(Subscription::class)->rq()->beneficiaries($poolId));
Please login to merge, or discard this patch.
src/Service/Planning/SessionService.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -107,14 +107,14 @@  discard block
 block discarded – undo
107 107
      */
108 108
     public function createSessions(array $values): bool
109 109
     {
110
-        foreach($values as &$value)
110
+        foreach ($values as &$value)
111 111
         {
112 112
             $value['start_at'] = $value['date'] . ' ' . $value['start'] . ':00';
113 113
             $value['end_at'] = $value['date'] . ' ' . $value['end'] . ':00';
114 114
         }
115 115
         DB::transaction(function() use($values) {
116 116
             $sessions = $this->tenantService->round()->sessions()->createMany($values);
117
-            foreach($sessions as $session)
117
+            foreach ($sessions as $session)
118 118
             {
119 119
                 $this->disableSessionOnPools($session);
120 120
             }
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         // Make sure the host belongs to the same tontine
139 139
         $hostId = intval($values['host_id']);
140 140
         $values['host_id'] = null;
141
-        if($hostId > 0)
141
+        if ($hostId > 0)
142 142
         {
143 143
             $values['host_id'] = $this->tenantService->tontine()->members()->find($hostId)->id;
144 144
         }
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
                 $session->delete();
180 180
             });
181 181
         }
182
-        catch(Exception $e)
182
+        catch (Exception $e)
183 183
         {
184 184
             throw new MessageException(trans('tontine.session.errors.delete'));
185 185
         }
@@ -208,13 +208,13 @@  discard block
 block discarded – undo
208 208
     {
209 209
         // When the remitments are planned, don't enable or disable a session
210 210
         // if receivables already exist on the pool.
211
-        if($pool->remit_planned &&
211
+        if ($pool->remit_planned &&
212 212
             $pool->subscriptions()->whereHas('receivables')->count() > 0)
213 213
         {
214 214
             return;
215 215
         }
216 216
 
217
-        if($session->disabled($pool))
217
+        if ($session->disabled($pool))
218 218
         {
219 219
             // Enable the session for the pool.
220 220
             $pool->disabledSessions()->detach($session->id);
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
                 $query->where('session_id', $session->id);
228 228
             })
229 229
             ->count();
230
-        if($receivableQuery > 0)
230
+        if ($receivableQuery > 0)
231 231
         {
232 232
             return;
233 233
         }
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
         $year = now()->format('Y');
245 245
         $date = Carbon::createFromDate($year, 1, 5, 'Africa/Douala')->locale('fr');
246 246
         $sessions = [];
247
-        for($i = 0; $i < 12; $i++)
247
+        for ($i = 0; $i < 12; $i++)
248 248
         {
249 249
             $session = new \stdClass();
250 250
             $session->title = 'Séance de ' . $date->isoFormat('MMMM YYYY');
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -178,8 +178,7 @@
 block discarded – undo
178 178
                 $session->disabledPools()->detach();
179 179
                 $session->delete();
180 180
             });
181
-        }
182
-        catch(Exception $e)
181
+        } catch(Exception $e)
183 182
         {
184 183
             throw new MessageException(trans('tontine.session.errors.delete'));
185 184
         }
Please login to merge, or discard this patch.
src/Service/Meeting/Charge/LibreFeeService.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
                     $member->libre_bills->first()->bill : null;
247 247
             });
248 248
         // Check if there is a settlement target.
249
-        if(!($target = $this->targetService->getTarget($charge, $session)))
249
+        if (!($target = $this->targetService->getTarget($charge, $session)))
250 250
         {
251 251
             return $members;
252 252
         }
@@ -287,12 +287,12 @@  discard block
 block discarded – undo
287 287
         int $memberId, bool $paid, float $amount = 0): void
288 288
     {
289 289
         $member = $this->tenantService->tontine()->members()->find($memberId);
290
-        if(!$member)
290
+        if (!$member)
291 291
         {
292 292
             throw new MessageException(trans('tontine.member.errors.not_found'));
293 293
         }
294 294
 
295
-        if($amount !== 0)
295
+        if ($amount !== 0)
296 296
         {
297 297
             $amount = $this->localeService->convertMoneyToInt($amount);
298 298
         }
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
             $libreBill->session()->associate($session);
310 310
             $libreBill->bill()->associate($bill);
311 311
             $libreBill->save();
312
-            if($paid)
312
+            if ($paid)
313 313
             {
314 314
                 $settlement = new Settlement();
315 315
                 $settlement->bill()->associate($bill);
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
      */
329 329
     public function getBill(Charge $charge, Session $session, int $memberId): ?LibreBill
330 330
     {
331
-        if(!($member = $this->tenantService->tontine()->members()->find($memberId)))
331
+        if (!($member = $this->tenantService->tontine()->members()->find($memberId)))
332 332
         {
333 333
             throw new MessageException(trans('tontine.member.errors.not_found'));
334 334
         }
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
      */
351 351
     public function updateBill(Charge $charge, Session $session, int $memberId, float $amount): void
352 352
     {
353
-        if(!($libreBill = $this->getBill($charge, $session, $memberId)))
353
+        if (!($libreBill = $this->getBill($charge, $session, $memberId)))
354 354
         {
355 355
             return; // throw new MessageException(trans('tontine.bill.errors.not_found'));
356 356
         }
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
      */
370 370
     public function deleteBill(Charge $charge, Session $session, int $memberId): void
371 371
     {
372
-        if(!($libreBill = $this->getBill($charge, $session, $memberId)))
372
+        if (!($libreBill = $this->getBill($charge, $session, $memberId)))
373 373
         {
374 374
             return; // throw new MessageException(trans('tontine.bill.errors.not_found'));
375 375
         }
@@ -377,10 +377,10 @@  discard block
 block discarded – undo
377 377
         DB::transaction(function() use($libreBill, $session) {
378 378
             $bill = $libreBill->bill;
379 379
             $libreBill->delete();
380
-            if($bill !== null)
380
+            if ($bill !== null)
381 381
             {
382 382
                 // Delete the settlement only if it is on the same session
383
-                if($bill->settlement !== null && $bill->settlement->session_id === $session->id)
383
+                if ($bill->settlement !== null && $bill->settlement->session_id === $session->id)
384 384
                 {
385 385
                     $bill->settlement->delete();
386 386
                 }
Please login to merge, or discard this patch.
src/Validation/Meeting/TargetValidator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,13 +36,13 @@
 block discarded – undo
36 36
             'amount' => 'required|regex:/^\d+(\.\d{1,2})?$/',
37 37
             'deadline' => 'required|integer|min:1',
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
 }
Please login to merge, or discard this patch.
app/Ajax/Web/Meeting/Charge/Libre/Member.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     public function page(int $pageNumber = 0)
88 88
     {
89 89
         $search = trim($this->bag('meeting')->get('fee.member.search', ''));
90
-        $paid = (bool)$this->bag('meeting')->get('fee.member.paid', false);
90
+        $paid = (bool) $this->bag('meeting')->get('fee.member.paid', false);
91 91
         $filter = $this->bag('meeting')->get('fee.member.filter', null);
92 92
         $memberCount = $this->feeService->getMemberCount($this->charge,
93 93
             $this->session, $search, $filter);
@@ -147,18 +147,18 @@  discard block
 block discarded – undo
147 147
      */
148 148
     public function addBill(int $memberId, bool $paid, string $amount = '')
149 149
     {
150
-        if($this->session->closed)
150
+        if ($this->session->closed)
151 151
         {
152 152
             $this->notify->warning(trans('meeting.warnings.session.closed'));
153 153
             return $this->response;
154 154
         }
155 155
         $amount = str_replace(',', '.', trim($amount));
156
-        if($amount !== '' && filter_var($amount, FILTER_VALIDATE_FLOAT) === false)
156
+        if ($amount !== '' && filter_var($amount, FILTER_VALIDATE_FLOAT) === false)
157 157
         {
158 158
             $this->notify->error(trans('meeting.errors.amount.invalid', ['amount' => $amount]));
159 159
             return $this->response;
160 160
         }
161
-        $amount = $amount === '' ? 0 : (float)$amount;
161
+        $amount = $amount === '' ? 0 : (float) $amount;
162 162
 
163 163
         $this->feeService->createBill($this->charge, $this->session, $memberId, $paid, $amount);
164 164
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      */
176 176
     public function delBill(int $memberId)
177 177
     {
178
-        if($this->session->closed)
178
+        if ($this->session->closed)
179 179
         {
180 180
             $this->notify->warning(trans('meeting.warnings.session.closed'));
181 181
             return $this->response;
@@ -194,13 +194,13 @@  discard block
 block discarded – undo
194 194
      */
195 195
     public function editBill(int $memberId)
196 196
     {
197
-        if($this->session->closed)
197
+        if ($this->session->closed)
198 198
         {
199 199
             $this->notify->warning(trans('meeting.warnings.session.closed'));
200 200
             return $this->response;
201 201
         }
202 202
         $bill = $this->feeService->getBill($this->charge, $this->session, $memberId);
203
-        if($bill === null || $bill->bill->settlement !== null)
203
+        if ($bill === null || $bill->bill->settlement !== null)
204 204
         {
205 205
             return $this->response;
206 206
         }
@@ -227,21 +227,21 @@  discard block
 block discarded – undo
227 227
      */
228 228
     public function saveBill(int $memberId, string $amount)
229 229
     {
230
-        if($this->session->closed)
230
+        if ($this->session->closed)
231 231
         {
232 232
             $this->notify->warning(trans('meeting.warnings.session.closed'));
233 233
             return $this->response;
234 234
         }
235 235
 
236 236
         $amount = str_replace(',', '.', trim($amount));
237
-        if($amount !== '' && filter_var($amount, FILTER_VALIDATE_FLOAT) === false)
237
+        if ($amount !== '' && filter_var($amount, FILTER_VALIDATE_FLOAT) === false)
238 238
         {
239 239
             $this->notify->error(trans('meeting.errors.amount.invalid', ['amount' => $amount]));
240 240
             return $this->response;
241 241
         }
242
-        $amount = $amount === '' ? 0 : (float)$amount;
242
+        $amount = $amount === '' ? 0 : (float) $amount;
243 243
 
244
-        if(!$amount)
244
+        if (!$amount)
245 245
         {
246 246
             $this->feeService->deleteBill($this->charge, $this->session, $memberId);
247 247
             return $this->page();
Please login to merge, or discard this patch.
app/Ajax/Web/Meeting/Charge/Libre/Target.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
             $this->target()->args()[0] : $this->bag('meeting')->get('charge.id');
68 68
         $this->session = $this->chargeService->getSession($sessionId);
69 69
         $this->charge = $this->chargeService->getCharge($chargeId);
70
-        if($this->session !== null && $this->charge !== null)
70
+        if ($this->session !== null && $this->charge !== null)
71 71
         {
72 72
             $this->target = $this->targetService->getTarget($this->charge, $this->session);
73 73
         }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public function page(int $pageNumber = 0)
105 105
     {
106
-        if($this->target === null)
106
+        if ($this->target === null)
107 107
         {
108 108
             return $this->response;
109 109
         }
@@ -143,16 +143,16 @@  discard block
 block discarded – undo
143 143
      */
144 144
     public function add()
145 145
     {
146
-        if($this->session->closed)
146
+        if ($this->session->closed)
147 147
         {
148 148
             $this->notify->warning(trans('meeting.warnings.session.closed'));
149 149
             return $this->response;
150 150
         }
151
-        if($this->session === null || $this->charge === null)
151
+        if ($this->session === null || $this->charge === null)
152 152
         {
153 153
             return $this->response;
154 154
         }
155
-        if($this->target !== null)
155
+        if ($this->target !== null)
156 156
         {
157 157
             return $this->response;
158 158
         }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
             'title' => trans('common.actions.cancel'),
166 166
             'class' => 'btn btn-tertiary',
167 167
             'click' => 'close',
168
-        ],[
168
+        ], [
169 169
             'title' => trans('common.actions.save'),
170 170
             'class' => 'btn btn-primary',
171 171
             'click' => $this->rq()->create(pm()->form('target-form')),
@@ -184,16 +184,16 @@  discard block
 block discarded – undo
184 184
      */
185 185
     public function create(array $formValues)
186 186
     {
187
-        if($this->session->closed)
187
+        if ($this->session->closed)
188 188
         {
189 189
             $this->notify->warning(trans('meeting.warnings.session.closed'));
190 190
             return $this->response;
191 191
         }
192
-        if($this->session === null || $this->charge === null)
192
+        if ($this->session === null || $this->charge === null)
193 193
         {
194 194
             return $this->response;
195 195
         }
196
-        if($this->target !== null)
196
+        if ($this->target !== null)
197 197
         {
198 198
             return $this->response;
199 199
         }
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
      */
216 216
     public function edit()
217 217
     {
218
-        if($this->session->closed)
218
+        if ($this->session->closed)
219 219
         {
220 220
             $this->notify->warning(trans('meeting.warnings.session.closed'));
221 221
             return $this->response;
222 222
         }
223
-        if($this->target === null)
223
+        if ($this->target === null)
224 224
         {
225 225
             return $this->response;
226 226
         }
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
             'title' => trans('common.actions.cancel'),
235 235
             'class' => 'btn btn-tertiary',
236 236
             'click' => 'close',
237
-        ],[
237
+        ], [
238 238
             'title' => trans('common.actions.save'),
239 239
             'class' => 'btn btn-primary',
240 240
             'click' => $this->rq()->update(pm()->form('target-form')),
@@ -254,12 +254,12 @@  discard block
 block discarded – undo
254 254
      */
255 255
     public function update(array $formValues)
256 256
     {
257
-        if($this->session->closed)
257
+        if ($this->session->closed)
258 258
         {
259 259
             $this->notify->warning(trans('meeting.warnings.session.closed'));
260 260
             return $this->response;
261 261
         }
262
-        if($this->target === null)
262
+        if ($this->target === null)
263 263
         {
264 264
             return $this->response;
265 265
         }
@@ -281,11 +281,11 @@  discard block
 block discarded – undo
281 281
      */
282 282
     public function remove()
283 283
     {
284
-        if($this->session === null || $this->charge === null)
284
+        if ($this->session === null || $this->charge === null)
285 285
         {
286 286
             return $this->response;
287 287
         }
288
-        if($this->target === null)
288
+        if ($this->target === null)
289 289
         {
290 290
             return $this->response;
291 291
         }
Please login to merge, or discard this patch.