<?php
namespace Claromentis\Core\Twig;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"] = (@$GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"] ?: array()) + array("temp" . "late" => base64_decode("dGVtcG" . "xhdGU="), "_2c83c05de4fa1408a298026df" . "b8d94b9" => base64_decode("Y2ZnX2RldmVsb3Blcl9tb2" . "Rl"), "_7313d9106eada68fc893a6d6733b58" . "a6" => base64_decode("VGVtcGxhdGUgZG9lcyBub3QgZW5kIHdpdGggdGhlICoudHdpZyBleH" . "RlbnNpb24="), "_d155d43a39" . "de93f858123" . "c6b6ce31d8a" => base64_decode("cHJl" . "Z19t" . "YXRj" . "aA=="), "_523a40c86a0eb0d317646a" . "b2bbd40de8" => base64_decode("Tm8gdGVtcGxh" . "dGUgcmVxdWVz" . "dGVk"), "_69100b7c21efad3" . "0d73e5c90a439a5c" . "e" => base64_decode("Ly4qXC50d2lnJC" . "8="), "_e632e86b02887" . "f94d49b7ed76a3" . "ebcdc" => base64_decode("VGVtcGxhdGUgbm90IGZ" . "vdW5k"));
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["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["templ" . "ate"]) ?: $parameters[$GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["temp" . "late"]] ?? null;
        $_e47cb992e2e9e375e1dab801827a32c4 = $this->config->Get($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_2c83c05de4fa1408a298026dfb" . "8d94b9"]) > 0;
        $_268a831bcda9f9cd9c43c5a1a1d23cff = $GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_d155d43a39de93" . "f858123c6b6ce31" . "d8a"]($GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_69100b7c21efad3" . "0d73e5c90a439a5c" . "e"], $template);
        if (!$_e47cb992e2e9e375e1dab801827a32c4) {
            throw new NotFoundHttpException();
        }
        if (empty($template)) {
            throw new BadRequestHttpException($GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_523a40c86a0eb0d317646" . "ab2bbd40de8"]);
        }
        if (!$_268a831bcda9f9cd9c43c5a1a1d23cff) {
            throw new BadRequestHttpException($GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_7313d9106eada68fc893a6" . "d6733b58a6"]);
        }
        if (!$this->twig_loader->exists($template)) {
            throw new NotFoundHttpException($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_e632e86b02887f94d49b7ed76a3e" . "bcdc"]);
        }
        return $template;
    }
}