Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleCIBot committed Oct 29, 2023
1 parent d3d0030 commit e5dc28b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
13 changes: 11 additions & 2 deletions src/Console/UpdateBestAnswerCounts.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of fof/best-answer.
*
* Copyright (c) FriendsOfFlarum.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace FoF\BestAnswer\Console;

use Flarum\User\User;
Expand All @@ -12,13 +21,13 @@ class UpdateBestAnswerCounts extends Command
* @var BestAnswerRepository
*/
public $bestAnswers;

public function __construct(BestAnswerRepository $bestAnswers)
{
parent::__construct();
$this->bestAnswers = $bestAnswers;
}

/**
* @var string
*/
Expand Down
6 changes: 2 additions & 4 deletions src/UserBestAnswerCount.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,16 @@ class UserBestAnswerCount
* @var BestAnswerRepository
*/
public $bestAnswers;

public function __construct(BestAnswerRepository $bestAnswers)
{
$this->bestAnswers = $bestAnswers;
}

public function __invoke(UserSerializer $serializer, User $user, array $attributes): array
{
$attributes['bestAnswerCount'] = $user->best_answer_count ?? $this->bestAnswers->calculateBestAnswersForUser($user);

return $attributes;
}


}

0 comments on commit e5dc28b

Please sign in to comment.