Passed
Push — main ( e2b544...6cad5d )
by Slawomir
05:02
created
src/Modules/Tags/Persistence/Doctrine/Entity/TagPostHeader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@
 block discarded – undo
111 111
      */
112 112
     public function getTagPosts(): Collection
113 113
     {
114
-        if($this->tagPosts === null) {
114
+        if ($this->tagPosts === null) {
115 115
             $this->tagPosts = new ArrayCollection();
116 116
         }
117 117
         return $this->tagPosts;
Please login to merge, or discard this patch.
src/Modules/Tags/Domain/Logic/TagsUpdater.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@
 block discarded – undo
24 24
      * @param Ulid $postId
25 25
      * @param array $tags
26 26
      */
27
-   public function createUpdateTags(Ulid $postId, array $tags): void
27
+    public function createUpdateTags(Ulid $postId, array $tags): void
28 28
     {
29 29
         $this->tagsUpdatingRepository->updatePostTags($postId, $tags);
30 30
         $this->deleteEmptyTags();
31 31
     }
32 32
 
33 33
 
34
-   public function deleteEmptyTags(): void
34
+    public function deleteEmptyTags(): void
35 35
     {
36 36
         $this->tagsDeletingRepository->deleteEmptyTags();
37 37
     }
Please login to merge, or discard this patch.
src/Modules/Tags/Domain/Logic/PostsEventsHandler.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function onPostBaselined(PostBaselinedTagsIEvent $event): void
36 36
     {
37
-        $this->transactionFactory->createTransaction(function () use ($event) {
38
-            if($this->postHeadersFindingRepository->postExists($event->getId())) {
37
+        $this->transactionFactory->createTransaction(function() use ($event) {
38
+            if ($this->postHeadersFindingRepository->postExists($event->getId())) {
39 39
                 $this->postEventsTagsRepository->updatePostHeader(
40 40
                     new UpdateExistingTagsPostHeaderDto(
41 41
                         $event->getId(),
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function onPostCreated(PostCreatedTagsIEvent $event): void
73 73
     {
74
-        $this->transactionFactory->createTransaction(function () use ($event) {
74
+        $this->transactionFactory->createTransaction(function() use ($event) {
75 75
             $this->postEventsTagsRepository->createPostHeader(
76 76
                 new CreateNewTagsPostHeaderDto(
77 77
                     $event->getId(),
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      */
95 95
     public function onPostUpdated(PostUpdatedTagsIEvent $event): void
96 96
     {
97
-        $this->transactionFactory->createTransaction(function () use ($event) {
97
+        $this->transactionFactory->createTransaction(function() use ($event) {
98 98
             $this->postEventsTagsRepository->updatePostHeader(
99 99
                 new UpdateExistingTagsPostHeaderDto(
100 100
                     $event->getId(),
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      */
115 115
     public function onPostDeleted(PostDeletedTagsIEvent $event): void
116 116
     {
117
-        $this->transactionFactory->createTransaction(function () use ($event) {
117
+        $this->transactionFactory->createTransaction(function() use ($event) {
118 118
             $this->postEventsTagsRepository->deletePostHeader(
119 119
                 new DeleteExistingTagsPostHeaderDto($event->getId())
120 120
             );
Please login to merge, or discard this patch.
src/Modules/Comments/Domain/Logic/PostEventsHandler.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function onPostBaselined(PostBaselinedCommentsIEvent $event): void
37 37
     {
38
-        $this->transactionFactory->createTransaction(function () use ($event) {
38
+        $this->transactionFactory->createTransaction(function() use ($event) {
39 39
             if ($this->postHeadersFindingRepository->postExists($event->getId())) {
40 40
                 $this->postEventsCommentsRepository->updatePostHeader(
41 41
                     new UpdateExistingCommentsPostHeaderDto(
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function onPostCreated(PostCreatedCommentsIEvent $event): void
67 67
     {
68
-        $this->transactionFactory->createTransaction(function () use ($event) {
68
+        $this->transactionFactory->createTransaction(function() use ($event) {
69 69
             $this->postEventsCommentsRepository->createPostHeader(
70 70
                 new CreateNewCommentsPostHeaderDto(
71 71
                     $event->getId(),
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function onPostUpdated(PostUpdatedCommentsIEvent $event): void
84 84
     {
85
-        $this->transactionFactory->createTransaction(function () use ($event) {
85
+        $this->transactionFactory->createTransaction(function() use ($event) {
86 86
             $this->postEventsCommentsRepository->updatePostHeader(
87 87
                 new UpdateExistingCommentsPostHeaderDto(
88 88
                     $event->getId(),
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      */
101 101
     public function onPostDeleted(PostDeletedCommentsIEvent $event): void
102 102
     {
103
-        $this->transactionFactory->createTransaction(function () use ($event) {
103
+        $this->transactionFactory->createTransaction(function() use ($event) {
104 104
             $this->commentsDeletionRepository->deleteCommentsForPost($event->getId());
105 105
             $this->postEventsCommentsRepository->deletePostHeader(
106 106
                 new DeleteExistingCommentsPostHeaderDto($event->getId())
Please login to merge, or discard this patch.
Posts/Persistence/Doctrine/Repository/DoctrinePostsFindingRepository.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
                     p.id, p.title, p.body, p.summary, p.tags, p.createdById, p.createdByName, p.createdAt, p.updatedAt, p.version
87 87
              ) from $postClass p where p.deletedAt is null";
88 88
         if ($from != null) {
89
-            $dql = $dql . " and p.createdAt >= :from";
89
+            $dql = $dql." and p.createdAt >= :from";
90 90
         }
91 91
         $query = $this->getEntityManager()->createQuery(
92 92
             $dql
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         $postClass = Post::class;
107 107
         $dql = "select p.id as postId from $postClass p where p.deletedAt is not null";
108 108
         if ($from != null) {
109
-            $dql = $dql . " and p.deletedAt >= :from";
109
+            $dql = $dql." and p.deletedAt >= :from";
110 110
         }
111 111
         $query = $this->getEntityManager()->createQuery(
112 112
             $dql
Please login to merge, or discard this patch.
tests/Modules/Comments/Unit/Repository/InMemoryCommentsRepository.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,10 +53,10 @@
 block discarded – undo
53 53
     public function updatePostHeader(UpdateExistingCommentsPostHeaderDto $updatedPostHeader): void
54 54
     {
55 55
         foreach (self::$postHeaders
56
-                     ->filter(function ($header) use ($updatedPostHeader) {
57
-                         return $header->getId() == $updatedPostHeader->getId() && $header->getVersion() <= $updatedPostHeader->getVersion();
58
-                     })
59
-                     ->toArray() as $header) {
56
+                        ->filter(function ($header) use ($updatedPostHeader) {
57
+                            return $header->getId() == $updatedPostHeader->getId() && $header->getVersion() <= $updatedPostHeader->getVersion();
58
+                        })
59
+                        ->toArray() as $header) {
60 60
             $header->setTitle($updatedPostHeader->getTitle());
61 61
             $header->setTags($updatedPostHeader->getTags());
62 62
             $header->setVersion($updatedPostHeader->getVersion());
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     public function updatePostHeader(UpdateExistingCommentsPostHeaderDto $updatedPostHeader): void
54 54
     {
55 55
         foreach (self::$postHeaders
56
-                     ->filter(function ($header) use ($updatedPostHeader) {
56
+                     ->filter(function($header) use ($updatedPostHeader) {
57 57
                          return $header->getId() == $updatedPostHeader->getId() && $header->getVersion() <= $updatedPostHeader->getVersion();
58 58
                      })
59 59
                      ->toArray() as $header) {
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     public function deletePostHeader(DeleteExistingCommentsPostHeaderDto $deletedPostHeader): void
67 67
     {
68 68
         self::$postHeaders = self::$postHeaders->filter(
69
-            function ($header) use ($deletedPostHeader) {
69
+            function($header) use ($deletedPostHeader) {
70 70
                 return $header->getId() != $deletedPostHeader->getId();
71 71
             }
72 72
         )->realize();
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
     public function findPostHeaders(?\DateTime $from = null): array
76 76
     {
77 77
         return self::$postHeaders
78
-            ->filter(function ($header) use ($from) {
78
+            ->filter(function($header) use ($from) {
79 79
                 return $from == null || $header->getCreatedAt() >= $from;
80 80
             })
81
-            ->map(function ($header) {
81
+            ->map(function($header) {
82 82
                 return new CommentsPostHeaderDto(
83 83
                     $header->getId(),
84 84
                     $header->getTitle(),
@@ -94,11 +94,11 @@  discard block
 block discarded – undo
94 94
         $id = new Ulid();
95 95
         $parentComment = null;
96 96
         if ($newComment->getParentId() != null) {
97
-            $parentComment = self::$comments->find(function ($comment) use ($newComment) {
97
+            $parentComment = self::$comments->find(function($comment) use ($newComment) {
98 98
                 return $comment->getId() == $newComment->getParentId();
99 99
             });
100 100
         }
101
-        $post = self::$postHeaders->find(function ($post) use ($newComment) {
101
+        $post = self::$postHeaders->find(function($post) use ($newComment) {
102 102
             return $post->getId() == $newComment->getPostId();
103 103
         });
104 104
         $comment = new InMemoryComment(
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
     public function getCommentsCount(Ulid $postId): int
120 120
     {
121 121
         return self::$postHeaders
122
-            ->filter(function ($post) use ($postId) {
122
+            ->filter(function($post) use ($postId) {
123 123
                 return $post->getId() == $postId;
124 124
             })
125
-            ->map(function ($post) {
125
+            ->map(function($post) {
126 126
                 return count($post->getComments());
127 127
             })
128 128
             ->first();
@@ -131,14 +131,14 @@  discard block
 block discarded – undo
131 131
     public function findCommentsByPostId(Ulid $postId): array
132 132
     {
133 133
         $post = self::$postHeaders
134
-            ->find(function ($post) use ($postId) {
134
+            ->find(function($post) use ($postId) {
135 135
                 return $post->getId() == $postId;
136 136
             });
137 137
         if ($post == null) {
138 138
             return [];
139 139
         }
140 140
         return Collection::from($post->getComments())
141
-            ->map(function ($comment) {
141
+            ->map(function($comment) {
142 142
                 $parentId = $comment->getParentComment() != null ? $comment->getParentComment()->getId() : null;
143 143
                 return new CommentDto(
144 144
                     $comment->getId(),
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         $from = ($pageNo - 1) * self::PAGE_SIZE;
156 156
         $to = $from + self::PAGE_SIZE;
157 157
         $data = self::$comments
158
-            ->map(function ($comment) {
158
+            ->map(function($comment) {
159 159
                 $parentId = $comment->getParentComment() != null ? $comment->getParentComment()->getId() : null;
160 160
                 return new CommentWithPostDto(
161 161
                     $comment->getId(),
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 
170 170
                 );
171 171
             })
172
-            ->sort(function ($c1, $c2) {
172
+            ->sort(function($c1, $c2) {
173 173
                 return $c1->getCreatedAt() < $c2->getCreatedAt() ? 1 : -1;
174 174
             })
175 175
             ->slice($from, $to)
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     public function commentExists(Ulid $commentId): bool
181 181
     {
182 182
         return self::$comments
183
-            ->filter(function ($comment) use ($commentId) {
183
+            ->filter(function($comment) use ($commentId) {
184 184
                 return $comment->getId() == $commentId;
185 185
             })->sizeIsGreaterThan(0);
186 186
     }
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
     public function postExists(Ulid $postId): bool
189 189
     {
190 190
         return self::$postHeaders
191
-            ->filter(function ($post) use ($postId) {
191
+            ->filter(function($post) use ($postId) {
192 192
                 return $post->getId() == $postId;
193 193
             })->sizeIsGreaterThan(0);
194 194
     }
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
     public function deleteCommentsForPost(Ulid $postId)
197 197
     {
198 198
         self::$comments = self::$comments
199
-            ->filter(function ($comment) use ($postId) {
199
+            ->filter(function($comment) use ($postId) {
200 200
                 return $comment->getPost()->getId() != $postId;
201 201
             })
202 202
             ->realize();
203
-        $post = self::$postHeaders->find(function ($post) use ($postId) {
203
+        $post = self::$postHeaders->find(function($post) use ($postId) {
204 204
             $post->getId() == $postId;
205 205
         });
206 206
         if ($post != null) {
Please login to merge, or discard this patch.