Documentation

Backtrace
in package

Wrapper around backtraces providing utility methods.

Copyright 1999-2017 Horde LLC (http://www.horde.org/)

Tags
category

Horde

license

http://www.horde.org/licenses/bsd

Table of Contents

$backtrace  : array<string|int, mixed>
Backtrace.
__construct()  : mixed
Constructor.
__toString()  : string
Returns a simple, human-readable list of the complete backtrace.
createFromDebugBacktrace()  : mixed
Wraps the result of debug_backtrace().
createFromThrowable()  : mixed
Wraps an error object's backtrace.
getCallingContext()  : array<string|int, mixed>
Returns details about the caller of the routine where the exception occurred.
getContext()  : array<string|int, mixed>
Returns the context at a specific nesting level.
getCurrentContext()  : array<string|int, mixed>
Returns details about the routine where the exception occurred.
getNestingLevel()  : int
Returns the nesting level (number of calls deep) of the current context.
_createFromThrowable()  : mixed
Wraps an error object's backtrace.

Properties

$backtrace

Backtrace.

public array<string|int, mixed> $backtrace

Methods

__construct()

Constructor.

public __construct([Throwable|array<string|int, mixed>|null $backtrace = null ]) : mixed
Parameters
$backtrace : Throwable|array<string|int, mixed>|null = null

The backtrace source. Either a trowable, an exception or an existing backtrace. Defaults to the current stack.

Return values
mixed

__toString()

Returns a simple, human-readable list of the complete backtrace.

public __toString() : string
Return values
string

The backtrace map.

createFromDebugBacktrace()

Wraps the result of debug_backtrace().

public createFromDebugBacktrace(array<string|int, mixed> $backtrace, int $nestingLevel) : mixed

By specifying a non-zero $nestingLevel, levels of the backtrace can be ignored. For instance, when Horde_Support_Backtrace creates a backtrace for you, it ignores the Horde_Backtrace constructor in the wrapped trace.

Parameters
$backtrace : array<string|int, mixed>

The debug_backtrace() result.

$nestingLevel : int

The number of levels of the backtrace to ignore.

Return values
mixed

createFromThrowable()

Wraps an error object's backtrace.

public createFromThrowable(Throwable $e) : mixed
Parameters
$e : Throwable

The error to wrap.

Tags
since

Horde_Support 2.2.0

Return values
mixed

getCallingContext()

Returns details about the caller of the routine where the exception occurred.

public getCallingContext() : array<string|int, mixed>
Return values
array<string|int, mixed>

$caller

getContext()

Returns the context at a specific nesting level.

public getContext(int $nestingLevel) : array<string|int, mixed>
Parameters
$nestingLevel : int

0 == current level, 1 == caller, and so on

Return values
array<string|int, mixed>

The requested context.

getCurrentContext()

Returns details about the routine where the exception occurred.

public getCurrentContext() : array<string|int, mixed>
Return values
array<string|int, mixed>

$caller

getNestingLevel()

Returns the nesting level (number of calls deep) of the current context.

public getNestingLevel() : int
Return values
int

Nesting level.

_createFromThrowable()

Wraps an error object's backtrace.

protected _createFromThrowable(Throwable $e) : mixed
Parameters
$e : Throwable

The error to wrap.

Tags
todo

Merge with createFromThrowable with PHP 7.

Return values
mixed

Search results