Base iterator class to wrap stack traces.
This class provides a basis for stack trace iterators that are stored for each call to ezcDebug::log() if ezcDebugOptions::$stackTrace is switched on or the specific parameter is set. The stack trace iterator needs to ensure, that the created stack trace is converted to the format understandable by the ezcDebugFormatter as defined in ezcDebugStacktraceIterator::unifyStackElement().
Source for this file: /Debug/src/interfaces/stacktrace_iterator.php
Version: | //autogen// |
Child Class | Description |
---|---|
ezcDebugPhpStacktraceIterator | Iterator class to wrap around debug_backtrace() stack traces. |
ezcDebugXdebugStacktraceIterator | Iterator class to wrap around debug_backtrace() stack traces. |
protected ezcDebugOptions |
$options
Options. |
public void |
__construct(
$stackTrace
, [ $removeElements
= 2] , $options
)
Creates a new stack trace iterator. |
public int |
count(
)
Returns the number of elements in the iterator. |
public mixed |
current(
)
Returns the currently selected element of the iterator. |
public mixed |
key(
)
Returns the key of the currently selected element of the iterator. |
public mixed |
next(
)
Advances the iterator to the next element. |
public bool |
offsetExists(
$offset
)
Returns if the given offset exists. |
public mixed |
offsetGet(
$offset
)
Returns the value assigned to the given offset. |
public void |
offsetSet(
$offset
, $value
)
It is not allowed to use this method with this iterator. |
public void |
offsetUnset(
$offset
)
It is not allowed to use this method with this iterator. |
protected void |
prepare(
$stackTrace
, $removeElements
)
Prepares the stack trace for being stored in the iterator instance. |
public mixed |
rewind(
)
Resets the iterator to the first element. |
protected abstract array |
unifyStackElement(
$stackElement
)
Unifies a stack element for being returned to the formatter. |
public bool |
valid(
)
Returns if the iterator is on a valid element or at the end. |
Creates a new stack trace iterator.
Calls ezcDebugStacktraceIterator::prepare() internally to prepare the stack trace before storing it.
Name | Type | Description |
---|---|---|
$stackTrace |
mixed | |
$removeElements |
int | |
$options |
ezcDebugOptions |
Returns the number of elements in the iterator.
This method is part of the Countable interface.
Method | Description |
---|---|
Countable::count |
Returns the currently selected element of the iterator.
This method is part of the Iterator interface.
Method | Description |
---|---|
Iterator::current |
Returns the key of the currently selected element of the iterator.
This method is part of the Iterator interface.
Method | Description |
---|---|
Iterator::key |
Advances the iterator to the next element.
This method is part of the Iterator interface.
Method | Description |
---|---|
Iterator::next |
Returns if the given offset exists.
This method is part of the ArrayAccess interface.
Name | Type | Description |
---|---|---|
$offset |
mixed |
Method | Description |
---|---|
ArrayAccess::offsetExists |
Returns the value assigned to the given offset.
This method is part of the ArrayAccess interface.
Name | Type | Description |
---|---|---|
$offset |
mixed |
Method | Description |
---|---|
ArrayAccess::offsetGet |
It is not allowed to use this method with this iterator.
This method is part of the ArrayAccess interface.
Name | Type | Description |
---|---|---|
$offset |
mixed | |
$value |
mixed |
Type | Description |
---|---|
ezcDebugException |
Method | Description |
---|---|
ArrayAccess::offsetSet |
It is not allowed to use this method with this iterator.
This method is part of the ArrayAccess interface.
Name | Type | Description |
---|---|---|
$offset |
mixed |
Type | Description |
---|---|
ezcDebugException |
Method | Description |
---|---|
ArrayAccess::offsetUnset |
Prepares the stack trace for being stored in the iterator instance.
This method is called by ezcDebugStacktraceIterator::__construct() before the stack trace is stored in the corresponding property. The given array can be manipulated as needed to prepare the trace and the array to store internally must be returned. The basic implementation removes $removeElements number of elements from the start of the trace array and reduces the array to ezcDebugOptions::$stackTraceDepth elements.
Name | Type | Description |
---|---|---|
$stackTrace |
array | |
$removeElements |
int |
Method | Description |
---|---|
ezcDebugXdebugStacktraceIterator::prepare() |
Prepares the stack trace for being stored in the iterator instance. |
Resets the iterator to the first element.
This method is part of the Iterator interface.
Method | Description |
---|---|
Iterator::rewind |
Unifies a stack element for being returned to the formatter.
This method ensures that an element of the stack trace conforms to the format expected by a ezcDebugOutputFormatter. The format is defined as follows:
Name | Type | Description |
---|---|---|
$stackElement |
mixed |
Method | Description |
---|---|
ezcDebugPhpStacktraceIterator::unifyStackElement() |
Unifies a stack element for being returned to the formatter. |
ezcDebugXdebugStacktraceIterator::unifyStackElement() |
Unifies a stack element for being returned to the formatter. |
Returns if the iterator is on a valid element or at the end.
This method is part of the Iterator interface.
Method | Description |
---|---|
Iterator::valid |