Passed
Push — main ( 3c28f3...bb1b4c )
by Thierry
06:38 queued 28s
created
src/Service/Tontine/GuestService.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
         $guest = User::where('email', $guestEmail)
110 110
             ->with('guest_invites', fn($query) => $query->where('host_id', $host->id))
111 111
             ->first();
112
-        if(!$guest)
112
+        if (!$guest)
113 113
         {
114 114
             throw new MessageException(trans('tontine.invite.errors.user_not_found'));
115 115
         }
116
-        if($guest->id === $host->id || $guest->guest_invites->count() > 0)
116
+        if ($guest->id === $host->id || $guest->guest_invites->count() > 0)
117 117
         {
118 118
             throw new MessageException(trans('tontine.invite.errors.cannot_invite'));
119 119
         }
@@ -137,15 +137,15 @@  discard block
 block discarded – undo
137 137
      */
138 138
     public function acceptInvite(int $inviteId)
139 139
     {
140
-        if(!($invite = $this->getGuestInvite($inviteId)))
140
+        if (!($invite = $this->getGuestInvite($inviteId)))
141 141
         {
142 142
             throw new MessageException(trans('tontine.invite.errors.invite_not_found'));
143 143
         }
144
-        if($invite->is_expired)
144
+        if ($invite->is_expired)
145 145
         {
146 146
             throw new MessageException(trans('tontine.invite.errors.invite_expired'));
147 147
         }
148
-        if(!$invite->is_pending)
148
+        if (!$invite->is_pending)
149 149
         {
150 150
             throw new MessageException(trans('tontine.invite.errors.not_allowed'));
151 151
         }
@@ -161,15 +161,15 @@  discard block
 block discarded – undo
161 161
      */
162 162
     public function refuseInvite(int $inviteId)
163 163
     {
164
-        if(!($invite = $this->getGuestInvite($inviteId)))
164
+        if (!($invite = $this->getGuestInvite($inviteId)))
165 165
         {
166 166
             throw new MessageException(trans('tontine.invite.errors.invite_not_found'));
167 167
         }
168
-        if($invite->is_expired)
168
+        if ($invite->is_expired)
169 169
         {
170 170
             throw new MessageException(trans('tontine.invite.errors.invite_expired'));
171 171
         }
172
-        if(!$invite->is_pending)
172
+        if (!$invite->is_pending)
173 173
         {
174 174
             throw new MessageException(trans('tontine.invite.errors.not_allowed'));
175 175
         }
@@ -185,15 +185,15 @@  discard block
 block discarded – undo
185 185
      */
186 186
     public function cancelInvite(int $inviteId)
187 187
     {
188
-        if(!($invite = $this->getHostInvite($inviteId)))
188
+        if (!($invite = $this->getHostInvite($inviteId)))
189 189
         {
190 190
             throw new MessageException(trans('tontine.invite.errors.invite_not_found'));
191 191
         }
192
-        if($invite->is_expired)
192
+        if ($invite->is_expired)
193 193
         {
194 194
             throw new MessageException(trans('tontine.invite.errors.invite_expired'));
195 195
         }
196
-        if(!$invite->is_pending)
196
+        if (!$invite->is_pending)
197 197
         {
198 198
             throw new MessageException(trans('tontine.invite.errors.not_allowed'));
199 199
         }
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
      */
225 225
     public function deleteHostInvite(int $inviteId)
226 226
     {
227
-        if(!($invite = $this->getHostInvite($inviteId)))
227
+        if (!($invite = $this->getHostInvite($inviteId)))
228 228
         {
229 229
             throw new MessageException(trans('tontine.invite.errors.invite_not_found'));
230 230
         }
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
      */
242 242
     public function deleteGuestInvite(int $inviteId): bool
243 243
     {
244
-        if(!($invite = $this->getGuestInvite($inviteId)))
244
+        if (!($invite = $this->getGuestInvite($inviteId)))
245 245
         {
246 246
             throw new MessageException(trans('tontine.invite.errors.invite_not_found'));
247 247
         }
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
     {
284 284
         DB::transaction(function() use($invite, $tontine, $access) {
285 285
             $invite->tontines()->detach($tontine->id);
286
-            if(count($access) > 0)
286
+            if (count($access) > 0)
287 287
             {
288 288
                 $invite->tontines()->attach($tontine->id, ['access' => $access]);
289 289
             }
Please login to merge, or discard this patch.
src/Service/Tontine/TontineService.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     /**
60 60
      * @return Builder|Relation
61 61
      */
62
-    public function getGuestTontinesQuery(): Builder|Relation
62
+    public function getGuestTontinesQuery(): Builder | Relation
63 63
     {
64 64
         return Tontine::whereHas('invites', function(Builder $query) {
65 65
             $query->where('guest_id', $this->tenantService->user()->id);
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     public function getGuestTontine(int $tontineId): ?Tontine
116 116
     {
117 117
         return tap($this->getGuestTontinesQuery()->find($tontineId), function($tontine) {
118
-            if($tontine !== null)
118
+            if ($tontine !== null)
119 119
             {
120 120
                 $tontine->isGuest = true;
121 121
             }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
     public function deleteTontine(int $id)
171 171
     {
172 172
         $tontine = $this->tenantService->user()->tontines()->find($id);
173
-        if(!$tontine)
173
+        if (!$tontine)
174 174
         {
175 175
             return;
176 176
         }
Please login to merge, or discard this patch.
src/Service/TenantService.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         $this->localeService->setCurrency($tontine->currency_code);
57 57
         // Save as latest tontine id if it has changed.
58 58
         $tontineId = $this->user->properties['latest']['tontine'] ?? 0;
59
-        if($tontineId === $tontine->id)
59
+        if ($tontineId === $tontine->id)
60 60
         {
61 61
             return;
62 62
         }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         $this->round = $round;
76 76
         // Save as latest round id if it has changed.
77 77
         $roundId = $this->user->properties['latest']['round'] ?? 0;
78
-        if($roundId === $round->id)
78
+        if ($roundId === $round->id)
79 79
         {
80 80
             return;
81 81
         }
@@ -141,14 +141,14 @@  discard block
 block discarded – undo
141 141
      */
142 142
     public function getGuestAccess(): array
143 143
     {
144
-        if(!$this->tontine || !$this->user)
144
+        if (!$this->tontine || !$this->user)
145 145
         {
146 146
             return [];
147 147
         }
148 148
         $userInvite = $this->tontine->invites()
149 149
             ->where('guest_id', $this->user->id)
150 150
             ->first();
151
-        if(!$userInvite)
151
+        if (!$userInvite)
152 152
         {
153 153
             return [];
154 154
         }
Please login to merge, or discard this patch.
src/Model/GuestInvite.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,13 +93,13 @@
 block discarded – undo
93 93
     {
94 94
         return Attribute::make(
95 95
             get: function() {
96
-                if($this->status === self::STATUS_PENDING) {
96
+                if ($this->status === self::STATUS_PENDING) {
97 97
                     $label = $this->expires_at < now() ? 'expired' : 'expires';
98 98
                     return trans("tontine.invite.active.$label", [
99 99
                         'date' => $this->expires_at->translatedFormat(trans('tontine.date.format_medium')),
100 100
                     ]);
101 101
                 }
102
-                if($this->status === self::STATUS_ACCEPTED) {
102
+                if ($this->status === self::STATUS_ACCEPTED) {
103 103
                     $label = $this->active ? 'active' : 'inactive';
104 104
                     return trans("tontine.invite.active.$label", [
105 105
                         'date' => $this->updated_at->translatedFormat(trans('tontine.date.format_medium')),
Please login to merge, or discard this patch.
src/Validation/Tontine/GuestAccessValidator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
             'meeting.presences' => 'sometimes|required|in:1',
29 29
         ]);
30 30
 
31
-        if($validator->fails())
31
+        if ($validator->fails())
32 32
         {
33 33
             throw new ValidationException($validator);
34 34
         }
Please login to merge, or discard this patch.
app/Ajax/CallableClass.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
         string $bagName, string $attrName = 'page'): array
52 52
     {
53 53
         $perPage = 10;
54
-        $pageCount = (int)floor($itemCount / $perPage) + ($itemCount % $perPage > 0 ? 1 : 0);
55
-        if($pageNumber < 1)
54
+        $pageCount = (int) floor($itemCount / $perPage) + ($itemCount % $perPage > 0 ? 1 : 0);
55
+        if ($pageNumber < 1)
56 56
         {
57 57
             $pageNumber = $this->bag($bagName)->get($attrName, 1);
58 58
         }
59
-        if($pageNumber > $pageCount)
59
+        if ($pageNumber > $pageCount)
60 60
         {
61 61
             $pageNumber = $pageCount;
62 62
         }
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
      */
71 71
     protected function checkGuestAccess(string $section, string $entry)
72 72
     {
73
-        if(!$this->tenantService->userIsGuest())
73
+        if (!$this->tenantService->userIsGuest())
74 74
         {
75 75
             return;
76 76
         }
77 77
 
78 78
         $guestAccess = $this->tenantService->getGuestAccess();
79
-        if(!($guestAccess[$section][$entry] ?? false))
79
+        if (!($guestAccess[$section][$entry] ?? false))
80 80
         {
81 81
             throw new MessageException(trans('tontine.invite.errors.access_denied'));
82 82
         }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     protected function checkRoundSessions()
112 112
     {
113 113
         $round = $this->tenantService->round();
114
-        if(!$round || $round->sessions->count() === 0)
114
+        if (!$round || $round->sessions->count() === 0)
115 115
         {
116 116
             throw new PlanningRoundException(trans('tontine.errors.checks.sessions'));
117 117
         }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         $this->checkRoundSessions();
126 126
 
127 127
         $round = $this->tenantService->round();
128
-        if(!$round || $round->pools->count() === 0)
128
+        if (!$round || $round->pools->count() === 0)
129 129
         {
130 130
             throw new PlanningPoolException(trans('tontine.errors.checks.pools'));
131 131
         }
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
         $this->checkRoundSessions();
141 141
 
142 142
         $tontine = $this->tenantService->tontine();
143
-        if(!$tontine || $tontine->members()->active()->count() === 0)
143
+        if (!$tontine || $tontine->members()->active()->count() === 0)
144 144
         {
145 145
             throw new TontineMemberException(trans('tontine.errors.checks.members'));
146 146
         }
147 147
 
148 148
         $round = $this->tenantService->round();
149
-        if(!$round || $round->sessions->filter(fn($session) =>
149
+        if (!$round || $round->sessions->filter(fn($session) =>
150 150
             ($session->opened || $session->closed))->count() === 0)
151 151
         {
152 152
             throw new MeetingRoundException(trans('tontine.errors.checks.opened_sessions'));
Please login to merge, or discard this patch.
app/Ajax/CallableSelectClass.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
         $this->response->html('sidebar-menu-tontine', $this->render('parts.sidebar.tontine'));
28 28
         $this->jq('a', '#sidebar-menu-tontine')->css('color', self::$activeMenuColor);
29 29
 
30
-        foreach(config('menu.tontine') as $menuId => $menuClass)
30
+        foreach (config('menu.tontine') as $menuId => $menuClass)
31 31
         {
32 32
             $this->jq($menuId)->click($this->rq($menuClass)->home());
33 33
         }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         $this->response->html('sidebar-menu-round', $this->render('parts.sidebar.round'));
50 50
         $this->jq('a', '#sidebar-menu-round')->css('color', self::$activeMenuColor);
51 51
 
52
-        foreach(config('menu.round') as $menuId => $menuClass)
52
+        foreach (config('menu.round') as $menuId => $menuClass)
53 53
         {
54 54
             $this->jq($menuId)->click($this->rq($menuClass)->home());
55 55
         }
Please login to merge, or discard this patch.
app/Ajax/Web/Tontine/Tontine.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
         $this->response->html('section-title', trans('tontine.menus.tontines'));
55 55
         $this->response->html('content-home', $this->render('pages.tontine.home'));
56 56
 
57
-        if(($tontine = $this->tenantService->tontine()))
57
+        if (($tontine = $this->tenantService->tontine()))
58 58
         {
59 59
             $this->selectTontine($tontine);
60 60
         }
61
-        if(($round = $this->tenantService->round()))
61
+        if (($round = $this->tenantService->round()))
62 62
         {
63 63
             $this->selectRound($round);
64 64
         }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         $this->jq('#btn-show-select')->click($this->rq(Select::class)->showTontines());
69 69
 
70 70
         $this->page();
71
-        if($this->tontineService->hasGuestTontines())
71
+        if ($this->tontineService->hasGuestTontines())
72 72
         {
73 73
             $this->cl(Guest\Tontine::class)->home();
74 74
         }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
             'title' => trans('common.actions.cancel'),
117 117
             'class' => 'btn btn-tertiary',
118 118
             'click' => 'close',
119
-        ],[
119
+        ], [
120 120
             'title' => trans('common.actions.save'),
121 121
             'class' => 'btn btn-primary',
122 122
             'click' => $this->rq()->create(pm()->form('tontine-form')),
@@ -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()->update($tontine->id, pm()->form('tontine-form')),
Please login to merge, or discard this patch.
app/Ajax/Web/Tontine/Select.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
             'title' => trans('common.actions.close'),
34 34
             'class' => 'btn btn-tertiary',
35 35
             'click' => 'close',
36
-        ],[
36
+        ], [
37 37
             'title' => trans('common.actions.save'),
38 38
             'class' => 'btn btn-primary',
39 39
             'click' => $this->rq()->saveTontine(pm()->select('tontine_id')->toInt()),
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
     public function saveTontine(int $tontineId)
47 47
     {
48
-        if(!($tontine = $this->tontineService->getUserOrGuestTontine($tontineId)))
48
+        if (!($tontine = $this->tontineService->getUserOrGuestTontine($tontineId)))
49 49
         {
50 50
             return $this->response;
51 51
         }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
         $this->selectTontine($tontine);
58 58
 
59
-        if(($round = $tontine->rounds->first()))
59
+        if (($round = $tontine->rounds->first()))
60 60
         {
61 61
             return $this->saveRound($round->id);
62 62
         }
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
     public function showRounds()
72 72
     {
73
-        if(!($tontine = $this->tenantService->tontine()))
73
+        if (!($tontine = $this->tenantService->tontine()))
74 74
         {
75 75
             return $this->response;
76 76
         }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             'title' => trans('common.actions.close'),
82 82
             'class' => 'btn btn-tertiary',
83 83
             'click' => 'close',
84
-        ],[
84
+        ], [
85 85
             'title' => trans('common.actions.save'),
86 86
             'class' => 'btn btn-primary',
87 87
             'click' => $this->rq()->saveRound(pm()->select('round_id')->toInt()),
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
 
94 94
     public function saveRound(int $roundId)
95 95
     {
96
-        if(!($tontine = $this->tenantService->tontine()))
96
+        if (!($tontine = $this->tenantService->tontine()))
97 97
         {
98 98
             return $this->response;
99 99
         }
100
-        if(!($round = $this->roundService->getRound($roundId)))
100
+        if (!($round = $this->roundService->getRound($roundId)))
101 101
         {
102 102
             return $this->response;
103 103
         }
Please login to merge, or discard this patch.