Leaf PHP

PlainTextHandler extends Handler
in package

Handler outputing plaintext error messages. Can be used directly, or will be instantiated automagically by Whoops\Run if passed to Run::pushHandler

Table of Contents

Constants

DONE  = 0x10
LAST_HANDLER  = 0x20
The Handler has handled the Throwable in some way, and wishes to skip any other Handler.
QUIT  = 0x30
The Handler has handled the Throwable in some way, and wishes to quit/stop execution
VAR_DUMP_PREFIX  = ' | '

Properties

$dumper  : callable
$logger  : LoggerInterface
$addPreviousToOutput  : bool
$addTraceFunctionArgsToOutput  : bool|int
$addTraceToOutput  : bool
$exception  : Throwable
$inspector  : Inspector
$loggerOnly  : bool
$run  : RunInterface
$traceFunctionArgsOutputLimit  : int

Methods

__construct()  : mixed
Constructor.
addPreviousToOutput()  : bool|static
Add previous exceptions to output.
addTraceFunctionArgsToOutput()  : static|bool|int
Add error trace function arguments to output.
addTraceToOutput()  : bool|static
Add error trace to output.
contentType()  : string
generateResponse()  : string
Create plain text response and return it as a string
getLogger()  : LoggerInterface|null
getTraceFunctionArgsOutputLimit()  : int
Get the size limit in bytes of frame arguments var_dump output.
handle()  : int
loggerOnly()  : static|bool
Only output to logger.
setDumper()  : static
Set var dumper callback function.
setException()  : void
setInspector()  : void
setLogger()  : mixed
Set the output logger interface.
setRun()  : void
setTraceFunctionArgsOutputLimit()  : static
Set the size limit in bytes of frame arguments var_dump output.
dump()  : void
Dump variable.
getException()  : Throwable
getInspector()  : Inspector
getRun()  : RunInterface
canOutput()  : bool
Test if handler can output to stdout.
getExceptionOutput()  : string
Get the exception as plain text.
getFrameArgsOutput()  : string
Get the frame args var_dump.
getTraceOutput()  : string
Get the exception trace as plain text.

Constants

LAST_HANDLER

The Handler has handled the Throwable in some way, and wishes to skip any other Handler.

public mixed LAST_HANDLER = 0x20

Execution will continue.

QUIT

The Handler has handled the Throwable in some way, and wishes to quit/stop execution

public mixed QUIT = 0x30

Properties

$addTraceFunctionArgsToOutput

private bool|int $addTraceFunctionArgsToOutput = false

$exception

private Throwable $exception

$traceFunctionArgsOutputLimit

private int $traceFunctionArgsOutputLimit = 1024

Methods

__construct()

Constructor.

public __construct([LoggerInterface|null $logger = null ]) : mixed
Parameters
$logger : LoggerInterface|null = null
Tags
throws
InvalidArgumentException

If argument is not null or a LoggerInterface

addPreviousToOutput()

Add previous exceptions to output.

public addPreviousToOutput([bool|null $addPreviousToOutput = null ]) : bool|static
Parameters
$addPreviousToOutput : bool|null = null
Return values
bool|static

addTraceFunctionArgsToOutput()

Add error trace function arguments to output.

public addTraceFunctionArgsToOutput([bool|int|null $addTraceFunctionArgsToOutput = null ]) : static|bool|int

Set to True for all frame args, or integer for the n first frame args.

Parameters
$addTraceFunctionArgsToOutput : bool|int|null = null
Return values
static|bool|int

addTraceToOutput()

Add error trace to output.

public addTraceToOutput([bool|null $addTraceToOutput = null ]) : bool|static
Parameters
$addTraceToOutput : bool|null = null
Return values
bool|static

generateResponse()

Create plain text response and return it as a string

public generateResponse() : string
Return values
string

getTraceFunctionArgsOutputLimit()

Get the size limit in bytes of frame arguments var_dump output.

public getTraceFunctionArgsOutputLimit() : int

If the limit is reached, the var_dump output is discarded. Prevent memory limit errors.

Return values
int

loggerOnly()

Only output to logger.

public loggerOnly([bool|null $loggerOnly = null ]) : static|bool
Parameters
$loggerOnly : bool|null = null
Return values
static|bool

setDumper()

Set var dumper callback function.

public setDumper(callable $dumper) : static
Parameters
$dumper : callable
Return values
static

setException()

public setException(Throwable $exception) : void
Parameters
$exception : Throwable

setLogger()

Set the output logger interface.

public setLogger([LoggerInterface|null $logger = null ]) : mixed
Parameters
$logger : LoggerInterface|null = null
Tags
throws
InvalidArgumentException

If argument is not null or a LoggerInterface

setTraceFunctionArgsOutputLimit()

Set the size limit in bytes of frame arguments var_dump output.

public setTraceFunctionArgsOutputLimit(mixed $traceFunctionArgsOutputLimit) : static

If the limit is reached, the var_dump output is discarded. Prevent memory limit errors.

Parameters
$traceFunctionArgsOutputLimit : mixed
Return values
static

dump()

Dump variable.

protected dump(mixed $var) : void
Parameters
$var : mixed

getException()

protected getException() : Throwable
Return values
Throwable

canOutput()

Test if handler can output to stdout.

private canOutput() : bool
Return values
bool

getExceptionOutput()

Get the exception as plain text.

private getExceptionOutput(Throwable $exception) : string
Parameters
$exception : Throwable
Return values
string

getFrameArgsOutput()

Get the frame args var_dump.

private getFrameArgsOutput(Frame $frame, int $line) : string
Parameters
$frame : Frame

[description]

$line : int

[description]

Return values
string

getTraceOutput()

Get the exception trace as plain text.

private getTraceOutput() : string
Return values
string

        
On this page

Search results