RST document stack
Source for this file: /Document/src/document/rst/document_stack.php
Version: | //autogen// |
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 |
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 |
Construct stack from array
Name | Type | Description |
---|---|---|
$array |
array |
Get stack contents as plain PHP array
Name | Type | Description |
---|---|---|
$limit |
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.
Method | Description |
---|---|
Countable::count |
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.
Name | Type | Description |
---|---|---|
$key |
string |
Method | Description |
---|---|
ArrayAccess::offsetExists |
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.
Name | Type | Description |
---|---|---|
$key |
string |
Type | Description |
---|---|
ezcBasePropertyNotFoundException |
If no dataset with identifier exists |
Method | Description |
---|---|
ArrayAccess::offsetGet |
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.
Name | Type | Description |
---|---|---|
$key |
string | |
$value |
mixed |
Type | Description |
---|---|
ezcBaseValueException |
Setting unknown offsets is not allowed |
Method | Description |
---|---|
ArrayAccess::offsetSet |
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.
Name | Type | Description |
---|---|---|
$key |
string |
Type | Description |
---|---|
ezcBaseValueException |
Setting values is not allowed |
Method | Description |
---|---|
ArrayAccess::offsetUnset |
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.
Name | Type | Description |
---|---|---|
$data |
array |
Prepend element to the document stack
Name | Type | Description |
---|---|---|
$element |
mixed |
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).
Get element from the beginning of the stack
Prepend element to the document stack
Name | Type | Description |
---|---|---|
$element |
mixed |