Passed
Push — main ( 346904...368073 )
by Thierry
05:50
created
src/Service/Meeting/Pool/RemitmentService.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
             ->each(function($payable) use($session) {
120 120
                 $payable->amount = $this->balanceCalculator->getPayableAmount($payable, $session);
121 121
             });
122
-        if(!$pool->remit_planned)
122
+        if (!$pool->remit_planned)
123 123
         {
124 124
             return $payables;
125 125
         }
126 126
 
127 127
         // When the number of remitments is planned, the list is padded to the expected number.
128 128
         $remitmentCount = $this->summaryService->getSessionRemitmentCount($pool, $session);
129
-        $emptyPayable = (object)[
129
+        $emptyPayable = (object) [
130 130
             'id' => 0,
131 131
             'amount' => $pool->amount * $this->tenantService->countEnabledSessions($pool),
132 132
             'remitment' => null,
@@ -161,18 +161,18 @@  discard block
 block discarded – undo
161 161
      */
162 162
     public function savePlannedRemitment(Pool $pool, Session $session, int $payableId): void
163 163
     {
164
-        if(!$pool->remit_planned || $pool->remit_auction)
164
+        if (!$pool->remit_planned || $pool->remit_auction)
165 165
         {
166 166
             // Only when remitments are planned and without auctions.
167 167
             return;
168 168
         }
169 169
         // The payable is supposed to already have been associated to the session.
170 170
         $payable = $this->getPayable($pool, $session, $payableId);
171
-        if(!$payable)
171
+        if (!$payable)
172 172
         {
173 173
             throw new MessageException(trans('tontine.subscription.errors.not_found'));
174 174
         }
175
-        if($payable->remitment)
175
+        if ($payable->remitment)
176 176
         {
177 177
             return;
178 178
         }
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
             ->whereDoesntHave('remitment')
200 200
             ->whereIn('subscription_id', $pool->subscriptions()->pluck('id'))
201 201
             ->find($payableId);
202
-        if(!$payable)
202
+        if (!$payable)
203 203
         {
204 204
             throw new MessageException(trans('tontine.subscription.errors.not_found'));
205 205
         }
206
-        if($payable->session_id !== null && $payable->session_id !== $session->id)
206
+        if ($payable->session_id !== null && $payable->session_id !== $session->id)
207 207
         {
208 208
             // The selected member is already planned on another session.
209 209
             throw new MessageException(trans('tontine.remitment.errors.planning'));
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
             // Create the remitment.
217 217
             $remitment = $payable->remitment()->create(['amount' => $amount]);
218 218
 
219
-            if($pool->remit_auction && $auction > 0)
219
+            if ($pool->remit_auction && $auction > 0)
220 220
             {
221 221
                 // Create the corresponding auction.
222 222
                 Auction::create([
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
         $payable = $this->getQuery($pool, $session)
244 244
             ->with(['remitment', 'remitment.auction'])
245 245
             ->find($payableId);
246
-        if(!$payable || !($remitment = $payable->remitment))
246
+        if (!$payable || !($remitment = $payable->remitment))
247 247
         {
248 248
             return;
249 249
         }
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
             $remitment->auction()->delete();
254 254
             $remitment->delete();
255 255
             // Detach from the session, but only if the remitment was not planned.
256
-            if(!$pool->remit_planned || $pool->remit_auction)
256
+            if (!$pool->remit_planned || $pool->remit_auction)
257 257
             {
258 258
                 $payable->session()->dissociate();
259 259
                 $payable->save();
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
             ->with(['payable', 'member'])
279 279
             ->select('subscriptions.*')
280 280
             ->get();
281
-        if($pool->remit_planned && !$pool->remit_auction)
281
+        if ($pool->remit_planned && !$pool->remit_auction)
282 282
         {
283 283
             // Only the beneficiaries planned for this session.
284 284
             return $subscriptions
Please login to merge, or discard this patch.