<?php
namespace Claromentis\Comments;

$GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"] = (@$GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"] ?: array()) + array("_c894747360c6ec5bd8169530eaf9c47" . "3" => base64_decode("QmFkIFJlcX" . "Vlc3Q="), "_437d31f3e369eaf52112df7" . "8da5beabb" => base64_decode("T25" . "Fcn" . "Jvc" . "g=="), "_a4a101825" . "8adabb74e7" . "b04836d8d7" . "e3b" => base64_decode("Tm90I" . "EZvdW" . "5k"));
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["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_a4a101825" . "8adabb74e7" . "b04836d8d7" . "e3b"], $_fe441aa3ef350bfb1a1a1ad8520dd530));
            return;
        }
        if ($_fe441aa3ef350bfb1a1a1ad8520dd530 instanceof UnsupportedTypeException) {
            $event->setException(new \RestExBadRequest($_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage(), $GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_c894747360c" . "6ec5bd816953" . "0eaf9c473"], $_fe441aa3ef350bfb1a1a1ad8520dd530));
            return;
        }
    }
    
    
    
    
    public function register()
    {
        $this->app->on(KernelEvents::EXCEPTION, array($this, $GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_437d31f3e369eaf52112df78da5" . "beabb"]), 32);
        
        
    }
    public function unregister()
    {
    }
}