Passed
Pull Request — main (#57)
by Thierry
15:28 queued 13s
created
app/Ajax/Web/Meeting/Credit/PartialRefund.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function addRefund()
84 84
     {
85
-        if($this->session->closed)
85
+        if ($this->session->closed)
86 86
         {
87 87
             $this->notify->warning(trans('meeting.warnings.session.closed'));
88 88
             return $this->response;
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
             'title' => trans('common.actions.cancel'),
96 96
             'class' => 'btn btn-tertiary',
97 97
             'click' => 'close',
98
-        ],[
98
+        ], [
99 99
             'title' => trans('common.actions.save'),
100 100
             'class' => 'btn btn-primary',
101 101
             'click' => $this->rq()->createRefund(pm()->form('refund-form')),
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      */
112 112
     public function createRefund(array $formValues)
113 113
     {
114
-        if($this->session->closed)
114
+        if ($this->session->closed)
115 115
         {
116 116
             $this->notify->warning(trans('meeting.warnings.session.closed'));
117 117
             return $this->response;
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
      */
136 136
     public function deleteRefund(int $refundId)
137 137
     {
138
-        if($this->session->closed)
138
+        if ($this->session->closed)
139 139
         {
140 140
             $this->notify->warning(trans('meeting.warnings.session.closed'));
141 141
             return $this->response;
Please login to merge, or discard this patch.
app/Ajax/Web/Meeting/Credit/Refund.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function createRefund(string $debtId)
94 94
     {
95
-        if($this->session->closed)
95
+        if ($this->session->closed)
96 96
         {
97 97
             $this->notify->warning(trans('meeting.warnings.session.closed'));
98 98
             return $this->response;
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function deleteRefund(int $debtId)
111 111
     {
112
-        if($this->session->closed)
112
+        if ($this->session->closed)
113 113
         {
114 114
             $this->notify->warning(trans('meeting.warnings.session.closed'));
115 115
             return $this->response;
Please login to merge, or discard this patch.
app/Ajax/Web/Meeting/Cash/Disbursement.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
     public function addDisbursement()
63 63
     {
64
-        if($this->session->closed)
64
+        if ($this->session->closed)
65 65
         {
66 66
             $this->notify->warning(trans('meeting.warnings.session.closed'));
67 67
             return $this->response;
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             'title' => trans('common.actions.cancel'),
77 77
             'class' => 'btn btn-tertiary',
78 78
             'click' => 'close',
79
-        ],[
79
+        ], [
80 80
             'title' => trans('common.actions.save'),
81 81
             'class' => 'btn btn-primary',
82 82
             'click' => $this->rq()->createDisbursement(pm()->form('disbursement-form')),
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function createDisbursement(array $formValues)
94 94
     {
95
-        if($this->session->closed)
95
+        if ($this->session->closed)
96 96
         {
97 97
             $this->notify->warning(trans('meeting.warnings.session.closed'));
98 98
             return $this->response;
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
     public function editDisbursement(int $disbursementId)
110 110
     {
111
-        if($this->session->closed)
111
+        if ($this->session->closed)
112 112
         {
113 113
             $this->notify->warning(trans('meeting.warnings.session.closed'));
114 114
             return $this->response;
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
             'title' => trans('common.actions.cancel'),
126 126
             'class' => 'btn btn-tertiary',
127 127
             'click' => 'close',
128
-        ],[
128
+        ], [
129 129
             'title' => trans('common.actions.save'),
130 130
             'class' => 'btn btn-primary',
131 131
             'click' => $this->rq()->updateDisbursement($disbursementId, pm()->form('disbursement-form')),
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
      */
142 142
     public function updateDisbursement(int $disbursementId, array $formValues)
143 143
     {
144
-        if($this->session->closed)
144
+        if ($this->session->closed)
145 145
         {
146 146
             $this->notify->warning(trans('meeting.warnings.session.closed'));
147 147
             return $this->response;
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      */
161 161
     public function deleteDisbursement(int $disbursementId)
162 162
     {
163
-        if($this->session->closed)
163
+        if ($this->session->closed)
164 164
         {
165 165
             $this->notify->warning(trans('meeting.warnings.session.closed'));
166 166
             return $this->response;
Please login to merge, or discard this patch.
app/Console/Commands/ConvertPoolProperties.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
     /**
28 28
      * Execute the console command.
29 29
      *
30
-      * @return int
30
+     * @return int
31 31
      */
32 32
     public function handle()
33 33
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
     public function handle()
30 30
     {
31 31
         $pools = Pool::get();
32
-        foreach($pools as $pool)
32
+        foreach ($pools as $pool)
33 33
         {
34 34
             $currProperties = $pool->properties;
35 35
             $nextProperties = ['deposit' => [], 'remit' => []];
Please login to merge, or discard this patch.
src/Service/Meeting/Saving/ProfitService.php 1 patch
Spacing   +17 added lines, -20 removed lines patch added patch discarded remove patch
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
      *
34 34
      * @return Builder|Relation
35 35
      */
36
-    private function getFundSessionsQuery(Session $currentSession, int $fundId): Builder|Relation
36
+    private function getFundSessionsQuery(Session $currentSession, int $fundId): Builder | Relation
37 37
     {
38 38
         $lastSessionDate = $currentSession->start_at->format('Y-m-d');
39 39
         // The closing sessions ids
40 40
         $closingSessionIds = array_keys($this->savingService->getFundClosings($fundId));
41
-        if(count($closingSessionIds) === 0)
41
+        if (count($closingSessionIds) === 0)
42 42
         {
43 43
             // No closing session yet
44 44
             return $this->tenantService->tontine()->sessions()
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
             ->whereDate('sessions.start_at', '<', $lastSessionDate)
52 52
             ->orderByDesc('sessions.start_at')
53 53
             ->get();
54
-        if($closingSessions->count() === 0)
54
+        if ($closingSessions->count() === 0)
55 55
         {
56 56
             // All the closing sessions are after the current session.
57 57
             return $this->tenantService->tontine()->sessions()
@@ -119,31 +119,31 @@  discard block
 block discarded – undo
119 119
         int $profitAmount): Collection
120 120
     {
121 121
         // Set savings durations and distributions
122
-        foreach($savings as $saving)
122
+        foreach ($savings as $saving)
123 123
         {
124 124
             $saving->duration = $this->getSavingDuration($sessions, $saving);
125 125
             $saving->distribution = $saving->amount * $saving->duration;
126 126
             $saving->profit = 0;
127 127
         }
128 128
         // Reduce the distributions
129
-        $distributionGcd = (int)$savings->reduce(function($gcd, $saving) {
130
-            if($gcd === 0)
129
+        $distributionGcd = (int) $savings->reduce(function($gcd, $saving) {
130
+            if ($gcd === 0)
131 131
             {
132 132
                 return $saving->distribution;
133 133
             }
134
-            if($saving->duration === 0)
134
+            if ($saving->duration === 0)
135 135
             {
136 136
                 return $gcd;
137 137
             }
138 138
             return gmp_gcd($gcd, $saving->distribution);
139 139
         }, $savings->first()->distribution);
140
-        if($distributionGcd > 0)
140
+        if ($distributionGcd > 0)
141 141
         {
142
-            $sum = (int)($savings->sum('distribution') / $distributionGcd);
143
-            foreach($savings as $saving)
142
+            $sum = (int) ($savings->sum('distribution') / $distributionGcd);
143
+            foreach ($savings as $saving)
144 144
             {
145 145
                 $saving->distribution /= $distributionGcd;
146
-                $saving->profit = (int)($profitAmount * $saving->distribution / $sum);
146
+                $saving->profit = (int) ($profitAmount * $saving->distribution / $sum);
147 147
             }
148 148
         }
149 149
 
@@ -171,9 +171,8 @@  discard block
 block discarded – undo
171 171
             ->orderBy('sessions.start_at', 'asc')
172 172
             ->with(['session', 'member']);
173 173
         $savings = $fundId > 0 ?
174
-            $query->where('savings.fund_id', $fundId)->get() :
175
-            $query->whereNull('savings.fund_id')->get();
176
-        if($savings->count() === 0)
174
+            $query->where('savings.fund_id', $fundId)->get() : $query->whereNull('savings.fund_id')->get();
175
+        if ($savings->count() === 0)
177 176
         {
178 177
             return $savings;
179 178
         }
@@ -193,13 +192,13 @@  discard block
 block discarded – undo
193 192
         // The part value makes sense only iwhen there is more than 2 savings
194 193
         // with distribution greater than 0.
195 194
         $savings = $savings->filter(fn($saving) => $saving->distribution > 0);
196
-        if($savings->count() < 2)
195
+        if ($savings->count() < 2)
197 196
         {
198 197
             return 0;
199 198
         }
200 199
 
201 200
         $saving = $savings->first();
202
-        return (int)($saving->amount * $saving->duration / $saving->distribution);
201
+        return (int) ($saving->amount * $saving->duration / $saving->distribution);
203 202
     }
204 203
 
205 204
     /**
@@ -226,8 +225,7 @@  discard block
 block discarded – undo
226 225
             ->select(DB::raw("sum(amount) as total"))
227 226
             ->whereIn('session_id', $sessionIds);
228 227
         $saving = $fundId > 0 ?
229
-            $query->where('savings.fund_id', $fundId)->first() :
230
-            $query->whereNull('savings.fund_id')->first();
228
+            $query->where('savings.fund_id', $fundId)->first() : $query->whereNull('savings.fund_id')->first();
231 229
         return $saving->total ?? 0;
232 230
     }
233 231
 
@@ -248,8 +246,7 @@  discard block
 block discarded – undo
248 246
             ->where('debts.type', Debt::TYPE_INTEREST)
249 247
             ->whereIn('refunds.session_id', $sessionIds);
250 248
         $refund = $fundId > 0 ?
251
-            $query->where('loans.fund_id', $fundId)->first() :
252
-            $query->whereNull('loans.fund_id')->first();
249
+            $query->where('loans.fund_id', $fundId)->first() : $query->whereNull('loans.fund_id')->first();
253 250
         return $refund->total ?? 0;
254 251
     }
255 252
 
Please login to merge, or discard this patch.
src/Service/Meeting/Pool/AuctionService.php 1 patch
Spacing   +3 added lines, -3 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(Session $session, ?bool $onlyPaid = null): Builder|Relation
32
+    private function getQuery(Session $session, ?bool $onlyPaid = null): Builder | Relation
33 33
     {
34 34
         $sessionId = $session->id;
35 35
         $prevSessions = $this->sessionService->getRoundSessionIds($session, withCurr: false);
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
                         $query->where('session_id', $sessionId);
45 45
                     });
46 46
                 });
47
-                if($prevSessions->count() === 0)
47
+                if ($prevSessions->count() === 0)
48 48
                 {
49 49
                     return;
50 50
                 }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     public function toggleAuctionPayment(Session $session, int $auctionId)
114 114
     {
115 115
         $auction = $this->getQuery($session)->find($auctionId);
116
-        if(($auction))
116
+        if (($auction))
117 117
         {
118 118
             $auction->update(['paid' => !$auction->paid]);
119 119
         }
Please login to merge, or discard this patch.
src/Service/Meeting/Pool/PoolService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
      *
45 45
      * @return Builder|Relation
46 46
      */
47
-    private function getQuery(Session $session): Builder|Relation
47
+    private function getQuery(Session $session): Builder | Relation
48 48
     {
49 49
         return Pool::ofSession($session)
50 50
             ->whereHas('subscriptions', function(Builder $query) use($session) {
Please login to merge, or discard this patch.
src/Service/Meeting/Charge/SettlementTargetService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
      *
58 58
      * @return Builder|Relation
59 59
      */
60
-    private function getMembersQuery(string $search = ''): Builder|Relation
60
+    private function getMembersQuery(string $search = ''): Builder | Relation
61 61
     {
62 62
         return $this->tenantService->tontine()->members()->active()
63 63
             ->when($search !== '', function($query) use($search) {
Please login to merge, or discard this patch.
app/Ajax/Web/Meeting/Credit/Loan.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      */
74 74
     public function addLoan()
75 75
     {
76
-        if($this->session->closed)
76
+        if ($this->session->closed)
77 77
         {
78 78
             $this->notify->warning(trans('meeting.warnings.session.closed'));
79 79
             return $this->response;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             'title' => trans('common.actions.cancel'),
92 92
             'class' => 'btn btn-tertiary',
93 93
             'click' => 'close',
94
-        ],[
94
+        ], [
95 95
             'title' => trans('common.actions.save'),
96 96
             'class' => 'btn btn-primary',
97 97
             'click' => $this->rq()->createLoan(pm()->form('loan-form')),
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function createLoan(array $formValues)
110 110
     {
111
-        if($this->session->closed)
111
+        if ($this->session->closed)
112 112
         {
113 113
             $this->notify->warning(trans('meeting.warnings.session.closed'));
114 114
             return $this->response;
115 115
         }
116 116
 
117 117
         $values = $this->validator->validateItem($formValues);
118
-        if(!($member = $this->memberService->getMember($values['member'])))
118
+        if (!($member = $this->memberService->getMember($values['member'])))
119 119
         {
120 120
             $this->notify->warning(trans('tontine.member.errors.not_found'));
121 121
             return $this->response;
@@ -133,19 +133,19 @@  discard block
 block discarded – undo
133 133
      */
134 134
     public function editLoan(int $loanId)
135 135
     {
136
-        if($this->session->closed)
136
+        if ($this->session->closed)
137 137
         {
138 138
             $this->notify->warning(trans('meeting.warnings.session.closed'));
139 139
             return $this->response;
140 140
         }
141 141
         $loan = $this->loanService->getSessionLoan($this->session, $loanId);
142
-        if(!$loan)
142
+        if (!$loan)
143 143
         {
144 144
             $this->notify->warning(trans('meeting.loan.errors.not_found'));
145 145
             return $this->response;
146 146
         }
147 147
         // A refunded loan cannot be updated.
148
-        if($loan->refunds_count > 0)
148
+        if ($loan->refunds_count > 0)
149 149
         {
150 150
             $this->notify->warning(trans('meeting.loan.errors.update'));
151 151
             return $this->response;
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             'title' => trans('common.actions.cancel'),
163 163
             'class' => 'btn btn-tertiary',
164 164
             'click' => 'close',
165
-        ],[
165
+        ], [
166 166
             'title' => trans('common.actions.save'),
167 167
             'class' => 'btn btn-primary',
168 168
             'click' => $this->rq()->updateLoan($loanId, pm()->form('loan-form')),
@@ -179,26 +179,26 @@  discard block
 block discarded – undo
179 179
      */
180 180
     public function updateLoan(int $loanId, array $formValues)
181 181
     {
182
-        if($this->session->closed)
182
+        if ($this->session->closed)
183 183
         {
184 184
             $this->notify->warning(trans('meeting.warnings.session.closed'));
185 185
             return $this->response;
186 186
         }
187 187
         $loan = $this->loanService->getSessionLoan($this->session, $loanId);
188
-        if(!$loan)
188
+        if (!$loan)
189 189
         {
190 190
             $this->notify->warning(trans('meeting.loan.errors.not_found'));
191 191
             return $this->response;
192 192
         }
193 193
         // A refunded loan cannot be updated.
194
-        if($loan->refunds_count > 0)
194
+        if ($loan->refunds_count > 0)
195 195
         {
196 196
             $this->notify->warning(trans('meeting.loan.errors.update'));
197 197
             return $this->response;
198 198
         }
199 199
 
200 200
         $values = $this->validator->validateItem($formValues);
201
-        if(!($member = $this->memberService->getMember($values['member'])))
201
+        if (!($member = $this->memberService->getMember($values['member'])))
202 202
         {
203 203
             $this->notify->warning(trans('tontine.member.errors.not_found'));
204 204
             return $this->response;
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
      */
217 217
     public function deleteLoan(int $loanId)
218 218
     {
219
-        if($this->session->closed)
219
+        if ($this->session->closed)
220 220
         {
221 221
             $this->notify->warning(trans('meeting.warnings.session.closed'));
222 222
             return $this->response;
Please login to merge, or discard this patch.