Class \Prado\Collections\TStack
TStack class
TStack implements a stack.
The typical stack operations are implemented, which include push(), pop() and peek(). In addition, contains() can be used to check if an item is contained in the stack. To obtain the number of the items in the stack, check the \Prado\Collections\getCount property.
Items in the stack may be traversed using foreach as follows,
foreach($stack as $item) ...
Class hierarchy
- \Prado\Collections\TStack implements IteratorAggregate, Countable
- \Prado\TComponent
Since: 3.0
public
|
__construct([null|array<string|int, mixed>|Iterator $data = null ]) : mixed
Constructor.
Initializes the stack with an array or an iterable object. |
public
|
|
public
|
|
public
|
copyFrom(mixed $data) : mixed
Copies iterable data into the stack.
Note, existing data in the list will be cleared first. |
public
|
count() : int
Returns the number of items in the stack.
This method is required by \Countable interface. |
public
|
|
public
|
getIterator() : Iterator
Returns an iterator for traversing the items in the stack.
This method is required by the interface \IteratorAggregate. |
public
|
peek() : mixed
Returns the item at the top of the stack.
Unlike pop(), this method does not remove the item from the stack. |
public
|
|
public
|
|
public
|
\Prado\TComponent::GLOBAL_RAISE_EVENT_LISTENER |