1 <?php
declare(strict_types
=1);
4 * This file is part of the Rapsys TreeBundle package.
6 * (c) Raphaël Gertz <symfony@rapsys.eu>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Rapsys\TreeBundle\Controller
;
14 use Psr\Container\ContainerInterface
;
16 use Symfony\Bundle\FrameworkBundle\Controller\AbstractController
;
17 use Symfony\Component\HttpFoundation\Request
;
18 use Symfony\Component\HttpFoundation\Response
;
25 class TreeController
extends AbstractController
{
29 protected array $context = [];
32 * Creates a new tree controller
34 * @param ContainerInterface $container The ContainerInterface instance
35 * @param Environment $twig The twig environment instance
37 function __construct(protected ContainerInterface
$container, protected Environment
$twig) {
45 * @param Request $request The request instance
46 * @return Response The rendered view
48 public function index(Request
$request, string $path): Response
{
50 $response = $this->twig
->render('@RapsysTree/index.html.twig', $this->context
);
51 $response->setEtag(md5($response->getContent()));
52 $response->setPublic();
53 $response->isNotModified($request);