Lines
100.00%
8 / 8
Functions and Methods
100.00%
1 / 1
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| AboutController | 100.00% | 8 / 8 | 100.00% | 1 / 1 | 1 | 100.00% | 1 / 1 | |||
| __invoke | 100.00% | 8 / 8 | 100.00% | 1 / 1 | 1 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | namespace App\Controller\System; | |
| 4 | ||
| 5 | use App\Controller\BaseController; | |
| 6 | use App\Enum\UserRole; | |
| 7 | use Symfony\Bundle\FrameworkBundle\Console\Application; | |
| 8 | use Symfony\Component\Console\Input\ArrayInput; | |
| 9 | use Symfony\Component\Console\Output\BufferedOutput; | |
| 10 | use Symfony\Component\DependencyInjection\Attribute\Autowire; | |
| 11 | use Symfony\Component\HttpFoundation\Response; | |
| 12 | use Symfony\Component\HttpKernel\KernelInterface; | |
| 13 | use Symfony\Component\Routing\Attribute\Route; | |
| 14 | use Symfony\Component\Security\Http\Attribute\IsGranted; | |
| 15 | ||
| 16 | #[Route('/system/about', name: 'app_system_about', methods: ['GET'])] | |
| 17 | #[IsGranted(UserRole::ADMIN->value)] | |
| 18 | class AboutController extends BaseController | |
| 19 | { | |
| 20 | public function __invoke( | |
| 21 | #[Autowire('%kernel.project_dir%')] string $projectDir, | |
| 22 | KernelInterface $kernel | |
| 23 | ): Response { | |
| 24 | $output = new BufferedOutput(); | |
| 25 | ||
| 26 | $application = new Application($kernel); | |
| 27 | $application->setAutoExit(false); | |
| 28 | $application->run(new ArrayInput(['command' => 'about']), $output); | |
| 29 | ||
| 30 | return $this->render('system/about.html.twig', [ | |
| 31 | 'project_dir' => $projectDir, | |
| 32 | 'systemInfo' => $output->fetch(), | |
| 33 | ]); | |
| 34 | } | |
| 35 | } |