Documentation

ArrayList
in package
implements ArrayAccess, Countable, IteratorAggregate

Provides the base class for a generic list (items can be accessed by index).

Tags
template
implements
implements

Table of Contents

Interfaces

ArrayAccess
Countable
IteratorAggregate

Properties

$list  : array<string|int, mixed>

Methods

count()  : int
Returns items count.
from()  : static
Transforms array to ArrayList.
getIterator()  : Iterator<int, T>
Returns an iterator over all items.
offsetExists()  : bool
Determines whether an item exists.
offsetGet()  : T
Returns an item.
offsetSet()  : void
Replaces or appends an item.
offsetUnset()  : void
Removes the element at the specified position in this list.
prepend()  : void
Prepends an item.

Properties

$list

private array<string|int, mixed> $list = []

Methods

count()

Returns items count.

public count() : int
Return values
int

from()

Transforms array to ArrayList.

public static from(array<int, T$array) : static
Parameters
$array : array<int, T>
Return values
static

getIterator()

Returns an iterator over all items.

public & getIterator() : Iterator<int, T>
Return values
Iterator<int, T>

offsetExists()

Determines whether an item exists.

public offsetExists(int $index) : bool
Parameters
$index : int
Return values
bool

offsetSet()

Replaces or appends an item.

public offsetSet(int|null $index, T $value) : void
Parameters
$index : int|null
$value : T
Tags
throws
OutOfRangeException

offsetUnset()

Removes the element at the specified position in this list.

public offsetUnset(int $index) : void
Parameters
$index : int
Tags
throws
OutOfRangeException

prepend()

Prepends an item.

public prepend(T $value) : void
Parameters
$value : T

        
On this page

Search results