## Apache Zeta Components Manual :: Docs For Class ezcDocumentRstStack

### Document::ezcDocumentRstStack

### Class ezcDocumentRstStack

RST document stack

Source for this file: /Document/src/document/rst/document_stack.php

### Implements interfaces:

- ArrayAccess (internal interface)
- Countable (internal interface)

Version: | //autogen//

### 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.

##### Implementation of:

Method | Description
--- | ---
`Countable::count` |

#### 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 |

##### Implementation of:

Method | Description
--- | ---
`ArrayAccess::offsetExists` |

#### 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 |

##### Exceptions:

Type | Description
--- | ---
`ezcBasePropertyNotFoundException` | If no dataset with identifier exists

##### Implementation of:

Method | Description
--- | ---
`ArrayAccess::offsetGet` |

#### 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 |

##### Exceptions:

Type | Description
--- | ---
`ezcBaseValueException` | Setting unknown offsets is not allowed

##### Implementation of:

Method | Description
--- | ---
`ArrayAccess::offsetSet` |

#### 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 |

##### Exceptions:

Type | Description
--- | ---
`ezcBaseValueException` | Setting values is not allowed

##### Implementation of:

Method | Description
--- | ---
`ArrayAccess::offsetUnset` |

#### 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 |

Documentation generated by phpDocumentor 1.4.3