classe Collection implémente Countable, JsonSerializable, IteratorAggregate, ArrayAccess (Voir la source)

Propriétés

protected array $storage

The collection store

Méthodes

__construct(array $arr = [])

Collection constructor

mixed
first()

The first element of the list

array
last()

The last element of the list

bool
has(string $key, bool $strict = false)

Check existence of a key in the session collection

bool
isEmpty()

Check if a collection is empty.

mixed
get(string $key = null, mixed $default = null)

Allows to recover a value or value collection.

values()

Get the list of values of collection

keys()

Get the list of keys of collection

int
count()

Count the collection element.

collectionify(string $key)

To retrieve a value or value collection form d'instance de collection.

delete(string $key)

Delete an entry in the collection

mixed
set(string $key, mixed $value)

Modify an entry in the collection or the addition if not

each(callable $cb)

Browse all the values of the collection

merge(Collection|array $array)

Merge the collection with a painting or other collection

map(callable $cb)

Map

filter(callable $cb)

Filter

array
fill(mixed $data, int $offset)

Fill storage

reduce(callable $cb, mixed $next = null)

Reduce

string
implode($sep)

Implode

int
sum(callable $cb = null)

Sum

number
max(callable $cb = null)

Max

number
min(callable $cb = null)

Max

excepts(array $except)

Returns the key list and return an instance of Collection.

ignores(array $ignores)

Ignore the key that is given to it and return an instance of Collection.

reverse()

Reverse collection

bool
update(string|int $key, mixed $data, bool $override = false)

Update an existing value in the collection

yieldify()

Launches a generator

string
toJson(int $option = 0)

Get the data in JSON format

int
length()

Length of the collection

mixed
shift()

Deletes the first item in the collection

mixed
pop()

Deletes the last item in the collection

array
toArray()

Returns the elements of the collection in table format

mixed
all()

Returns the elements of the collection

mixed
push(mixed $value, int|string $key = null)

Add after the last item in the collection

mixed
__get(mixed $name)

__get

void
__set(mixed $name, mixed $value)

__set

bool
__isset(mixed $name)

__isset

void
__unset(mixed $name)

__unset

string
__toString()

__toString

string
jsonSerialize()

jsonSerialize

getIterator()

getIterator

bool
offsetExists(mixed $offset)

offsetExists

mixed
offsetGet(mixed $offset)

offsetGet

void
offsetSet(mixed $offset, mixed $value)

offsetSet

void
offsetUnset(mixed $offset)

offsetUnset

Détails

__construct(array $arr = [])

Collection constructor

Paramètres

array $arr

mixed first()

The first element of the list

Valeur de retour

mixed

array last()

The last element of the list

Valeur de retour

array

bool has(string $key, bool $strict = false)

Check existence of a key in the session collection

Paramètres

string $key
bool $strict

Valeur de retour

bool

bool isEmpty()

Check if a collection is empty.

Valeur de retour

bool

mixed get(string $key = null, mixed $default = null)

Allows to recover a value or value collection.

Paramètres

string $key
mixed $default

Valeur de retour

mixed

Collection values()

Get the list of values of collection

Valeur de retour

Collection

Collection keys()

Get the list of keys of collection

Valeur de retour

Collection

int count()

Count the collection element.

Valeur de retour

int

Collection collectionify(string $key)

To retrieve a value or value collection form d'instance de collection.

Paramètres

string $key

Valeur de retour

Collection

Collection delete(string $key)

Delete an entry in the collection

Paramètres

string $key

Valeur de retour

Collection

mixed set(string $key, mixed $value)

Modify an entry in the collection or the addition if not

Paramètres

string $key
mixed $value

Valeur de retour

mixed

each(callable $cb)

Browse all the values of the collection

Paramètres

callable $cb

Collection merge(Collection|array $array)

Merge the collection with a painting or other collection

Paramètres

Collection|array $array

Valeur de retour

Collection

Exceptions

ErrorException

Collection map(callable $cb)

Map

Paramètres

callable $cb

Valeur de retour

Collection

Collection filter(callable $cb)

Filter

Paramètres

callable $cb

Valeur de retour

Collection

array fill(mixed $data, int $offset)

Fill storage

Paramètres

mixed $data
int $offset

Valeur de retour

array

Collection reduce(callable $cb, mixed $next = null)

Reduce

Paramètres

callable $cb
mixed $next

Valeur de retour

Collection

string implode($sep)

Implode

Paramètres

$sep

Valeur de retour

string

int sum(callable $cb = null)

Sum

Paramètres

callable $cb

Valeur de retour

int

number max(callable $cb = null)

Max

Paramètres

callable $cb

Valeur de retour

number

number min(callable $cb = null)

Max

Paramètres

callable $cb

Valeur de retour

number

Collection excepts(array $except)

Returns the key list and return an instance of Collection.

Paramètres

array $except

Valeur de retour

Collection

Collection ignores(array $ignores)

Ignore the key that is given to it and return an instance of Collection.

Paramètres

array $ignores

Valeur de retour

Collection

Collection reverse()

Reverse collection

Valeur de retour

Collection

bool update(string|int $key, mixed $data, bool $override = false)

Update an existing value in the collection

Paramètres

string|int $key
mixed $data
bool $override

Valeur de retour

bool

Generator yieldify()

Launches a generator

Valeur de retour

Generator

string toJson(int $option = 0)

Get the data in JSON format

Paramètres

int $option

Valeur de retour

string

int length()

Length of the collection

Valeur de retour

int

mixed shift()

Deletes the first item in the collection

Valeur de retour

mixed

mixed pop()

Deletes the last item in the collection

Valeur de retour

mixed

array toArray()

Returns the elements of the collection in table format

Valeur de retour

array

mixed all()

Returns the elements of the collection

Valeur de retour

mixed

mixed push(mixed $value, int|string $key = null)

Add after the last item in the collection

Paramètres

mixed $value
int|string $key

Valeur de retour

mixed

mixed __get(mixed $name)

__get

Paramètres

mixed $name

Valeur de retour

mixed

void __set(mixed $name, mixed $value)

__set

Paramètres

mixed $name
mixed $value

Valeur de retour

void

bool __isset(mixed $name)

__isset

Paramètres

mixed $name

Valeur de retour

bool

void __unset(mixed $name)

__unset

Paramètres

mixed $name

Valeur de retour

void

string __toString()

__toString

Valeur de retour

string

string jsonSerialize()

jsonSerialize

Valeur de retour

string

ArrayIterator getIterator()

getIterator

Valeur de retour

ArrayIterator

bool offsetExists(mixed $offset)

offsetExists

Paramètres

mixed $offset

Valeur de retour

bool

mixed offsetGet(mixed $offset)

offsetGet

Paramètres

mixed $offset

Valeur de retour

mixed

void offsetSet(mixed $offset, mixed $value)

offsetSet

Paramètres

mixed $offset
mixed $value

Valeur de retour

void

void offsetUnset(mixed $offset)

offsetUnset

Paramètres

mixed $offset

Valeur de retour

void