Lines
100.00%
3 / 3
Functions and Methods
100.00%
1 / 1
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Index | 100.00% | 3 / 3 | 100.00% | 1 / 1 | 1 | 100.00% | 1 / 1 | |||
| __invoke | 100.00% | 3 / 3 | 100.00% | 1 / 1 | 1 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | namespace App\Controller\User; | |
| 4 | ||
| 5 | use App\Controller\BaseController; | |
| 6 | use App\Enum\UserRole; | |
| 7 | use App\Repository\UserRepository; | |
| 8 | use Symfony\Component\HttpFoundation\Response; | |
| 9 | use Symfony\Component\Routing\Attribute\Route; | |
| 10 | use Symfony\Component\Security\Http\Attribute\IsGranted; | |
| 11 | ||
| 12 | #[Route('/user', name: 'app_user_index', methods: ['GET'])] | |
| 13 | #[IsGranted(UserRole::ADMIN->value)] | |
| 14 | final class Index extends BaseController | |
| 15 | { | |
| 16 | public function __invoke(UserRepository $userRepository): Response | |
| 17 | { | |
| 18 | return $this->render('user/index.html.twig', [ | |
| 19 | 'users' => $userRepository->findAll(), | |
| 20 | ]); | |
| 21 | } | |
| 22 | } |