Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| SiteController | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| index | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** @license For full copyright and license information, please see the LICENSE.md file. */ |
| 6 | |
| 7 | namespace App\Presentation\Web; |
| 8 | |
| 9 | defined('AMMONLY_APP') || exit('Direct script access is forbidden.'); |
| 10 | |
| 11 | use Nyholm\Psr7\Response; |
| 12 | use Psr\Http\Message\ResponseInterface; |
| 13 | use Twig\Environment as TwigEnvironment; |
| 14 | |
| 15 | /** |
| 16 | * Site Web Controller. |
| 17 | * |
| 18 | * Handles home page rendering using Twig template engine. |
| 19 | * |
| 20 | * @package App\Presentation\Web |
| 21 | */ |
| 22 | final readonly class SiteController |
| 23 | { |
| 24 | /** |
| 25 | * SiteController constructor. |
| 26 | * |
| 27 | * @param TwigEnvironment $twig Twig template engine. |
| 28 | */ |
| 29 | public function __construct( |
| 30 | private TwigEnvironment $twig, |
| 31 | ) { |
| 32 | } |
| 33 | |
| 34 | public function index(): ResponseInterface |
| 35 | { |
| 36 | $html = $this->twig->render('web/site_index.twig'); |
| 37 | |
| 38 | return new Response(200, ['Content-Type' => 'text/html; charset=utf-8'], $html); |
| 39 | } |
| 40 | } |
| 41 |