Passed
Pull Request — main (#55)
by Thierry
05:38
created
src/Service/Tontine/MemberService.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      *
48 48
      * @return Builder|Relation
49 49
      */
50
-    private function getQuery(string $search = ''): Builder|Relation
50
+    private function getQuery(string $search = ''): Builder | Relation
51 51
     {
52 52
         return $this->tenantService->tontine()->members()
53 53
             ->when($this->filterActive, fn(Builder $query) => $query->active())
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      */
117 117
     private function saveActiveMembers()
118 118
     {
119
-        if(!($tontine = $this->tenantService->tontine()) ||
119
+        if (!($tontine = $this->tenantService->tontine()) ||
120 120
             !($round = $this->tenantService->round()))
121 121
         {
122 122
             return;
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
         // The number of active members is saved in the round, so its current
137 137
         // value can be retrieved forever, even when the membership will change.
138 138
         $round = $this->tenantService->round();
139
-        if(!isset($round->properties['members']))
139
+        if (!isset($round->properties['members']))
140 140
         {
141 141
             // Create and save the property with the content
142 142
             $this->saveActiveMembers();
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
             $tontine = $this->tenantService->tontine();
180 180
             $members = $tontine->members()->createMany($values);
181 181
             // Create members bills
182
-            foreach($members as $member)
182
+            foreach ($members as $member)
183 183
             {
184 184
                 $this->memberCreated($tontine, $member);
185 185
             }
Please login to merge, or discard this patch.
src/Service/Traits/SessionTrait.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      *
123 123
      * @return Builder|Relation
124 124
      */
125
-    private function getSessionsQuery($query, ?Session $currSession, bool $getAfter, bool $withCurr): Builder|Relation
125
+    private function getSessionsQuery($query, ?Session $currSession, bool $getAfter, bool $withCurr): Builder | Relation
126 126
     {
127 127
         $operator = $getAfter ? ($withCurr ? '>=' : '>') : ($withCurr ? '<=' : '<');
128 128
         $currSessionDate = !$currSession ? '' : $currSession->start_at->format('Y-m-d');
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      *
138 138
      * @return Builder|Relation
139 139
      */
140
-    private function getRoundSessionsQuery(?Session $currSession, bool $getAfter, bool $withCurr): Builder|Relation
140
+    private function getRoundSessionsQuery(?Session $currSession, bool $getAfter, bool $withCurr): Builder | Relation
141 141
     {
142 142
         return $this->getSessionsQuery($this->getRoundSessionQuery(), $currSession, $getAfter, $withCurr);
143 143
     }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      *
178 178
      * @return Builder|Relation
179 179
      */
180
-    private function getTontineSessionsQuery(?Session $currSession, bool $getAfter, bool $withCurr): Builder|Relation
180
+    private function getTontineSessionsQuery(?Session $currSession, bool $getAfter, bool $withCurr): Builder | Relation
181 181
     {
182 182
         $query = $this->tenantService->tontine()->sessions();
183 183
         return $this->getSessionsQuery($query, $currSession, $getAfter, $withCurr);
Please login to merge, or discard this patch.
src/Service/Traits/WithTrait.php 1 patch
Spacing   +5 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,11 +25,10 @@  discard block
 block discarded – undo
25 25
      *
26 26
      * @return self
27 27
      */
28
-    public function with(array|string $relation): self
28
+    public function with(array | string $relation): self
29 29
     {
30 30
         $this->withs = is_string($relation) ?
31
-            [...$this->withs, $relation] :
32
-            [...$this->withs, ...$relation];
31
+            [...$this->withs, $relation] : [...$this->withs, ...$relation];
33 32
         return $this;
34 33
     }
35 34
 
@@ -38,11 +37,10 @@  discard block
 block discarded – undo
38 37
      *
39 38
      * @return self
40 39
      */
41
-    public function withCount(array|string $relation): self
40
+    public function withCount(array | string $relation): self
42 41
     {
43 42
         $this->withCounts = is_string($relation) ?
44
-            [...$this->withCounts, $relation] :
45
-            [...$this->withCounts, ...$relation];
43
+            [...$this->withCounts, $relation] : [...$this->withCounts, ...$relation];
46 44
         return $this;
47 45
     }
48 46
 
@@ -51,7 +49,7 @@  discard block
 block discarded – undo
51 49
      *
52 50
      * @return void
53 51
      */
54
-    protected function addWith(Builder|Relation $query)
52
+    protected function addWith(Builder | Relation $query)
55 53
     {
56 54
         $query->when(count($this->withs) > 0, fn() => $query->with($this->withs))
57 55
             ->when(count($this->withCounts) > 0, fn() => $query->withCount($this->withCounts));
Please login to merge, or discard this patch.
src/Service/Meeting/PresenceService.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,8 +66,7 @@
 block discarded – undo
66 66
     public function togglePresence(Session $session, Member $member)
67 67
     {
68 68
         !$session->absents()->find($member->id) ?
69
-            $session->absents()->attach($member->id) :
70
-            $session->absents()->detach($member->id);
69
+            $session->absents()->attach($member->id) : $session->absents()->detach($member->id);
71 70
     }
72 71
 
73 72
     /**
Please login to merge, or discard this patch.
app/Ajax/Web/Meeting/Presence/Member.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
     protected function getSession()
38 38
     {
39
-        if($this->target()->method() === 'home' ||
39
+        if ($this->target()->method() === 'home' ||
40 40
             ($sessionId = $this->bag('presence')->get('session.id')) === 0)
41 41
         {
42 42
             return;
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         $this->jq('.btn-show-member-presences')
112 112
             ->click($this->cl(Presence::class)->rq()->selectMember($memberId));
113 113
 
114
-        if($this->fromHome && $members->count() > 0)
114
+        if ($this->fromHome && $members->count() > 0)
115 115
         {
116 116
             $member = $members->first();
117 117
             $this->cl(Session::class)->show($member);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     public function togglePresence(int $memberId)
141 141
     {
142 142
         $member = $this->memberService->getMember($memberId);
143
-        if(!$member)
143
+        if (!$member)
144 144
         {
145 145
             return $this->response;
146 146
         }
Please login to merge, or discard this patch.
app/Ajax/Web/Meeting/Presence/Session.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
     protected function getMember()
38 38
     {
39
-        if($this->target()->method() === 'home' ||
39
+        if ($this->target()->method() === 'home' ||
40 40
             ($memberId = $this->bag('presence')->get('member.id')) === 0)
41 41
         {
42 42
             return;
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         $this->jq('.btn-show-session-presences')
104 104
             ->click($this->cl(Presence::class)->rq()->selectSession($sessionId));
105 105
 
106
-        if($this->fromHome && $sessions->count() > 0)
106
+        if ($this->fromHome && $sessions->count() > 0)
107 107
         {
108 108
             $session = $sessions->first();
109 109
             $this->cl(Member::class)->show($session);
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     public function togglePresence(int $sessionId)
116 116
     {
117 117
         $session = $this->sessionService->getSession($sessionId);
118
-        if(!$session)
118
+        if (!$session)
119 119
         {
120 120
             return $this->response;
121 121
         }
Please login to merge, or discard this patch.
app/Ajax/Web/Meeting/Presence.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      */
52 52
     public function selectSession(int $sessionId)
53 53
     {
54
-        if(!($session = $this->presenceService->getSession($sessionId)))
54
+        if (!($session = $this->presenceService->getSession($sessionId)))
55 55
         {
56 56
             // Todo: show en error message
57 57
             return $this->response;
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function selectMember(int $memberId)
67 67
     {
68
-        if(!($member = $this->presenceService->getMember($memberId)))
68
+        if (!($member = $this->presenceService->getMember($memberId)))
69 69
         {
70 70
             // Todo: show en error message
71 71
             return $this->response;
Please login to merge, or discard this patch.