Kotchasan

Collection
in package
implements Countable, IteratorAggregate, ArrayAccess

Collection Class

Tags
see
https://www.kotchasan.com/

Interfaces, Classes and Traits

Countable
IteratorAggregate
ArrayAccess

Table of Contents

$datas  : array<string|int, mixed>
Holds the class members.
__construct()  : mixed
Create a new collection.
clear()  : void
Clear all data.
count()  : int
Get the count of all data.
get()  : mixed
Get the value at $key, or $default if not found.
getIterator()  : ArrayIterator
Retrieve an external iterator.
has()  : bool
Check if $key exists.
keys()  : array<string|int, mixed>
Get a list of keys.
offsetExists()  : bool
Check if $key exists.
offsetGet()  : mixed
Get the value at $key.
offsetSet()  : void
Set the $value of $key.
offsetUnset()  : void
Remove the item at $key.
remove()  : void
Remove the item at $key.
replace()  : void
Add new items, replacing existing items.
set()  : void
Set the $value of $key.
toArray()  : array<string|int, mixed>
Get all data as an array.

Properties

$datas

Holds the class members.

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

Methods

__construct()

Create a new collection.

public __construct([array<string|int, mixed> $items = [] ]) : mixed
Parameters
$items : array<string|int, mixed> = []

The initial members of the Collection.

Return values
mixed

clear()

Clear all data.

public clear() : void
Return values
void

count()

Get the count of all data.

public count() : int
Return values
int

get()

Get the value at $key, or $default if not found.

public get(mixed $key[, mixed $default = null ]) : mixed
Parameters
$key : mixed
$default : mixed = null
Return values
mixed

getIterator()

Retrieve an external iterator.

public getIterator() : ArrayIterator
Return values
ArrayIterator

has()

Check if $key exists.

public has(mixed $key) : bool
Parameters
$key : mixed
Return values
bool

keys()

Get a list of keys.

public keys() : array<string|int, mixed>
Return values
array<string|int, mixed>

offsetExists()

Check if $key exists.

public offsetExists(mixed $key) : bool
Parameters
$key : mixed
Return values
bool

offsetGet()

Get the value at $key.

public offsetGet(mixed $key) : mixed
Parameters
$key : mixed
Return values
mixed

offsetSet()

Set the $value of $key.

public offsetSet(mixed $key, mixed $value) : void
Parameters
$key : mixed
$value : mixed
Return values
void

offsetUnset()

Remove the item at $key.

public offsetUnset(mixed $key) : void
Parameters
$key : mixed
Return values
void

remove()

Remove the item at $key.

public remove(mixed $key) : void
Parameters
$key : mixed
Return values
void

replace()

Add new items, replacing existing items.

public replace(array<string|int, mixed> $items) : void
Parameters
$items : array<string|int, mixed>

array(array($key => $value), array($key => $value), ...)

Return values
void

set()

Set the $value of $key.

public set(mixed $key, mixed $value) : void
Parameters
$key : mixed
$value : mixed
Return values
void

toArray()

Get all data as an array.

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

Search results