ArrayList
in package
implements
ListInterface
Class ArrayList
Tags
Table of Contents
Interfaces
- ListInterface
- ListInterface
Methods
- __construct() : mixed
- ArrayList constructor.
- __toString() : false|string
- String representation of ArrayList
- append() : void
- Appends a list to another.
- count() : int
- Count elements of an object
- current() : mixed
- Return the current element
- first() : mixed
- Get the first value of list
- get() : mixed
- Get a value by its key
- has() : bool
- Check if a given key exists on list
- jsonSerialize() : array<string|int, mixed>|mixed
- Return a JSON representation of list
- key() : mixed
- Return the key of the current element
- last() : mixed
- Get the last value of list
- next() : void
- Move forward to next element
- push() : void
- Add a value to list
- put() : void
- Put a object into list on given key
- remove() : mixed
- Remove a value by it's key on list
- rewind() : void
- Rewind the Iterator to the first element
- toArray() : array<string|int, mixed>
- Return an array representation for list
- valid() : bool
- Checks if current position is valid
- values() : array<string|int, mixed>
- Return an array with list values only
Methods
__construct()
ArrayList constructor.
public
__construct([array<string|int, mixed> $content = [] ]) : mixed
Parameters
- $content : array<string|int, mixed> = []
__toString()
String representation of ArrayList
public
__toString() : false|string
Return values
false|stringappend()
Appends a list to another.
public
append(ListInterface $list) : void
Parameters
- $list : ListInterface
-
ListInterface object to append.
count()
Count elements of an object
public
count() : int
Return values
intcurrent()
Return the current element
public
current() : mixed
first()
Get the first value of list
public
first() : mixed
get()
Get a value by its key
public
get(int|string $key) : mixed
Parameters
- $key : int|string
-
Key to verify on list.
has()
Check if a given key exists on list
public
has( $key) : bool
Parameters
Return values
bool —True if key exists, false otherwise.
jsonSerialize()
Return a JSON representation of list
public
jsonSerialize() : array<string|int, mixed>|mixed
Return values
array<string|int, mixed>|mixedkey()
Return the key of the current element
public
key() : mixed
last()
Get the last value of list
public
last() : mixed
next()
Move forward to next element
public
next() : void
push()
Add a value to list
public
push(mixed $value) : void
Parameters
- $value : mixed
-
Value to add.
put()
Put a object into list on given key
public
put(string|int $key, mixed $value) : void
Parameters
- $key : string|int
-
Key for manage the value.
- $value : mixed
-
Value to add.
remove()
Remove a value by it's key on list
public
remove( $key) : mixed
Parameters
rewind()
Rewind the Iterator to the first element
public
rewind() : void
toArray()
Return an array representation for list
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>valid()
Checks if current position is valid
public
valid() : bool
Return values
boolvalues()
Return an array with list values only
public
values() : array<string|int, mixed>