PHP Class Dingo\Api\Exception\Handler

Inheritance: implements Dingo\Api\Contract\Debug\ExceptionHandler, implements Illuminate\Contracts\Debug\ExceptionHandler
Afficher le fichier Open project: dingo/api Class Usage Examples

Protected Properties

Свойство Type Description
$debug boolean Indicates if we are in debug mode.
$format array Generic response format.
$handlers array Array of exception handlers.
$parentHandler Illuminate\Contracts\Debug\ExceptionHandler The parent Illuminate exception handler instance.
$replacements array User defined replacements to merge with defaults.

Méthodes publiques

Méthode Description
__construct ( Illuminate\Contracts\Debug\ExceptionHandler $parentHandler, array $format, boolean $debug ) : void Create a new exception handler instance.
getHandlers ( ) : array Get the exception handlers.
handle ( Exception $exception ) : Illuminate\Http\Response Handle an exception if it has an existing handler.
register ( callable $callback ) : void Register a new exception handler.
render ( Dingo\Api\Http\Request $request, Exception $exception ) : mixed Render an exception into an HTTP response.
renderForConsole ( Symfony\Component\Console\Output\OutputInterface $output, Exception $exception ) : mixed Render an exception to the console.
report ( Exception $exception ) : void Report or log an exception.
setDebug ( boolean $debug ) : void Set the debug mode.
setErrorFormat ( array $format ) : void Set the error format array.
setReplacements ( array $replacements ) : void Set user defined replacements.

Méthodes protégées

Méthode Description
genericResponse ( Exception $exception ) : Illuminate\Http\Response Handle a generic error response if there is no handler available.
getExceptionStatusCode ( Exception $exception, integer $defaultStatusCode = 500 ) : integer Get the exception status code.
getHeaders ( Exception $exception ) : array Get the headers from the exception.
getStatusCode ( Exception $exception ) : integer Get the status code from the exception.
handlerHint ( callable $callback ) : string Get the hint for an exception handler.
newResponseArray ( ) : array Create a new response array with replacement values.
prepareReplacements ( Exception $exception ) : array Prepare the replacements array by gathering the keys and values.
recursivelyRemoveEmptyReplacements ( array $input ) : array Recursirvely remove any empty replacement values in the response array.
runningInDebugMode ( ) : boolean Determines if we are running in debug mode.

Method Details

__construct() public méthode

Create a new exception handler instance.
public __construct ( Illuminate\Contracts\Debug\ExceptionHandler $parentHandler, array $format, boolean $debug ) : void
$parentHandler Illuminate\Contracts\Debug\ExceptionHandler
$format array
$debug boolean
Résultat void

genericResponse() protected méthode

Handle a generic error response if there is no handler available.
protected genericResponse ( Exception $exception ) : Illuminate\Http\Response
$exception Exception
Résultat Illuminate\Http\Response

getExceptionStatusCode() protected méthode

Get the exception status code.
protected getExceptionStatusCode ( Exception $exception, integer $defaultStatusCode = 500 ) : integer
$exception Exception
$defaultStatusCode integer
Résultat integer

getHandlers() public méthode

Get the exception handlers.
public getHandlers ( ) : array
Résultat array

getHeaders() protected méthode

Get the headers from the exception.
protected getHeaders ( Exception $exception ) : array
$exception Exception
Résultat array

getStatusCode() protected méthode

Get the status code from the exception.
protected getStatusCode ( Exception $exception ) : integer
$exception Exception
Résultat integer

handle() public méthode

Handle an exception if it has an existing handler.
public handle ( Exception $exception ) : Illuminate\Http\Response
$exception Exception
Résultat Illuminate\Http\Response

handlerHint() protected méthode

Get the hint for an exception handler.
protected handlerHint ( callable $callback ) : string
$callback callable
Résultat string

newResponseArray() protected méthode

Create a new response array with replacement values.
protected newResponseArray ( ) : array
Résultat array

prepareReplacements() protected méthode

Prepare the replacements array by gathering the keys and values.
protected prepareReplacements ( Exception $exception ) : array
$exception Exception
Résultat array

recursivelyRemoveEmptyReplacements() protected méthode

Recursirvely remove any empty replacement values in the response array.
protected recursivelyRemoveEmptyReplacements ( array $input ) : array
$input array
Résultat array

register() public méthode

Register a new exception handler.
public register ( callable $callback ) : void
$callback callable
Résultat void

render() public méthode

Render an exception into an HTTP response.
public render ( Dingo\Api\Http\Request $request, Exception $exception ) : mixed
$request Dingo\Api\Http\Request
$exception Exception
Résultat mixed

renderForConsole() public méthode

Render an exception to the console.
public renderForConsole ( Symfony\Component\Console\Output\OutputInterface $output, Exception $exception ) : mixed
$output Symfony\Component\Console\Output\OutputInterface
$exception Exception
Résultat mixed

report() public méthode

Report or log an exception.
public report ( Exception $exception ) : void
$exception Exception
Résultat void

runningInDebugMode() protected méthode

Determines if we are running in debug mode.
protected runningInDebugMode ( ) : boolean
Résultat boolean

setDebug() public méthode

Set the debug mode.
public setDebug ( boolean $debug ) : void
$debug boolean
Résultat void

setErrorFormat() public méthode

Set the error format array.
public setErrorFormat ( array $format ) : void
$format array
Résultat void

setReplacements() public méthode

Set user defined replacements.
public setReplacements ( array $replacements ) : void
$replacements array
Résultat void

Property Details

$debug protected_oe property

Indicates if we are in debug mode.
protected bool $debug
Résultat boolean

$format protected_oe property

Generic response format.
protected array $format
Résultat array

$handlers protected_oe property

Array of exception handlers.
protected array $handlers
Résultat array

$parentHandler protected_oe property

The parent Illuminate exception handler instance.
protected ExceptionHandler,Illuminate\Contracts\Debug $parentHandler
Résultat Illuminate\Contracts\Debug\ExceptionHandler

$replacements protected_oe property

User defined replacements to merge with defaults.
protected array $replacements
Résultat array