php csfixes

This commit is contained in:
2022-05-04 13:00:46 +02:00
parent 416a88b93d
commit e19cac168b
12 changed files with 136 additions and 138 deletions

View File

@@ -24,15 +24,25 @@ class PrivateCommentEmbeddable
*/
private ?array $comments = [];
public function getCommentForUser(User $user): string
{
return $this->comments[$user->getId()] ?? '';
}
public function getComments(): ?array
{
return $this->comments;
}
public function getCommentForUser(User $user): string
public function merge(PrivateCommentEmbeddable $newComment): self
{
return $this->comments[$user->getId()] ?? '';
$currentComments = null === $this->getComments() ? [] : $this->getComments();
$mergedComments = $newComment->getComments() + $currentComments;
$this->setComments($mergedComments);
return $this;
}
public function setCommentForUser(User $user, string $content): self
@@ -48,16 +58,4 @@ class PrivateCommentEmbeddable
return $this;
}
public function merge(PrivateCommentEmbeddable $newComment): self
{
$currentComments = null === $this->getComments() ? [] : $this->getComments();
$mergedComments = $newComment->getComments() + $currentComments;
$this->setComments($mergedComments);
return $this;
}
}