<?php
namespace Claromentis\Comments;

$GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"] = (@$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"] ?: array()) + array("_a4a1018258adabb7" . "4e7b04836d8d7e3b" => base64_decode("Tm90IE" . "ZvdW5k"), "_437d31f3e" . "369eaf5211" . "2df78da5be" . "abb" => base64_decode("T25Fc" . "nJvcg" . "=="), "_c8947473" . "60c6ec5bd" . "8169530ea" . "f9c473" => base64_decode("QmFkIFJ" . "lcXVlc3" . "Q="));
use Claromentis\Core\Repository\Exception\NotFoundException;
use Claromentis\Core\Repository\Exception\UnsupportedTypeException;
use Claromentis\Core\Application;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\KernelEvents;







class RestExceptionHandler
{
    
    
    
    
    private $app;
    
    
    
    
    public function __construct(Application $app)
    {
        $this->app = $app;
    }
    
    
    
    
    public function OnError(GetResponseForExceptionEvent $event)
    {
        $_fe441aa3ef350bfb1a1a1ad8520dd530 = $event->getException();
        if ($_fe441aa3ef350bfb1a1a1ad8520dd530 instanceof NotFoundException) {
            $event->setException(new \RestExNotFound($_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage(), $GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_a4a1018258adabb74" . "e7b04836d8d7e3b"], $_fe441aa3ef350bfb1a1a1ad8520dd530));
            return;
        }
        if ($_fe441aa3ef350bfb1a1a1ad8520dd530 instanceof UnsupportedTypeException) {
            $event->setException(new \RestExBadRequest($_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage(), $GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_c894747360c6ec5bd816" . "9530eaf9c473"], $_fe441aa3ef350bfb1a1a1ad8520dd530));
            return;
        }
    }
    
    
    
    
    public function register()
    {
        $this->app->on(KernelEvents::EXCEPTION, array($this, $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_437d31f3e369eaf52112" . "df78da5beabb"]), 32);
        
        
    }
    public function unregister()
    {
    }
}