Lines 77.77% 7 / 9
Methods 50.00% 1 / 2
Classes 0.00% 0 / 1
Name Lines Methods CRAP
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 __invoke 75.00% 6 / 8 0.00% 0 / 1 2.06
15final readonly class RemoveFormController
16{
17    public function __construct(
18        private DistrictService $districtService,
19        private GetDistrictQueryFactory $queryFactory,
20        private View $view,
21    ) {
22    }
23
24    /**
25     * @param array<string, string> $args
26     */
27    public function __invoke(Request $request, Response $response, array $args): Response
28    {
29        try {
30            $district = $this->districtService->get($this->queryFactory->fromRoute($args, $request));
31        } catch (NotFoundInRepositoryException) {
32            throw new HttpNotFoundException($request);
33        }
34        $templateData = [
35            "title" => "Remove a district",
36            "district" => $district,
37        ];
38        return $this->view->render($response, "remove.html", $templateData);
39    }
40}