Zeta Components - high quality PHP components

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

void __construct( mixed $stackTrace , [int $removeElements = 2] , ezcDebugOptions $options )

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

int count( )

Returns the number of elements in the iterator.

This method is part of the Countable interface.

Implementation of:
Method Description
Countable::count

current

mixed current( )

Returns the currently selected element of the iterator.

This method is part of the Iterator interface.

Implementation of:
Method Description
Iterator::current

key

mixed 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

mixed next( )

Advances the iterator to the next element.

This method is part of the Iterator interface.

Implementation of:
Method Description
Iterator::next

offsetExists

bool offsetExists( mixed $offset )

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

mixed offsetGet( mixed $offset )

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

void offsetSet( mixed $offset , mixed $value )

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

void offsetUnset( mixed $offset )

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

void prepare( array $stackTrace , int $removeElements )

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

mixed rewind( )

Resets the iterator to the first element.

This method is part of the Iterator interface.

Implementation of:
Method Description
Iterator::rewind

unifyStackElement

array unifyStackElement( mixed $stackElement )

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:

  1.  array(
  2.       'file'      => '<fullpathtofile>',
  3.       'line'      => <lineno>,
  4.       'function'  => '<functionname>',
  5.       'class'     => '<classname>',
  6.       'params'    => array(
  7.           <param_no> => '<paramvalueinfo>',
  8.           <param_no> => '<paramvalueinfo>',
  9.           <param_no> => '<paramvalueinfo>',
  10.           ...
  11.       )
  12.  )
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

bool 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
Documentation generated by phpDocumentor 1.4.3