<?php
namespace Claromentis\Main\Controller;

$GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"] ?: array()) + array("_6f43ab9e47ba8908" . "15846460580ecc2b" => base64_decode("bWFpbi9lcnJvcl9" . "wYWdlLmh0bWw="), "_aed8da0f19091214b78f80351048517" . "c" => base64_decode("c3Ryb" . "GVu"), "_e55bdd1709343f5b9bb62e" . "0c63f7a9a7" => base64_decode("aXNfb3RoZXJfZXJy" . "b3IudmlzaWJsZQ=="), "_88ded35c42da1dc40c31fe" . "ff4d5ad27e" => base64_decode("VW5oYW5kbGVkIGV4Y2VwdGlvb" . "jog"), "_5e3f28494fd2b91b13299d42d9530" . "05d" => base64_decode("ZXJyb3JfbWVzc2FnZS5ib2R5X2h0" . "bWw="), "_573f5b707c86cf808" . "41982d72fc63a6e" => base64_decode("ZXJyb3JfbWVzc2FnZV9zaW1wbGVfdmlzaWJsZS52aXNpYmx" . "l"), "_ce564760d6a8f682527469" . "ac784d529e" => base64_decode("aXNfcGFnZV9ub3RfZm91bmQudmlzaWJs" . "ZQ=="), "_d5e3acfe493fa2111d22dfb" . "93da33d87" => base64_decode("X1" . "8="), "_6a0c33f2" . "ce951b8a2" . "6b36ac1c8" . "e819f8" => base64_decode("ZGVidWd" . "fc3R5bG" . "VzLnZpc" . "2libGU="), "_a6a875455efd86c023" . "adfa39b53ced69" => base64_decode("ZXJyb3JfbWVzc2FnZV9zaW1wbGUuYm9keQ" . "=="), "_2966c403895516e0181" . "c0b48bc2d8708" => base64_decode("U29tZXRoaW5nIHdlbnQgd3JvbmcgYW5kIHRoYXQncyBhbGwgd2Uga25vdw" . "=="), "_bf2c6b6e584a3500" . "1891ade22e2f0d7f" => base64_decode("ZXh0cmFfc3R5bGVzLmJvZHlf" . "aHRtbA=="), "_fc9d7314a9d9958d8fa" . "0a403ba8ff197" => base64_decode("Z2V0X2NsYX" . "Nz"), "_f5c8a46a9b42bf027f02ec31" . "d65a30d0" => base64_decode("UGFnZ" . "SBub3" . "QgZm9" . "1bmQ="));
use Claromentis\Core\Http\TemplaterCallResponse;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;




class ErrorPageController
{
    protected bool $debug;
    protected LoggerInterface $logger;
    public function __construct(bool $debug = false, LoggerInterface $logger = null)
    {
        $this->debug = $debug;
        $this->logger = $logger ?? new NullLogger();
    }
    public function ShowError(\Exception $e, $request, $code)
    {
        if (!$e instanceof HttpException) {
            $this->logger->error($GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_88ded35c42da1dc40c31feff4d" . "5ad27e"] . $GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_fc9d7314a" . "9d9958d8fa" . "0a403ba8ff" . "197"]($e), $e->getTrace());
        }
        $template = $GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_6f43ab9e47ba89" . "0815846460580ec" . "c2b"];
        $args = [];
        $message = $e->getMessage();
        if ($GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_aed8da0f19091214b78" . "f80351048517c"]($message) == 0) {
            $message = $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_2966c403895516e0181c0b4" . "8bc2d8708"];
        }
        $_ca8a1c63136e75bc7ff724f753b8595f = false;
        if ($e instanceof NotFoundHttpException) {
            $message = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_d5e3acfe493fa2111d22dfb93da3" . "3d87"]($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_f5c8a46a9" . "b42bf027f0" . "2ec31d65a3" . "0d0"]);
            $_ca8a1c63136e75bc7ff724f753b8595f = true;
        }
        if ($this->debug && 1) {
            
            
            
            $_dcf28f63b8bc197606f5dfbeeebd2513 = new HtmlErrorRenderer($this->debug);
            $args[$GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_5e3f28494fd2b91b13299d42d95300" . "5d"]] = $_dcf28f63b8bc197606f5dfbeeebd2513->render($e)->getAsString();
            $args[$GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_bf2c6b6e584a35001891ade" . "22e2f0d7f"]] = $_dcf28f63b8bc197606f5dfbeeebd2513->getStylesheet();
            $args[$GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_6a0c33f2ce951b" . "8a26b36ac1c8e81" . "9f8"]] = true;
        } else {
            $args[$GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_573f5b707c86cf80841982d72f" . "c63a6e"]] = 1;
            $args[$GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_ce564760d6" . "a8f68252746" . "9ac784d529e"]] = $_ca8a1c63136e75bc7ff724f753b8595f;
            $args[$GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_e55bdd1709343f5b9bb62e0c63f7a9a" . "7"]] = !$_ca8a1c63136e75bc7ff724f753b8595f;
            $args[$GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_a6a875455efd86c023adfa39b53ced6" . "9"]] = $message;
        }
        $_678d945258a520c3df1c42fe4b558f34 = $message;
        $response = new TemplaterCallResponse($template, $args, $_678d945258a520c3df1c42fe4b558f34);
        $response->http_status = $code;
        return $response;
    }
}