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
DONE
public
mixed
DONE
= 0x10
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
VAR_DUMP_PREFIX
public
mixed
VAR_DUMP_PREFIX
= ' | '
Properties
$dumper
protected
callable
$dumper
$logger
protected
LoggerInterface
$logger
$addPreviousToOutput
private
bool
$addPreviousToOutput
= true
$addTraceFunctionArgsToOutput
private
bool|int
$addTraceFunctionArgsToOutput
= false
$addTraceToOutput
private
bool
$addTraceToOutput
= true
$exception
private
Throwable
$exception
$inspector
private
Inspector
$inspector
$loggerOnly
private
bool
$loggerOnly
= false
$run
private
RunInterface
$run
$traceFunctionArgsOutputLimit
private
int
$traceFunctionArgsOutputLimit
= 1024
Methods
__construct()
Constructor.
public
__construct([LoggerInterface|null $logger = null ]) : mixed
Parameters
- $logger : LoggerInterface|null = null
Tags
addPreviousToOutput()
Add previous exceptions to output.
public
addPreviousToOutput([bool|null $addPreviousToOutput = null ]) : bool|static
Parameters
- $addPreviousToOutput : bool|null = null
Return values
bool|staticaddTraceFunctionArgsToOutput()
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|intaddTraceToOutput()
Add error trace to output.
public
addTraceToOutput([bool|null $addTraceToOutput = null ]) : bool|static
Parameters
- $addTraceToOutput : bool|null = null
Return values
bool|staticcontentType()
public
contentType() : string
Return values
stringgenerateResponse()
Create plain text response and return it as a string
public
generateResponse() : string
Return values
stringgetLogger()
public
getLogger() : LoggerInterface|null
Return values
LoggerInterface|nullgetTraceFunctionArgsOutputLimit()
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
inthandle()
public
handle() : int
Return values
intloggerOnly()
Only output to logger.
public
loggerOnly([bool|null $loggerOnly = null ]) : static|bool
Parameters
- $loggerOnly : bool|null = null
Return values
static|boolsetDumper()
Set var dumper callback function.
public
setDumper(callable $dumper) : static
Parameters
- $dumper : callable
Return values
staticsetException()
public
setException(Throwable $exception) : void
Parameters
- $exception : Throwable
setInspector()
public
setInspector(Inspector $inspector) : void
Parameters
- $inspector : Inspector
setLogger()
Set the output logger interface.
public
setLogger([LoggerInterface|null $logger = null ]) : mixed
Parameters
- $logger : LoggerInterface|null = null
Tags
setRun()
public
setRun(RunInterface $run) : void
Parameters
- $run : RunInterface
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
staticdump()
Dump variable.
protected
dump(mixed $var) : void
Parameters
- $var : mixed
getException()
protected
getException() : Throwable
Return values
ThrowablegetInspector()
protected
getInspector() : Inspector
Return values
InspectorgetRun()
protected
getRun() : RunInterface
Return values
RunInterfacecanOutput()
Test if handler can output to stdout.
private
canOutput() : bool
Return values
boolgetExceptionOutput()
Get the exception as plain text.
private
getExceptionOutput(Throwable $exception) : string
Parameters
- $exception : Throwable
Return values
stringgetFrameArgsOutput()
Get the frame args var_dump.
private
getFrameArgsOutput(Frame $frame, int $line) : string
Parameters
- $frame : Frame
-
[description]
- $line : int
-
[description]
Return values
stringgetTraceOutput()
Get the exception trace as plain text.
private
getTraceOutput() : string