<?php
namespace Claromentis\Core\Twig;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"] = (@$GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"] ?: array()) + array("_7313d9106eada68fc893a6d673" . "3b58a6" => base64_decode("VGVtcGxhdGUgZG9lcyBub3QgZ" . "W5kIHdpdGggdGhlICoudHdpZy" . "BleHRlbnNpb24="), "_d155d43" . "a39de93f" . "858123c6" . "b6ce31d8" . "a" => base64_decode("cHJlZ1" . "9tYXRj" . "aA=="), "_e632e86b02887f94d49b7e" . "d76a3ebcdc" => base64_decode("VGVtcGxhdGUg" . "bm90IGZvdW5k"), "_2c83c05de4fa1408a298026dfb8d94" . "b9" => base64_decode("Y2ZnX2Rld" . "mVsb3Blcl" . "9tb2Rl"), "temp" . "late" => base64_decode("dGVtcGxhdGU" . "="), "_69100b7c21efad30d73e" . "5c90a439a5ce" => base64_decode("Ly4qXC50d2" . "lnJC8="), "_523a40c86a0eb0" . "d317646ab2bbd40" . "de8" => base64_decode("Tm8gdGVtcGxhdG" . "UgcmVxdWVzdGVk"));
use Claromentis\Core\Config\Config;
use Claromentis\Core\Http\TwigResponse;
use Claromentis\Core\Http\TwigTemplaterResponse;
use Psr\Http\Message\ServerRequestInterface;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Twig;






class TwigTestController
{
    
    
    
    
    protected $config;
    
    
    
    
    protected $twig_loader;
    public function __construct(Config $config, \Twig\Loader\LoaderInterface $twig_loader)
    {
        $this->config = $config;
        $this->twig_loader = $twig_loader;
    }
    
    
    
    
    
    
    
    public function ShowTwigTemplate(ServerRequestInterface $request)
    {
        return new TwigResponse($this->GetTemplateName($request));
    }
    
    
    
    
    
    
    
    public function ShowHybridTwigTemplate(ServerRequestInterface $request)
    {
        $template = $this->GetTemplateName($request);
        $_678d945258a520c3df1c42fe4b558f34 = $template;
        return new TwigTemplaterResponse($template, [], $_678d945258a520c3df1c42fe4b558f34);
    }
    
    
    
    
    
    
    
    
    
    
    
    protected function GetTemplateName(ServerRequestInterface $request) : string
    {
        $parameters = $request->getQueryParams();
        $template = $request->getAttribute($GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["te" . "mp" . "la" . "te"]) ?: $parameters[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["te" . "mp" . "la" . "te"]] ?? null;
        $_e47cb992e2e9e375e1dab801827a32c4 = $this->config->Get($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_2c83c05de" . "4fa1408a29" . "8026dfb8d9" . "4b9"]) > 0;
        $_268a831bcda9f9cd9c43c5a1a1d23cff = $GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_d155d43" . "a39de93f" . "858123c6" . "b6ce31d8" . "a"]($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_69100b7c21efad30d73e5c9" . "0a439a5ce"], $template);
        if (!$_e47cb992e2e9e375e1dab801827a32c4) {
            throw new NotFoundHttpException();
        }
        if (empty($template)) {
            throw new BadRequestHttpException($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_523a40c86a0eb0d31764" . "6ab2bbd40de8"]);
        }
        if (!$_268a831bcda9f9cd9c43c5a1a1d23cff) {
            throw new BadRequestHttpException($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_7313d9106e" . "ada68fc893a" . "6d6733b58a6"]);
        }
        if (!$this->twig_loader->exists($template)) {
            throw new NotFoundHttpException($GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_e632e86b02887f94d49b7ed76a3ebc" . "dc"]);
        }
        return $template;
    }
}