<?php
namespace Claromentis\Comments;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"] ?: array()) + array("_a4a1018" . "258adabb" . "74e7b048" . "36d8d7e3" . "b" => base64_decode("Tm9" . "0IE" . "Zvd" . "W5k"), "_c894747360c6e" . "c5bd8169530eaf" . "9c473" => base64_decode("QmFk" . "IFJl" . "cXVl" . "c3Q="), "_437d31f3e369ea" . "f52112df78da5be" . "abb" => base64_decode("T25FcnJvcg=" . "="));
use Claromentis\Core\Repository\Exception\NotFoundException;
use Claromentis\Core\Repository\Exception\UnsupportedTypeException;
use Claromentis\Core\Application;
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
use Symfony\Component\HttpKernel\KernelEvents;





class RestExceptionHandler
{
    
    
    
    
    private $app;
    
    
    
    
    public function __construct(Application $app)
    {
        $this->app = $app;
    }
    
    
    
    
    public function OnError(ExceptionEvent $event)
    {
        $_fe441aa3ef350bfb1a1a1ad8520dd530 = $event->getThrowable();
        if ($_fe441aa3ef350bfb1a1a1ad8520dd530 instanceof NotFoundException) {
            $event->setThrowable(new \RestExNotFound($_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage(), $GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_a4a1018258ada" . "bb74e7b04836d8" . "d7e3b"], $_fe441aa3ef350bfb1a1a1ad8520dd530));
            return;
        }
        if ($_fe441aa3ef350bfb1a1a1ad8520dd530 instanceof UnsupportedTypeException) {
            $event->setThrowable(new \RestExBadRequest($_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage(), $GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_c894747360c6ec5bd8169" . "530eaf9c473"], $_fe441aa3ef350bfb1a1a1ad8520dd530));
            return;
        }
    }
    
    
    
    
    public function register()
    {
        $this->app->on(KernelEvents::EXCEPTION, array($this, $GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_437d31f3e369eaf52112df78da5bea" . "bb"]), 32);
        
        
    }
    public function unregister()
    {
        
        
    }
}