@@ -35,10 +35,10 @@ |
||
35 | 35 | $post = $this->validator->preUpdate($command); |
36 | 36 | $updatedPost = $this->fromUpdateCommand($command); |
37 | 37 | $this->transactionFactory |
38 | - ->createTransaction(function () use ($updatedPost) { |
|
38 | + ->createTransaction(function() use ($updatedPost) { |
|
39 | 39 | $this->updatingRepository->updatePost($updatedPost); |
40 | 40 | }) |
41 | - ->afterCommit(function () use ($post, $updatedPost) { |
|
41 | + ->afterCommit(function() use ($post, $updatedPost) { |
|
42 | 42 | $this->publisher->publish(new PostUpdatedOEvent($updatedPost, $post->getVersion())); |
43 | 43 | }) |
44 | 44 | ->execute(); |
@@ -23,7 +23,7 @@ |
||
23 | 23 | public function onUserRenamed(UserRenamedPostsIEvent $event): void |
24 | 24 | { |
25 | 25 | $this->transactionFactory |
26 | - ->createTransaction(function () use ($event) { |
|
26 | + ->createTransaction(function() use ($event) { |
|
27 | 27 | $this->securityEventsHandlingRepository->updateUserName( |
28 | 28 | new UpdatedPostsUserNameDto( |
29 | 29 | $event->getOldLogin(), |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | { |
32 | 32 | $this->postValidator->preHandleCommentCreated($event); |
33 | 33 | $this->transactionFactory |
34 | - ->createTransaction(function () use ($event) { |
|
34 | + ->createTransaction(function() use ($event) { |
|
35 | 35 | $this->commentsEventHandlingRepository->updateAllComments( |
36 | 36 | new UpdatePostCommentsDto( |
37 | 37 | $event->getPostId(), |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | $this->postValidator->preHandleCommentsBaselined($event); |
48 | 48 | $this->transactionFactory |
49 | - ->createTransaction(function () use ($event) { |
|
49 | + ->createTransaction(function() use ($event) { |
|
50 | 50 | $this->commentsEventHandlingRepository->updateAllComments( |
51 | 51 | new UpdatePostCommentsDto( |
52 | 52 | $event->getPostId(), |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | /** |
28 | 28 | * @param CommentCreatedPostsIEvent $event |
29 | 29 | */ |
30 | - public function onCommentCreated(CommentCreatedPostsIEvent $event): void |
|
30 | + public function onCommentCreated(CommentCreatedPostsIEvent $event): void |
|
31 | 31 | { |
32 | 32 | $this->postValidator->preHandleCommentCreated($event); |
33 | 33 | $this->transactionFactory |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | ->execute(); |
43 | 43 | } |
44 | 44 | |
45 | - public function onCommentsBaselined(CommentsBaselinedPostsIEvent $event): void |
|
45 | + public function onCommentsBaselined(CommentsBaselinedPostsIEvent $event): void |
|
46 | 46 | { |
47 | 47 | $this->postValidator->preHandleCommentsBaselined($event); |
48 | 48 | $this->transactionFactory |
@@ -105,7 +105,7 @@ |
||
105 | 105 | */ |
106 | 106 | private function validatePostTags(array $tags): void |
107 | 107 | { |
108 | - if (count(Collection::from($tags)->filter(function ($tag) { |
|
108 | + if (count(Collection::from($tags)->filter(function($tag) { |
|
109 | 109 | return trim($tag) == ''; |
110 | 110 | })->toArray()) > 0) { |
111 | 111 | throw new BadRequestHttpException("Post Tags cannot be blank"); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | return new Page(Collection::from( |
35 | 35 | $page->getData() |
36 | 36 | ) |
37 | - ->map(function ($postHeader) { |
|
37 | + ->map(function($postHeader) { |
|
38 | 38 | return $this->toHeaderResponse($postHeader); |
39 | 39 | }) |
40 | 40 | ->toArray(), |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | private function toSinglePostResponse(?PostDto $post): ?FindPostQueryResponse |
81 | 81 | { |
82 | - if($post == null) { |
|
82 | + if ($post == null) { |
|
83 | 83 | return null; |
84 | 84 | } |
85 | 85 | return new FindPostQueryResponse( |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @param FindAllPostsQuery $query |
29 | 29 | * @return Page<FindPostHeaderQueryResponse> |
30 | 30 | */ |
31 | - public function findAllPosts(FindAllPostsQuery $query): Page |
|
31 | + public function findAllPosts(FindAllPostsQuery $query): Page |
|
32 | 32 | { |
33 | 33 | $page = $this->findingRepository->findPosts($query->getPageNo()); |
34 | 34 | return new Page(Collection::from( |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param FindPostByIdQuery $query |
49 | 49 | * @return FindPostQueryResponse|null |
50 | 50 | */ |
51 | - public function findPostById(FindPostByIdQuery $query): ?FindPostQueryResponse |
|
51 | + public function findPostById(FindPostByIdQuery $query): ?FindPostQueryResponse |
|
52 | 52 | { |
53 | 53 | return $this->toSinglePostResponse( |
54 | 54 | $this->findingRepository->findPost($query->getId()) |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | public function updatePost(UpdatePostCommand $command, string $id): Response |
48 | 48 | { |
49 | 49 | $command->setId(new Ulid($id)); |
50 | - if(!$this->isGranted(Permission::EDIT, $command)) { |
|
50 | + if (!$this->isGranted(Permission::EDIT, $command)) { |
|
51 | 51 | throw new UnauthorizedHttpException(Permission::EDIT); |
52 | 52 | } |
53 | 53 | $this->postsApi->updatePost($command); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | public function deletePost(string $id): Response |
63 | 63 | { |
64 | 64 | $command = new DeletePostCommand(new Ulid($id)); |
65 | - if(!$this->isGranted(Permission::DELETE, $command)) { |
|
65 | + if (!$this->isGranted(Permission::DELETE, $command)) { |
|
66 | 66 | throw new UnauthorizedHttpException(Permission::DELETE); |
67 | 67 | } |
68 | 68 | $this->postsApi->deletePost($command); |
@@ -42,7 +42,7 @@ |
||
42 | 42 | |
43 | 43 | $from = $input->getArgument("from"); |
44 | 44 | if ($from != null) { |
45 | - $this->from = \DateTime::createFromFormat("Y-m-d H:i:s", $from . "00:00:00"); |
|
45 | + $this->from = \DateTime::createFromFormat("Y-m-d H:i:s", $from."00:00:00"); |
|
46 | 46 | } |
47 | 47 | $this->postsApi->baseline($this); |
48 | 48 | if ($from != null) { |
@@ -75,7 +75,7 @@ |
||
75 | 75 | */ |
76 | 76 | public function getUserIdentifier(): string |
77 | 77 | { |
78 | - return (string)$this->email; |
|
78 | + return (string) $this->email; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -34,6 +34,6 @@ |
||
34 | 34 | if ($user instanceof User) { |
35 | 35 | return new LoggedInUser($user->getId(), $user->getUserIdentifier(), $user->getRoles()); |
36 | 36 | } |
37 | - throw new \RuntimeException("Unsupported User Class: " . $user::class); |
|
37 | + throw new \RuntimeException("Unsupported User Class: ".$user::class); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | \ No newline at end of file |
@@ -22,7 +22,7 @@ |
||
22 | 22 | /** |
23 | 23 | * @return LoggedInUser |
24 | 24 | */ |
25 | - public function getUser(): LoggedInUser |
|
25 | + public function getUser(): LoggedInUser |
|
26 | 26 | { |
27 | 27 | $user = $this->security->getUser(); |
28 | 28 | if ($user == null) { |