Collection
class Collection implements Countable, JsonSerializable, IteratorAggregate, ArrayAccess (View source)
Properties
protected array | $storage | The collection store |
Methods
Collection constructor
The first element of the list
The last element of the list
Check existence of a key in the session collection
Check if a collection is empty.
Allows to recover a value or value collection.
Get the list of values of collection
Get the list of keys of collection
Count the collection element.
To retrieve a value or value collection form d'instance de collection.
Delete an entry in the collection
Modify an entry in the collection or the addition if not
Browse all the values of the collection
Map
Filter
Fill storage
Reduce
Implode
Sum
Max
Max
Returns the key list and return an instance of Collection.
Ignore the key that is given to it and return an instance of Collection.
Reverse collection
Update an existing value in the collection
Get the data in JSON format
Length of the collection
Deletes the first item in the collection
Deletes the last item in the collection
Returns the elements of the collection in table format
Returns the elements of the collection
Add after the last item in the collection
__get
__set
__isset
__unset
__toString
jsonSerialize
getIterator
offsetExists
offsetGet
offsetSet
offsetUnset
Details
__construct(array $storage = [])
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.
Collection
values()
Get the list of values of collection
Collection
keys()
Get the list of keys of collection
int
count()
Count the collection element.
Collection
collectionify(string $key)
To retrieve a value or value collection form d'instance de collection.
Collection
delete(string $key)
Delete an entry in the collection
mixed
set(mixed $key, mixed $value)
Modify an entry in the collection or the addition if not
void
each(callable $cb)
Browse all the values of the collection
Collection
merge(Collection|array $array)
Merge the collection with a painting or other collection
Collection
map(callable $cb)
Map
Collection
filter(callable $cb)
Filter
mixed
fill(mixed $data, int $offset)
Fill storage
Collection
reduce(callable $cb, mixed $next = null)
Reduce
string
implode(string $sep)
Implode
int|float
sum(callable $cb = null)
Sum
int|float
max(callable|null $cb = null)
Max
int|float
min(callable|null $cb = null)
Max
Collection
excepts(array $except)
Returns the key list and return an instance of Collection.
Collection
ignores(array $ignores)
Ignore the key that is given to it and return an instance of Collection.
Collection
reverse()
Reverse collection
bool
update(mixed $key, mixed $data, bool $override = false)
Update an existing value in the collection
Generator
yieldify()
Launches the collection content as 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
array
all()
Returns the elements of the collection
Collection
push(mixed $value, mixed $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
ArrayIterator
getIterator()
getIterator
bool
offsetExists(mixed $offset)
offsetExists
mixed
offsetGet(mixed $offset)
offsetGet
void
offsetSet(mixed $offset, mixed $value)
offsetSet
void
offsetUnset(mixed $offset)
offsetUnset