@@ -8,9 +8,9 @@ |
||
8 | 8 | */ |
9 | 9 | interface TransactionInterface |
10 | 10 | { |
11 | - public function afterCommit($func): self; |
|
11 | + public function afterCommit($func): self; |
|
12 | 12 | |
13 | - public function afterRollback($func): self; |
|
13 | + public function afterRollback($func): self; |
|
14 | 14 | |
15 | - public function execute(): mixed; |
|
15 | + public function execute(): mixed; |
|
16 | 16 | } |
17 | 17 | \ No newline at end of file |
@@ -12,6 +12,6 @@ |
||
12 | 12 | * @param $func |
13 | 13 | * @return TransactionInterface |
14 | 14 | */ |
15 | - public function createTransaction($func): TransactionInterface; |
|
15 | + public function createTransaction($func): TransactionInterface; |
|
16 | 16 | |
17 | 17 | } |
18 | 18 | \ No newline at end of file |
@@ -4,5 +4,5 @@ |
||
4 | 4 | |
5 | 5 | interface LoggedInUserProviderInterface |
6 | 6 | { |
7 | - public function getUser(): LoggedInUser; |
|
7 | + public function getUser(): LoggedInUser; |
|
8 | 8 | } |
9 | 9 | \ No newline at end of file |
@@ -14,7 +14,7 @@ |
||
14 | 14 | if ($body === null) { |
15 | 15 | return ""; |
16 | 16 | } |
17 | - $short = strlen($body) - 1 < $maxLength ? $body : trim(substr($body, 0, $maxLength)). "..."; |
|
18 | - return strip_tags($short) ;; |
|
17 | + $short = strlen($body) - 1 < $maxLength ? $body : trim(substr($body, 0, $maxLength))."..."; |
|
18 | + return strip_tags($short); ; |
|
19 | 19 | } |
20 | 20 | } |
21 | 21 | \ No newline at end of file |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | private function validatePostExists(Ulid $postId): void |
40 | 40 | { |
41 | - if(!$this->postHeadersFindingRepository->postExists($postId)) { |
|
41 | + if (!$this->postHeadersFindingRepository->postExists($postId)) { |
|
42 | 42 | throw new BadRequestHttpException("Requested Post doesn't exist"); |
43 | 43 | } |
44 | 44 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | private function validateCommentExists(Ulid $commentId): void |
50 | 50 | { |
51 | - if(!$this->commentsFindingRepository->commentExists($commentId)) { |
|
51 | + if (!$this->commentsFindingRepository->commentExists($commentId)) { |
|
52 | 52 | throw new BadRequestHttpException("Requested Parent Comment doesn't exist"); |
53 | 53 | } |
54 | 54 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | public function findPostByTag(FindPostsByTagQuery $query): Page |
32 | 32 | { |
33 | 33 | $client = $this->getClient(); |
34 | - $client->request('GET', '/api/tags/' . $query->getTag()); |
|
34 | + $client->request('GET', '/api/tags/'.$query->getTag()); |
|
35 | 35 | return $this->responseObject($client, Page::class); |
36 | 36 | } |
37 | 37 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | |
44 | - public function createPost(CreateNewPostDto $newPost): Ulid |
|
44 | + public function createPost(CreateNewPostDto $newPost): Ulid |
|
45 | 45 | { |
46 | 46 | $id = new Ulid(); |
47 | 47 | self::$posts = self::$posts->append( |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | return $id; |
62 | 62 | } |
63 | 63 | |
64 | - public function deletePost(DeleteExistingPostDto $dto): void |
|
64 | + public function deletePost(DeleteExistingPostDto $dto): void |
|
65 | 65 | { |
66 | 66 | self::$posts = Collection::from( |
67 | 67 | self::$posts |
@@ -72,13 +72,13 @@ discard block |
||
72 | 72 | ); |
73 | 73 | } |
74 | 74 | |
75 | - public function updatePost(UpdateExistingPostDto $dto): void |
|
75 | + public function updatePost(UpdateExistingPostDto $dto): void |
|
76 | 76 | { |
77 | 77 | foreach (self::$posts |
78 | - ->filter(function ($post) use ($dto) { |
|
79 | - return $post->getId() == $dto->getId(); |
|
80 | - }) |
|
81 | - ->toArray() as $post) { |
|
78 | + ->filter(function ($post) use ($dto) { |
|
79 | + return $post->getId() == $dto->getId(); |
|
80 | + }) |
|
81 | + ->toArray() as $post) { |
|
82 | 82 | $post->setTitle($dto->getTitle()); |
83 | 83 | $post->setBody($dto->getBody()); |
84 | 84 | $post->setSummary($dto->getSummary()); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | { |
66 | 66 | self::$posts = Collection::from( |
67 | 67 | self::$posts |
68 | - ->filter(function ($post) use ($dto) { |
|
68 | + ->filter(function($post) use ($dto) { |
|
69 | 69 | return $post->getId() != $dto->getId(); |
70 | 70 | }) |
71 | 71 | ->toArray() |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | public function updatePost(UpdateExistingPostDto $dto): void |
76 | 76 | { |
77 | 77 | foreach (self::$posts |
78 | - ->filter(function ($post) use ($dto) { |
|
78 | + ->filter(function($post) use ($dto) { |
|
79 | 79 | return $post->getId() == $dto->getId(); |
80 | 80 | }) |
81 | 81 | ->toArray() as $post) { |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | public function findPost(Ulid $id): ?PostDto |
92 | 92 | { |
93 | - $found = self::$posts->find(function ($post) use ($id) { |
|
93 | + $found = self::$posts->find(function($post) use ($id) { |
|
94 | 94 | return $post->getId() == $id; |
95 | 95 | }); |
96 | 96 | return $found == null ? null : new PostDto( |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | |
131 | 131 | public function updateAllComments(UpdatePostCommentsDto $updatedComments, bool $append = true): void |
132 | 132 | { |
133 | - $post = self::$posts->find(function ($post) use ($updatedComments) { |
|
133 | + $post = self::$posts->find(function($post) use ($updatedComments) { |
|
134 | 134 | return $post->getId() == $updatedComments->getPostId(); |
135 | 135 | }); |
136 | 136 | if ($post == null) { |
137 | 137 | throw new \RuntimeException("Unable to Find Post For Comment"); |
138 | 138 | } |
139 | - if($append) { |
|
139 | + if ($append) { |
|
140 | 140 | $data = $post->getComments(); |
141 | 141 | foreach ($updatedComments->getComments() as $newComment) { |
142 | 142 | array_push($data, $newComment); |
@@ -163,10 +163,10 @@ discard block |
||
163 | 163 | public function updateUserName(UpdatedPostsUserNameDto $updatedUserName): void |
164 | 164 | { |
165 | 165 | self::$posts |
166 | - ->filter(function ($post) use ($updatedUserName) { |
|
166 | + ->filter(function($post) use ($updatedUserName) { |
|
167 | 167 | return $post->getCreatedByName() == $updatedUserName->getOldUserName(); |
168 | 168 | }) |
169 | - ->each(function ($post) use ($updatedUserName) { |
|
169 | + ->each(function($post) use ($updatedUserName) { |
|
170 | 170 | $post->setCreatedByName($updatedUserName->getNewUserName()); |
171 | 171 | }) |
172 | 172 | ->realize(); |
@@ -26,25 +26,25 @@ |
||
26 | 26 | |
27 | 27 | public function updatePost(UpdatePostCommand $command): void |
28 | 28 | { |
29 | - $this->getClient()->request('PUT', '/api/admin/posts/' . $command->getId(), [], [], [], $this->json($command)); |
|
29 | + $this->getClient()->request('PUT', '/api/admin/posts/'.$command->getId(), [], [], [], $this->json($command)); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | public function deletePost(DeletePostCommand $command): void |
33 | 33 | { |
34 | - $this->getClient()->request('DELETE', '/api/admin/posts/' . $command->getId()); |
|
34 | + $this->getClient()->request('DELETE', '/api/admin/posts/'.$command->getId()); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | public function findAllPosts(FindAllPostsQuery $query): Page |
38 | 38 | { |
39 | 39 | $client = $this->getClient(); |
40 | - $client->request('GET', '/api/posts/?pageNo=' . $query->getPageNo()); |
|
40 | + $client->request('GET', '/api/posts/?pageNo='.$query->getPageNo()); |
|
41 | 41 | return $this->responseObject($client, Page::class); |
42 | 42 | } |
43 | 43 | |
44 | 44 | public function findPostById(FindPostByIdQuery $query): FindPostQueryResponse |
45 | 45 | { |
46 | 46 | $client = $this->getClient(); |
47 | - $client->request('GET', '/api/posts/' . $query->getId()); |
|
47 | + $client->request('GET', '/api/posts/'.$query->getId()); |
|
48 | 48 | return $this->responseObject($client, FindPostQueryResponse::class); |
49 | 49 | } |
50 | 50 |
@@ -20,7 +20,7 @@ |
||
20 | 20 | public function findPostsByUserId(FindPostsByUserIdQuery $query): Page |
21 | 21 | { |
22 | 22 | $client = $this->getClient(); |
23 | - $client->request('GET', '/api/security/' . $query->getUserId()); |
|
23 | + $client->request('GET', '/api/security/'.$query->getUserId()); |
|
24 | 24 | return $this->responseObject($client, Page::class); |
25 | 25 | } |
26 | 26 |