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