diff --git a/old/src/PointToolsBundle/DTO/Api/MetaPost.php b/old/src/PointToolsBundle/DTO/Api/MetaPost.php deleted file mode 100644 index 3e240fc..0000000 --- a/old/src/PointToolsBundle/DTO/Api/MetaPost.php +++ /dev/null @@ -1,56 +0,0 @@ -post; - } - - public function setPost(?Post $post): void - { - $this->post = $post; - } - - /** - * @return Comment[]|null - */ - public function getComments(): ?array - { - return $this->comments; - } - - /** - * @param Comment[]|null $comments - */ - public function setComments(?array $comments): void - { - $this->comments = $comments; - } - - public function isValid(): bool - { - if (null !== $this->post && $this->post->isValid()) { - return true; - } - - return false; - } -} \ No newline at end of file diff --git a/old/src/PointToolsBundle/DTO/Api/Auth.php b/src/DTO/Api/Auth.php similarity index 60% rename from old/src/PointToolsBundle/DTO/Api/Auth.php rename to src/DTO/Api/Auth.php index 17d9e2e..9eca83e 100644 --- a/old/src/PointToolsBundle/DTO/Api/Auth.php +++ b/src/DTO/Api/Auth.php @@ -1,26 +1,14 @@ token && null !== $this->csRfToken && null === $this->error) { - return true; - } - - return false; + return null !== $this->token && null !== $this->csRfToken && null === $this->error; } -} \ No newline at end of file +} diff --git a/old/src/PointToolsBundle/DTO/Api/Comment.php b/src/DTO/Api/Comment.php similarity index 66% rename from old/src/PointToolsBundle/DTO/Api/Comment.php rename to src/DTO/Api/Comment.php index 34884a7..550aeb2 100644 --- a/old/src/PointToolsBundle/DTO/Api/Comment.php +++ b/src/DTO/Api/Comment.php @@ -1,46 +1,18 @@ postId && null !== $this->number && null !== $this->author && null !== $this->text) { - return true; - } - - return false; + return null !== $this->postId && null !== $this->number && null !== $this->author && null !== $this->text; } -} \ No newline at end of file +} diff --git a/src/DTO/Api/MetaPost.php b/src/DTO/Api/MetaPost.php new file mode 100644 index 0000000..9e31a1b --- /dev/null +++ b/src/DTO/Api/MetaPost.php @@ -0,0 +1,40 @@ +post; + } + + public function setPost(?Post $post): void + { + $this->post = $post; + } + + /** @return Comment[]|null */ + public function getComments(): ?array + { + return $this->comments; + } + + /** @param Comment[]|null $comments */ + public function setComments(?array $comments): void + { + $this->comments = $comments; + } + + public function isValid(): bool + { + return null !== $this->post && $this->post->isValid(); + } +} diff --git a/old/src/PointToolsBundle/DTO/Api/Post.php b/src/DTO/Api/Post.php similarity index 67% rename from old/src/PointToolsBundle/DTO/Api/Post.php rename to src/DTO/Api/Post.php index e8d1819..7cdea5a 100644 --- a/old/src/PointToolsBundle/DTO/Api/Post.php +++ b/src/DTO/Api/Post.php @@ -1,52 +1,21 @@ id = $id; } - /** - * @return string[]|null - */ + /** @return string[]|null */ public function getTags(): ?array { return $this->tags; @@ -71,9 +38,7 @@ class Post implements ValidableInterface $this->tags = $tags; } - /** - * @return string[]|null - */ + /** @return string[]|null */ public function getFiles(): ?array { return $this->files; @@ -144,18 +109,13 @@ class Post implements ValidableInterface public function isValid(): bool { - if ( - null !== $this->id && + return null !== $this->id && null !== $this->author && $this->author->isValid() && null !== $this->text && - null !== $this->created// && + null !== $this->created // @todo check type existence in incoming data //null !== $this->type - ) { - return true; - } - - return false; + ; } } \ No newline at end of file diff --git a/old/src/PointToolsBundle/DTO/Api/PostsPage.php b/src/DTO/Api/PostsPage.php similarity index 50% rename from old/src/PointToolsBundle/DTO/Api/PostsPage.php rename to src/DTO/Api/PostsPage.php index 782669f..d0e4fa1 100644 --- a/old/src/PointToolsBundle/DTO/Api/PostsPage.php +++ b/src/DTO/Api/PostsPage.php @@ -1,33 +1,22 @@ posts; } - /** - * @param MetaPost[]|null $posts - */ + /** @param MetaPost[]|null $posts */ public function setPosts(?array $posts): void { $this->posts = $posts; @@ -45,10 +34,6 @@ class PostsPage implements ValidableInterface public function isValid(): bool { - if (null !== $this->posts) { - return true; - } - - return false; + return null !== $this->posts; } -} \ No newline at end of file +} diff --git a/old/src/PointToolsBundle/DTO/Api/User.php b/src/DTO/Api/User.php similarity index 70% rename from old/src/PointToolsBundle/DTO/Api/User.php rename to src/DTO/Api/User.php index 76657f8..345ccda 100644 --- a/old/src/PointToolsBundle/DTO/Api/User.php +++ b/src/DTO/Api/User.php @@ -1,81 +1,25 @@ error && null !== $this->id && null !== $this->login) { - return true; - } - - return false; + return null === $this->error && null !== $this->id && null !== $this->login; } -} \ No newline at end of file +} diff --git a/old/src/PointToolsBundle/DTO/Api/ValidableInterface.php b/src/DTO/Api/ValidableInterface.php similarity index 59% rename from old/src/PointToolsBundle/DTO/Api/ValidableInterface.php rename to src/DTO/Api/ValidableInterface.php index 20cd4ce..b7050cd 100644 --- a/old/src/PointToolsBundle/DTO/Api/ValidableInterface.php +++ b/src/DTO/Api/ValidableInterface.php @@ -1,7 +1,9 @@