<?php

namespace KupShop\ResponseCacheBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

class FragmentController extends AbstractController
{
    /**
     * @Route("/_fragment/{type}/", requirements={"type"="[a-zA-Z0-9_-]+"})
     */
    public function fragmentAction(string $type)
    {
        $smarty = createSmarty(false, true);
        $response = new Response($smarty->fetch("fragments/{$type}.tpl"));

        return $response;
    }
}
