diff --git a/src/Console/UpdateBestAnswerCounts.php b/src/Console/UpdateBestAnswerCounts.php index c47c377..ff2ef56 100644 --- a/src/Console/UpdateBestAnswerCounts.php +++ b/src/Console/UpdateBestAnswerCounts.php @@ -1,5 +1,14 @@ bestAnswers = $bestAnswers; } - + /** * @var string */ diff --git a/src/UserBestAnswerCount.php b/src/UserBestAnswerCount.php index 5abd7c5..3b94001 100644 --- a/src/UserBestAnswerCount.php +++ b/src/UserBestAnswerCount.php @@ -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; } - - }