HomeAction::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 6
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Controller;
6
7
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
8
use Symfony\Component\HttpFoundation\Response;
9
// use Symfony\Component\HttpKernel\Attribute\AsController;
10
use Symfony\Component\HttpKernel\Attribute\Cache;
11
use Symfony\Component\Routing\Attribute\Route;
12
13
/**
14
 * @see StaticRoutesSmokeTest
15
 */
16
// using the AsController attribute is not mandatory when extending the Symfony AbstractController or when using the #Route attribute.
17
// #[AsController]
18
#[Cache(maxage: 3600, public: true)]
19
final class HomeAction extends AbstractController
20
{
21
    /**
22
     * Simple page with some content.
23
     */
24 2
    #[Route(path: '/', name: self::class)]
25
    public function __invoke(): Response
26
    {
27 2
        $readme = (string) file_get_contents(__DIR__.'/../../README.md');
28
29 2
        return $this->render(self::class.'.html.twig', ['readme' => $readme]);
30
    }
31
}
32