FlattenException
in package
FlattenException wraps a PHP Exception to be able to serialize it.
Implements the Throwable interface Basically, this class removes all objects from the trace. Ported from Symfony components @link https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Debug/Exception/FlattenException.php
Tags
Table of Contents
Properties
- $code : mixed|int
- $file : string
- $line : int
- $message : string
- $_class : string
- $_previous : FlattenException|null
- $_toString : string
- $_trace : array<string|int, mixed>
Methods
- __construct() : mixed
- FlattenException constructor.
- __toString() : string
- String representation of the exception
- getClass() : string
- getCode() : mixed|int
- Gets the Exception code
- getFile() : string
- Gets the file in which the exception occurred
- getLine() : int
- Gets the line in which the exception occurred
- getMessage() : string
- Gets the Exception message
- getPrevious() : FlattenException
- Returns previous Exception
- getTrace() : array<string|int, mixed>
- Gets the stack trace
- getTraceAsString() : string
- Gets the stack trace as a string
- setClass() : mixed
- setCode() : mixed
- setFile() : mixed
- setLine() : mixed
- setMessage() : mixed
- setPrevious() : mixed
- setToString() : mixed
- setTrace() : mixed
- flattenArgs() : array<string|int, mixed>
- Allows you to sterilize the Exception trace arguments
- getClassNameFromIncomplete() : string
Properties
$code
protected
mixed|int
$code
$file
protected
string
$file
$line
protected
int
$line
$message
protected
string
$message
$_class
private
string
$_class
$_previous
private
FlattenException|null
$_previous
$_toString
private
string
$_toString
$_trace
private
array<string|int, mixed>
$_trace
Methods
__construct()
FlattenException constructor.
public
__construct(Exception $exception) : mixed
Parameters
- $exception : Exception
__toString()
String representation of the exception
public
__toString() : string
Return values
string —the string representation of the exception.
getClass()
public
getClass() : string
Return values
string —the name of the class in which the exception was created.
getCode()
Gets the Exception code
public
getCode() : mixed|int
Return values
mixed|int —the exception code as integer.
getFile()
Gets the file in which the exception occurred
public
getFile() : string
Return values
string —the filename in which the exception was created.
getLine()
Gets the line in which the exception occurred
public
getLine() : int
Return values
int —the line number where the exception was created.
getMessage()
Gets the Exception message
public
getMessage() : string
Return values
string —the Exception message as a string.
getPrevious()
Returns previous Exception
public
getPrevious() : FlattenException
Return values
FlattenException —the previous FlattenException
if available or null otherwise.
getTrace()
Gets the stack trace
public
getTrace() : array<string|int, mixed>
Return values
array<string|int, mixed> —the Exception stack trace as an array.
getTraceAsString()
Gets the stack trace as a string
public
getTraceAsString() : string
Return values
string —the Exception stack trace as a string.
setClass()
protected
setClass(string $class) : mixed
Parameters
- $class : string
-
the name of the class in which the exception was created.
setCode()
protected
setCode(mixed|int $code) : mixed
Parameters
- $code : mixed|int
-
the exception code as integer.
setFile()
protected
setFile(string $file) : mixed
Parameters
- $file : string
-
the filename in which the exception was created.
setLine()
protected
setLine(int $line) : mixed
Parameters
- $line : int
-
the line number where the exception was created.
setMessage()
protected
setMessage(string $message) : mixed
Parameters
- $message : string
-
the Exception message as a string.
setPrevious()
protected
setPrevious(FlattenException $previous) : mixed
Parameters
- $previous : FlattenException
-
previous Exception.
setToString()
protected
setToString(string $string) : mixed
Parameters
- $string : string
-
the string representation of the thrown object.
setTrace()
protected
setTrace(array<string|int, mixed> $trace) : mixed
Parameters
- $trace : array<string|int, mixed>
-
the Exception stack trace as an array.
flattenArgs()
Allows you to sterilize the Exception trace arguments
private
flattenArgs(array<string|int, mixed> $args[, int $level = 0 ][, int &$count = 0 ]) : array<string|int, mixed>
Parameters
- $args : array<string|int, mixed>
- $level : int = 0
-
recursion level
- $count : int = 0
-
number of records counter
Return values
array<string|int, mixed> —arguments tracing.
getClassNameFromIncomplete()
private
getClassNameFromIncomplete(__PHP_Incomplete_Class $value) : string
Parameters
- $value : __PHP_Incomplete_Class
Return values
string —the real class name of an incomplete class