PHP Class ZF\Console\ExceptionHandler

Mostra file Open project: zfcampus/zf-console

Protected Properties

Property Type Description
$console Zend\Console\Adapter\AdapterInterface
$messageTemplate string The message template to use when exceptions are handled.

Public Methods

Method Description
__construct ( Zend\Console\Adapter\AdapterInterface $console )
__invoke ( Exceptio\Exception | Throwabl\Throwable $exception ) Handle an exception
createMessage ( Exceptio\Exception | Throwabl\Throwable $exception ) : string Create the message to emit based on the provided exception and current message template
setMessageTemplate ( mixed $messageTemplate ) Set the message template to use.

Protected Methods

Method Description
fillTemplate ( Exceptio\Exception | Throwabl\Throwable $exception, false | string $previous = false ) : string Fill the message template with details of the given exception

Private Methods

Method Description
validateException ( mixed $exception ) : void Validate that an exception was received

Method Details

__construct() public method

public __construct ( Zend\Console\Adapter\AdapterInterface $console )
$console Zend\Console\Adapter\AdapterInterface

__invoke() public method

On completion, exits with a non-zero status code.
public __invoke ( Exceptio\Exception | Throwabl\Throwable $exception )
$exception Exceptio\Exception | Throwabl\Throwable

createMessage() public method

Create the message to emit based on the provided exception and current message template
public createMessage ( Exceptio\Exception | Throwabl\Throwable $exception ) : string
$exception Exceptio\Exception | Throwabl\Throwable
return string

fillTemplate() protected method

Fill the message template with details of the given exception
protected fillTemplate ( Exceptio\Exception | Throwabl\Throwable $exception, false | string $previous = false ) : string
$exception Exceptio\Exception | Throwabl\Throwable
$previous false | string If provided, adds the ":previous" template and this value
return string

setMessageTemplate() public method

Message templates may define the following variable placeholders: - :className - :message - :code - :file - :line - :stack - :previous (this is used to report previous exceptions in a trace)
public setMessageTemplate ( mixed $messageTemplate )
$messageTemplate mixed

Property Details

$console protected_oe property

protected AdapterInterface,Zend\Console\Adapter $console
return Zend\Console\Adapter\AdapterInterface

$messageTemplate protected_oe property

The message template to use when exceptions are handled.
protected string $messageTemplate
return string