Вход Регистрация
Файл: vendor/nunomaduro/collision/src/Adapters/Laravel/ExceptionHandler.php
Строк: 141
<?php

declare(strict_types=1);

namespace 
NunoMaduroCollisionAdaptersLaravel;

use 
IlluminateContractsContainerContainer;
use 
IlluminateContractsDebugExceptionHandler as ExceptionHandlerContract;
use 
NunoMaduroCollisionContractsProvider as ProviderContract;
use 
SymfonyComponentConsoleExceptionExceptionInterface as SymfonyConsoleExceptionInterface;
use 
Throwable;

/**
 * @internal
 */
final class ExceptionHandler implements ExceptionHandlerContract
{
    
/**
     * Holds an instance of the application exception handler.
     *
     * @var IlluminateContractsDebugExceptionHandler
     */
    
protected $appExceptionHandler;

    
/**
     * Holds an instance of the container.
     *
     * @var IlluminateContractsContainerContainer
     */
    
protected $container;

    
/**
     * Creates a new instance of the ExceptionHandler.
     */
    
public function __construct(Container $containerExceptionHandlerContract $appExceptionHandler)
    {
        
$this->container $container;
        
$this->appExceptionHandler $appExceptionHandler;
    }

    
/**
     * {@inheritdoc}
     */
    
public function report(Throwable $e)
    {
        
$this->appExceptionHandler->report($e);
    }

    
/**
     * {@inheritdoc}
     */
    
public function render($requestThrowable $e)
    {
        return 
$this->appExceptionHandler->render($request$e);
    }

    
/**
     * {@inheritdoc}
     */
    
public function renderForConsole($outputThrowable $e)
    {
        if (
$e instanceof SymfonyConsoleExceptionInterface) {
            
$this->appExceptionHandler->renderForConsole($output$e);
        } else {
            
/** @var NunoMaduroCollisionContractsProvider $provider */
            
$provider $this->container->make(ProviderContract::class);

            
$handler $provider->register()
                ->
getHandler()
                ->
setOutput($output);

            
$handler->setInspector((new Inspector($e)));

            
$handler->handle();
        }
    }

    
/**
     * Determine if the exception should be reported.
     *
     * @return bool
     */
    
public function shouldReport(Throwable $e)
    {
        return 
$this->appExceptionHandler->shouldReport($e);
    }
}
Онлайн: 0
Реклама