A generic LIFO Stack.
- Class name: Stack
- Namespace: PHPCollections\Collections
- This class implements: Countable
private array $data
The data container.
- Visibility: private
private mixed $type
The type of the values for this Stack.
- Visibility: private
void PHPCollections\Collections\Stack::__construct(string $type)
Creates a new Stack.
- Visibility: public
- $type string
void PHPCollections\Collections\Stack::clear()
Clears the data values.
- Visibility: public
int PHPCollections\Collections\Stack::count()
Returns the length of the Stack.
- Visibility: public
bool PHPCollections\Collections\Stack::isEmpty()
Checks if the stack is empty.
- Visibility: public
mixed PHPCollections\Collections\Stack::peek()
Gets the element at the end of the Stack.
- Visibility: public
mixed PHPCollections\Collections\Stack::pop()
Pops the element at the end of the stack.
- Visibility: public
mixed PHPCollections\Collections\Stack::push(mixed $value)
Adds a new element at the end of the Stack.
- Visibility: public
- $value mixed
- \InvalidArgumentException