From 8b700d9e3078731676d1fc57dec5e3dad6f05eb3 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 6 Oct 2019 17:50:12 +0200 Subject: [PATCH] phpcs fixes --- Controller/BackendController.php | 9 +++++++ Models/Comment.php | 36 ++++++++++++++++++++++++++-- Models/CommentList.php | 19 +++++++++++---- Theme/Backend/Lang/api.en.lang.php | 4 +++- Theme/Backend/Lang/en.lang.php | 4 +++- Theme/Backend/comment-create.tpl.php | 4 +++- Theme/Backend/comment-list.tpl.php | 4 +++- 7 files changed, 69 insertions(+), 11 deletions(-) diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 082f3cf..65e9d09 100644 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -91,6 +91,15 @@ final class BackendController extends Controller return $view; } + /** + * Validate comment create request + * + * @param RequestAbstract $request Request + * + * @return array Returns the validation array of the request + * + * @since 1.0.0 + */ private function validateCommentCreate(RequestAbstract $request) : array { $val = []; diff --git a/Models/Comment.php b/Models/Comment.php index 49ccce1..c781884 100644 --- a/Models/Comment.php +++ b/Models/Comment.php @@ -24,7 +24,13 @@ namespace Modules\Comments\Models; */ class Comment { - private $id = 0; + /** + * ID. + * + * @var int + * @since 1.0.0 + */ + protected int $id = 0; private $createdBy = 0; @@ -34,7 +40,7 @@ class Comment private $title = ''; - private $status = 0; + private int $status = 0; private $content = ''; @@ -42,11 +48,23 @@ class Comment private $ref = null; + /** + * Constructor. + * + * @since 1.0.0 + */ public function __construct() { $this->createdAt = new \DateTime(); } + /** + * Get id. + * + * @return int Model id + * + * @since 1.0.0 + */ public function getId() : int { return $this->id; @@ -102,6 +120,13 @@ class Comment $this->contentRaw = $contentRaw; } + /** + * Get created by + * + * @return int|\phpOMS\Account\Account + * + * @since 1.0.0 + */ public function getCreatedBy() { return $this->createdBy; @@ -112,6 +137,13 @@ class Comment $this->createdBy = $createdBy; } + /** + * Get created at date time + * + * @return \DateTime + * + * @since 1.0.0 + */ public function getCreatedAt() : \DateTime { return $this->createdAt; diff --git a/Models/CommentList.php b/Models/CommentList.php index 21334a2..44726bd 100644 --- a/Models/CommentList.php +++ b/Models/CommentList.php @@ -24,14 +24,23 @@ namespace Modules\Comments\Models; */ class CommentList { - private $id = 0; + /** + * ID. + * + * @var int + * @since 1.0.0 + */ + protected int $id = 0; private $comments = []; - public function __construct() - { - } - + /** + * Get id. + * + * @return int Model id + * + * @since 1.0.0 + */ public function getId() : int { return $this->id; diff --git a/Theme/Backend/Lang/api.en.lang.php b/Theme/Backend/Lang/api.en.lang.php index 98efcf7..e00d723 100644 --- a/Theme/Backend/Lang/api.en.lang.php +++ b/Theme/Backend/Lang/api.en.lang.php @@ -1,4 +1,4 @@ - [ ]]; diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php index 67b1ff7..acc0a5f 100644 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -1,4 +1,4 @@ - [ 'Created' => 'Created', 'Creator' => 'Creator', diff --git a/Theme/Backend/comment-create.tpl.php b/Theme/Backend/comment-create.tpl.php index 28f4812..38ce70a 100644 --- a/Theme/Backend/comment-create.tpl.php +++ b/Theme/Backend/comment-create.tpl.php @@ -1,4 +1,4 @@ -