Path

ez components / documentation / api reference / latest / document


eZ Components latest

Document: ezcDocumentRstStack

[ Tutorial ] [ Conversion ] [ Styles ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Class: ezcDocumentRstStack

RST document stack [source]

Implemented Interfaces

  • ArrayAccess (internal interface)
  • Countable (internal interface)

Member Variables

protected int $count = 0
Number of elements on the stack

We are caching this value for faster access performance, and because we are only using a very limited internal methods which actually modify the satck.
protected array $data = array()
Data container for the document stack implementation

Method Summary

public void __construct( [$array = array()] )
Construct stack from array
public array asArray( [$limit = null] )
Get stack contents as plain PHP array
public int count( )
Returns the number of datasets in the row.
public bool offsetExists( $key )
Returns if the given offset exists.
public mixed offsetGet( $key )
Returns the element with the given offset.
public void offsetSet( $key, $value )
Set the element with the given offset.
public void offsetUnset( $key )
Unset the element with the given offset.
public void prepend( $data )
Prepend another array to the stack
public void push( $element )
Prepend element to the document stack
public mixed rewind( )
Selects the very first dataset and returns it.
public mixed shift( )
Get element from the beginning of the stack
public void unshift( $element )
Prepend element to the document stack

Methods

__construct

void __construct( [ $array = array()] )
Construct stack from array

Parameters

Name Type Description
$array array  

asArray

array asArray( [ $limit = null] )
Get stack contents as plain PHP array

Parameters

Name Type Description
$limit  

count

int count( )
Returns the number of datasets in the row.
This method is part of the Countable interface to allow the usage of PHP's count() function to check how many datasets exist.

offsetExists

bool offsetExists( string $key )
Returns if the given offset exists.
This method is part of the ArrayAccess interface to allow access to the data of this object as if it was an array.

Parameters

Name Type Description
$key string  

offsetGet

mixed offsetGet( string $key )
Returns the element with the given offset.
This method is part of the ArrayAccess interface to allow access to the data of this object as if it was an array.

Parameters

Name Type Description
$key string  

Throws

ClassDescription
ezcBasePropertyNotFoundException If no dataset with identifier exists

offsetSet

void offsetSet( string $key, mixed $value )
Set the element with the given offset.
This method is part of the ArrayAccess interface to allow access to the data of this object as if it was an array.
Setting of not yet existing offsets in the stack is not allowed and will return a ezcBaseValueException.

Parameters

Name Type Description
$key string  
$value mixed  

Throws

ClassDescription
ezcBaseValueException Setting unknown offsets is not allowed

offsetUnset

void offsetUnset( string $key )
Unset the element with the given offset.
This method is part of the ArrayAccess interface to allow access to the
Is not permitted for this stack implementation.

Parameters

Name Type Description
$key string  

Throws

ClassDescription
ezcBaseValueException Setting values is not allowed

prepend

void prepend( $data )
Prepend another array to the stack
Prepends an array with tokens to the current stack. Equivalent to calling $array = array_merge( $data, $array ); with common array functions.

Parameters

Name Type Description
$data array  

push

void push( mixed $element )
Prepend element to the document stack

Parameters

Name Type Description
$element mixed  

rewind

mixed rewind( )
Selects the very first dataset and returns it.
This method is part of the Iterator interface to allow access to the datasets of this row by iterating over it like an array (e.g. using foreach).

shift

mixed shift( )
Get element from the beginning of the stack

unshift

void unshift( mixed $element )
Prepend element to the document stack

Parameters

Name Type Description
$element mixed  

Last updated: Mon, 21 Dec 2009