class ReflectionBacktrace implements Reflector

The backtrace reflector

Traits

Basic implementation of the \Reflector::export() method
This trait defines magic getters and setters for read-only object's properties

Methods

static  string|null
export( mixed $argument, bool $return = false)

Creation of a new instance of the mother class on-the-fly

void
setReadOnlyProperties( array $data)

Defines the read-only properties names and accessors.

mixed
__get( string $name)

Magic getter for read-only properties.

void
__set( string $name, mixed $value)

Magic setter to avoid setting read-only properties.

void
__unset( string $name)

Magic un-setter to avoid un-setting read-only properties.

__construct( array $traces = null, int $options = DEBUG_BACKTRACE_PROVIDE_OBJECT, int $limit)

Construct a backtrace reflection

array
getRawTraces()

Returns the original backtrace array

array
getTraces()

Returns the backtrace array with each item as a \Reflectors\ReflectionTrace object

int
getLength()

Returns the length of the backtrace (affected by the $limit argument if so)

getTrace( int $index)

Returns a specific trace of the backtrace table as a \Reflectors\ReflectionTrace object

string
__toString()

Representation of the object

Details

in ReflectorTrait at line 54
static string|null export( mixed $argument, bool $return = false)

Creation of a new instance of the mother class on-the-fly

Keep in mind that this method only consider the FIRST argument passed to transmit to the constructor. If your mother class requires more than one argument, you will have to over-write this method (or to not use the trait).

Parameters

mixed $argument
bool $return

Return Value

string|null

Exceptions

ErrorException if the mother class does not implement the \Reflector interface
ErrorException if the mother class constructor is not callable

void setReadOnlyProperties( array $data)

Defines the read-only properties names and accessors.

Each key => value pair of the $data array must be constructed like:

  • key is the name of the property (MUST be defined with protected access in the child class)
  • value is an accessor for that property: the name of the access method if it exists or true for the default $obj->$key accessor.

Parameters

array $data This is the table of read-only properties

Return Value

void

Exceptions

InvalidArgumentException if the $data array is malformed

mixed __get( string $name)

Magic getter for read-only properties.

This will trigger a notice if the property can not be accessed.

Parameters

string $name

Return Value

mixed

void __set( string $name, mixed $value)

Magic setter to avoid setting read-only properties.

Parameters

string $name
mixed $value

Return Value

void

Exceptions

ReflectionException if trying to set a read-only property

void __unset( string $name)

Magic un-setter to avoid un-setting read-only properties.

Parameters

string $name

Return Value

void

Exceptions

ReflectionException if trying to unset a read-only property

at line 69
__construct( array $traces = null, int $options = DEBUG_BACKTRACE_PROVIDE_OBJECT, int $limit)

Construct a backtrace reflection

If the first parameter is not set, this will use the result of the debug_backtrace() function to get current backtrace.

Parameters

array $traces
int $options the first argument of the internal debug_backtrace() function
int $limit the second argument of the internal debug_backtrace() function

at line 85
array getRawTraces()

Returns the original backtrace array

Return Value

array

at line 95
array getTraces()

Returns the backtrace array with each item as a \Reflectors\ReflectionTrace object

Return Value

array

at line 116
int getLength()

Returns the length of the backtrace (affected by the $limit argument if so)

Return Value

int

at line 127
null|ReflectionTrace getTrace( int $index)

Returns a specific trace of the backtrace table as a \Reflectors\ReflectionTrace object

Parameters

int $index

Return Value

null|ReflectionTrace

at line 144
string __toString()

Representation of the object

If an exception is caught, its message is returned instead of the original result (but it is not thrown ahead).

Return Value

string