Passed
Pull Request — main (#54)
by Thierry
13:54
created
src/Validation/Meeting/DebtValidator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/Validation/Meeting/DisbursementValidator.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
             '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
 }
Please login to merge, or discard this patch.
src/Validation/Planning/PoolValidator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,13 +42,13 @@
 block discarded – undo
42 42
             'properties.remit.auction' => 'required|boolean',
43 43
             'properties.remit.lendable' => 'required|boolean',
44 44
         ]);
45
-        if($validator->fails())
45
+        if ($validator->fails())
46 46
         {
47 47
             throw new ValidationException($validator);
48 48
         }
49 49
 
50 50
         $validated = $validator->validated();
51
-        $validated['amount'] = $this->localeService->convertMoneyToInt((float)$validated['amount']);
51
+        $validated['amount'] = $this->localeService->convertMoneyToInt((float) $validated['amount']);
52 52
         return $validated;
53 53
     }
54 54
 }
Please login to merge, or discard this patch.
src/Validation/AbstractValidator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
     protected function values(array $values): array
19 19
     {
20 20
         return array_map(function($value) {
21
-            if(!is_string($value))
21
+            if (!is_string($value))
22 22
             {
23 23
                 return $value;
24 24
             }
Please login to merge, or discard this patch.
src/Service/BalanceCalculator.php 1 patch
Spacing   +6 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
         }
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
     public function getPayableAmount(Payable $payable, Session $session): int
99 99
     {
100 100
         $pool = $payable->subscription->pool;
101
-        if($pool->remit_fixed)
101
+        if ($pool->remit_fixed)
102 102
         {
103
-            if($pool->deposit_fixed)
103
+            if ($pool->deposit_fixed)
104 104
             {
105 105
                 return $pool->amount * $this->tenantService->countEnabledSessions($pool);
106 106
             }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function getPoolRemitmentAmount(Pool $pool, Session $session): int
129 129
     {
130
-        if(!$pool->remit_fixed)
130
+        if (!$pool->remit_fixed)
131 131
         {
132 132
             // Sum the amounts for all remitments
133 133
             return $this->getRemitmentQuery(false)
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
                 ->where('subscriptions.pool_id', $pool->id)
136 136
                 ->sum('remitments.amount');
137 137
         }
138
-        if(!$pool->deposit_fixed)
138
+        if (!$pool->deposit_fixed)
139 139
         {
140 140
             // Sum the amounts for all deposits
141 141
             return $this->getPoolDepositAmount($pool, $session);
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         return DB::table('partial_refunds')
276 276
             ->join('debts', 'partial_refunds.debt_id', '=', 'debts.id')
277 277
             ->whereIn('partial_refunds.session_id', $sessionIds)
278
-            ->whereNotExists(function (Builder $query) {
278
+            ->whereNotExists(function(Builder $query) {
279 279
                 $query->select(DB::raw(1))->from('refunds')
280 280
                     ->whereColumn('refunds.debt_id', 'debts.id');
281 281
             })
Please login to merge, or discard this patch.
src/Service/Meeting/SummaryService.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
     {
58 58
         $cashier = 0;
59 59
         $collectedFigures = [];
60
-        foreach($sessions as $session)
60
+        foreach ($sessions as $session)
61 61
         {
62
-            if($session->disabled($pool) || $session->pending)
62
+            if ($session->disabled($pool) || $session->pending)
63 63
             {
64 64
                 $collectedFigures[$session->id] = $this->makeFigures(' ');
65 65
                 continue;
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
             });
110 110
         $sessions = $this->_getSessions($pool, ['payables.remitment']);
111 111
         $figures = new stdClass();
112
-        if($pool->remit_planned)
112
+        if ($pool->remit_planned)
113 113
         {
114 114
             $figures->expected = $this->getExpectedFigures($pool, $sessions, $subscriptions);
115 115
         }
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
133 133
 
134 134
         $figures = [];
135 135
         $position = 0;
136
-        foreach($sessions as $session)
136
+        foreach ($sessions as $session)
137 137
         {
138 138
             $figures[$session->id] = new stdClass();
139 139
             $figures[$session->id]->payables = $session->payables;
140 140
             $figures[$session->id]->count = 0;
141 141
             $figures[$session->id]->amount = '';
142
-            if($session->enabled($pool))
142
+            if ($session->enabled($pool))
143 143
             {
144 144
                 $figures[$session->id]->count =
145 145
                     $this->getRemitmentCount($sessionCount, $subscriptionCount, $position++);
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      */
159 159
     public function getSessionRemitmentCount(Pool $pool, Session $session): int
160 160
     {
161
-        if(!$pool->deposit_fixed)
161
+        if (!$pool->deposit_fixed)
162 162
         {
163 163
             return 1;
164 164
         }
Please login to merge, or discard this patch.
app/helpers.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,12 +35,11 @@
 block discarded – undo
35 35
 {
36 36
     $icon = '<i class="fa fa-toggle-off"></i>';
37 37
     $linkClass = "btn-add-$name";
38
-    if(($payment))
38
+    if (($payment))
39 39
     {
40 40
         $icon = '<i class="fa fa-toggle-on"></i>';
41 41
         $linkClass = "btn-del-$name";
42 42
     }
43 43
 
44
-    return $disableLink ? $icon :
45
-        '<a href="javascript:void(0)" class="' . $linkClass . '">' . $icon . '</a>';
44
+    return $disableLink ? $icon : '<a href="javascript:void(0)" class="' . $linkClass . '">' . $icon . '</a>';
46 45
 }
Please login to merge, or discard this patch.
src/Service/Traits/EventTrait.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
      */
98 98
     protected function chargeCreated(Tontine $tontine, Charge $charge)
99 99
     {
100
-        if(!$charge->period_once)
100
+        if (!$charge->period_once)
101 101
         {
102 102
             return;
103 103
         }
104 104
         $today = now();
105 105
         // Create a tontine bill for each member
106
-        foreach($tontine->members()->get() as $member)
106
+        foreach ($tontine->members()->get() as $member)
107 107
         {
108 108
             $this->createTontineBill($charge, $member, $today);
109 109
         }
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     {
120 120
         $today = now();
121 121
         // Create a tontine bill for each charge
122
-        foreach($tontine->charges()->active()->once()->get() as $charge)
122
+        foreach ($tontine->charges()->active()->once()->get() as $charge)
123 123
         {
124 124
             $this->createTontineBill($charge, $member, $today);
125 125
         }
@@ -142,14 +142,14 @@  discard block
 block discarded – undo
142 142
         ])->get();
143 143
         $roundCharges = $tontine->charges()->active()->round()->get();
144 144
         // Create a round bill for each member
145
-        foreach($members as $member)
145
+        foreach ($members as $member)
146 146
         {
147
-            foreach($roundCharges as $charge)
147
+            foreach ($roundCharges as $charge)
148 148
             {
149 149
                 $count = $member->round_bills->filter(function($bill) use($charge) {
150 150
                     return $bill->charge_id = $charge->id;
151 151
                 })->count();
152
-                if($count === 0)
152
+                if ($count === 0)
153 153
                 {
154 154
                     $this->createRoundBill($charge, $member, $round, $today);
155 155
                 }
@@ -157,14 +157,14 @@  discard block
 block discarded – undo
157 157
         }
158 158
         $tontineCharges = $tontine->charges()->active()->once()->get();
159 159
         // Create a tontine bill for each member
160
-        foreach($members as $member)
160
+        foreach ($members as $member)
161 161
         {
162
-            foreach($tontineCharges as $charge)
162
+            foreach ($tontineCharges as $charge)
163 163
             {
164 164
                 $count = $member->tontine_bills->filter(function($bill) use($charge) {
165 165
                     return $bill->charge_id = $charge->id;
166 166
                 })->count();
167
-                if($count === 0)
167
+                if ($count === 0)
168 168
                 {
169 169
                     $this->createTontineBill($charge, $member, $today);
170 170
                 }
@@ -192,14 +192,14 @@  discard block
 block discarded – undo
192 192
         $sessionCharges = $tontine->charges()->active()->session()->get();
193 193
 
194 194
         // Sync the session bills for each member and each session charge
195
-        foreach($sessionCharges as $charge)
195
+        foreach ($sessionCharges as $charge)
196 196
         {
197
-            foreach($members as $member)
197
+            foreach ($members as $member)
198 198
             {
199 199
                 $count = $member->session_bills->filter(function($bill) use($charge) {
200 200
                     return $bill->charge_id = $charge->id;
201 201
                 })->count();
202
-                if($count === 0)
202
+                if ($count === 0)
203 203
                 {
204 204
                     $this->createSessionBill($charge, $member, $session, $today);
205 205
                 }
@@ -207,15 +207,15 @@  discard block
 block discarded – undo
207 207
         };
208 208
 
209 209
         // Sync the receivables for each subscription on each pool
210
-        foreach($session->round->pools as $pool)
210
+        foreach ($session->round->pools as $pool)
211 211
         {
212
-            if($session->enabled($pool))
212
+            if ($session->enabled($pool))
213 213
             {
214 214
                 $subscriptions = $pool->subscriptions()
215 215
                     ->whereDoesntHave('receivables', function(Builder $query) use($session) {
216 216
                         return $query->where('session_id', $session->id);
217 217
                     });
218
-                foreach($subscriptions->get() as $subscription)
218
+                foreach ($subscriptions->get() as $subscription)
219 219
                 {
220 220
                     $subscription->receivables()->create(['session_id' => $session->id]);
221 221
                 }
Please login to merge, or discard this patch.
src/Service/Meeting/Charge/BillService.php 1 patch
Spacing   +2 added lines, -5 removed lines patch added patch discarded remove patch
@@ -93,9 +93,7 @@  discard block
 block discarded – undo
93 93
     private function getBillRelation(Charge $charge): string
94 94
     {
95 95
         // The intermediate relation to reach the member model.
96
-        return $charge->is_variable ? 'libre_bill' :
97
-            ($charge->period_session ? 'session_bill' :
98
-            ($charge->period_round ? 'round_bill' : 'tontine_bill'));
96
+        return $charge->is_variable ? 'libre_bill' : ($charge->period_session ? 'session_bill' : ($charge->period_round ? 'round_bill' : 'tontine_bill'));
99 97
     }
100 98
 
101 99
     /**
@@ -111,8 +109,7 @@  discard block
 block discarded – undo
111 109
         string $search = '', ?bool $onlyPaid = null, int $page = 0): Collection
112 110
     {
113 111
         $billRelation = $this->getBillRelation($charge);
114
-        $billRelations = !$charge->is_variable ? [$billRelation . '.member', 'settlement'] :
115
-            ['libre_bill.session', 'libre_bill.member', 'settlement'];
112
+        $billRelations = !$charge->is_variable ? [$billRelation . '.member', 'settlement'] : ['libre_bill.session', 'libre_bill.member', 'settlement'];
116 113
         $query = $this->getBillsQuery($charge, $session, $billRelation, $search, $onlyPaid);
117 114
 
118 115
         return $query->with($billRelations)
Please login to merge, or discard this patch.