From 79e0138cfc5b1f1f38eb1336f96b9bfc94c2c59f Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 31 Jul 2021 17:20:49 +0200 Subject: [PATCH] bug fixes and template adjustments --- Controller/ApiController.php | 2 ++ Models/NullQACategory.php | 38 ------------------------------------ Models/QAHelperMapper.php | 22 ++++++++++----------- Models/QAQuestion.php | 2 +- composer.json | 2 +- 5 files changed, 15 insertions(+), 51 deletions(-) delete mode 100755 Models/NullQACategory.php diff --git a/Controller/ApiController.php b/Controller/ApiController.php index b6f7c37..d9a1311 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -438,6 +438,7 @@ final class ApiController extends Controller $this->createModel($request->header->account, $new, QAQuestionVoteMapper::class, 'qa_question_vote', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Vote', 'Sucessfully voted.', $new); } else { + /** @var QAQuestionVote $questionVote */ $new = clone $questionVote; $new->score = (int) $request->getData('type'); @@ -500,6 +501,7 @@ final class ApiController extends Controller $this->createModel($request->header->account, $new, QAAnswerVoteMapper::class, 'qa_answer_vote', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Vote', 'Sucessfully voted.', $new); } else { + /** @var QAAnswerVote $answerVote */ $new = clone $answerVote; $new->score = (int) $request->getData('type'); diff --git a/Models/NullQACategory.php b/Models/NullQACategory.php deleted file mode 100755 index 15c66d7..0000000 --- a/Models/NullQACategory.php +++ /dev/null @@ -1,38 +0,0 @@ -id = $id; - } -} diff --git a/Models/QAHelperMapper.php b/Models/QAHelperMapper.php index 7303597..86975c1 100644 --- a/Models/QAHelperMapper.php +++ b/Models/QAHelperMapper.php @@ -27,18 +27,18 @@ use phpOMS\DataStorage\Database\Query\Builder; */ final class QAHelperMapper extends DataMapperAbstract { - /** - * Get total score of account - * - * @param array $accounts Accounts - * - * @return array - */ - public static function getAccountScore(array $accounts) : array - { + /** + * Get total score of account + * + * @param array $accounts Accounts + * + * @return array + */ + public static function getAccountScore(array $accounts) : array + { $scores = []; - $query = new Builder(self::$db); + $query = new Builder(self::$db); $questionScore = $query->select('qa_question_created_by') ->selectAs('SUM(qa_question_vote_score)', 'score') ->from(QAQuestionVoteMapper::getTable()) @@ -70,5 +70,5 @@ final class QAHelperMapper extends DataMapperAbstract } return $scores; - } + } } diff --git a/Models/QAQuestion.php b/Models/QAQuestion.php index 2000cfc..37d94f9 100755 --- a/Models/QAQuestion.php +++ b/Models/QAQuestion.php @@ -119,7 +119,7 @@ class QAQuestion implements \JsonSerializable /** * App - * @var int + * @var QAApp */ public QAApp $app; diff --git a/composer.json b/composer.json index 7ad134b..7cf5769 100755 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "require-dev": { "phpunit/phpunit": ">=9.4", "friendsofphp/php-cs-fixer": ">=3.0", - "squizlabs/php_codesniffer": ">=3.5", + "squizlabs/php_codesniffer": ">=3.6", "phpmd/phpmd": ">=2.9", "phpstan/phpstan": ">=0.12.58", "phan/phan": ">=3.2.6"