Lines 100.00% 11 / 11
Methods 100.00% 1 / 1
Classes 100.00% 1 / 1
Name Lines Methods CRAP
 __invoke 100.00% 11 / 11 100.00% 1 / 1 4
24final class Read extends BaseController
25{
26    public function __invoke(string $agentName, UserRepository $userRepository, DoneBannerRepository $doneBannerRepository, BannerMap $bannerMap): Response
27    {
28        $agent = $userRepository->findOneByAgentName($agentName);
29        $bannergress = $agent instanceof User && $agent->isVisible(ProfilePart::BANNERGRESS) ? Bannergress::fromStored($agent->getBannergress()) : null;
30        if (!$bannergress instanceof Bannergress) {
31            throw $this->createNotFoundException('No Bannergress of '.$agentName.' to show.');
32        }
33
34        $doneBanners = $doneBannerRepository->findByOwner($agent);
35
36        return $this->render('banners/index.html.twig', [
37            'bannergress' => $bannergress,
38            'doneBanners' => $doneBanners,
39            'mapPoints' => $bannerMap->points($bannergress, $doneBanners),
40            'agent' => $agent,
41        ]);
42    }
43}