Zeta Components Manual :: Docs For Class ezcDebugStacktraceIterator
Debug::ezcDebugStacktraceIterator
Class ezcDebugStacktraceIterator
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
Implements interfaces:
- Iterator (internal interface)
- ArrayAccess (internal interface)
- Countable (internal interface)
Version: | //autogen// |
Descendants
Child Class | Description |
---|---|
ezcDebugPhpStacktraceIterator | Iterator class to wrap around debug_backtrace() stack traces. |
ezcDebugXdebugStacktraceIterator | Iterator class to wrap around debug_backtrace() stack traces. |
Member Variables
protected ezcDebugOptions |
$options
Options. |
Method Summary
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. |
Methods
__construct
Creates a new stack trace iterator.
Calls ezcDebugStacktraceIterator::prepare() internally to prepare the stack trace before storing it.
Parameters:
Name | Type | Description |
---|---|---|
$stackTrace |
mixed | |
$removeElements |
int | |
$options |
ezcDebugOptions |
count
Returns the number of elements in the iterator.
This method is part of the Countable interface.
Implementation of:
Method | Description |
---|---|
Countable::count |
current
Returns the currently selected element of the iterator.
This method is part of the Iterator interface.
Implementation of:
Method | Description |
---|---|
Iterator::current |
key
Returns the key of the currently selected element of the iterator.
This method is part of the Iterator interface.
Implementation of:
Method | Description |
---|---|
Iterator::key |
next
Advances the iterator to the next element.
This method is part of the Iterator interface.
Implementation of:
Method | Description |
---|---|
Iterator::next |
offsetExists
Returns if the given offset exists.
This method is part of the ArrayAccess interface.
Parameters:
Name | Type | Description |
---|---|---|
$offset |
mixed |
Implementation of:
Method | Description |
---|---|
ArrayAccess::offsetExists |
offsetGet
Returns the value assigned to the given offset.
This method is part of the ArrayAccess interface.
Parameters:
Name | Type | Description |
---|---|---|
$offset |
mixed |
Implementation of:
Method | Description |
---|---|
ArrayAccess::offsetGet |
offsetSet
It is not allowed to use this method with this iterator.
This method is part of the ArrayAccess interface.
Parameters:
Name | Type | Description |
---|---|---|
$offset |
mixed | |
$value |
mixed |
Exceptions:
Type | Description |
---|---|
ezcDebugException |
Implementation of:
Method | Description |
---|---|
ArrayAccess::offsetSet |
offsetUnset
It is not allowed to use this method with this iterator.
This method is part of the ArrayAccess interface.
Parameters:
Name | Type | Description |
---|---|---|
$offset |
mixed |
Exceptions:
Type | Description |
---|---|
ezcDebugException |
Implementation of:
Method | Description |
---|---|
ArrayAccess::offsetUnset |
prepare
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.
Parameters:
Name | Type | Description |
---|---|---|
$stackTrace |
array | |
$removeElements |
int |
Redefined in descendants as:
Method | Description |
---|---|
ezcDebugXdebugStacktraceIterator::prepare() |
Prepares the stack trace for being stored in the iterator instance. |
rewind
Resets the iterator to the first element.
This method is part of the Iterator interface.
Implementation of:
Method | Description |
---|---|
Iterator::rewind |
unifyStackElement
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:
- array(
- 'file' => '<fullpathtofile>',
- 'line' => <lineno>,
- 'function' => '<functionname>',
- 'class' => '<classname>',
- 'params' => array(
- <param_no> => '<paramvalueinfo>',
- <param_no> => '<paramvalueinfo>',
- <param_no> => '<paramvalueinfo>',
- ...
- )
- )
Parameters:
Name | Type | Description |
---|---|---|
$stackElement |
mixed |
Redefined in descendants as:
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. |
valid
Returns if the iterator is on a valid element or at the end.
This method is part of the Iterator interface.
Implementation of:
Method | Description |
---|---|
Iterator::valid |