Methods summary
public
|
#
__construct( array $items = [] )
The constructor.
Parameters
|
public
array
|
#
all( )
Get all models in the collection.
Get all models in the collection.
Returns
array
|
public
integer
|
#
count( )
Get number of items that exists in the collection.
Get number of items that exists in the collection.
Returns
integer
|
public
mixed
|
#
eq( string $offset )
Get item in collection.
Parameters
Returns
mixed
|
public
array
|
#
filter( callable|string $callback, mixed $value = null )
Create a collection of all elements that do pass
the given truth test.
Create a collection of all elements that do pass
the given truth test.
Parameters
Returns
array
|
protected
mixed
|
#
find_in_item( mixed $attributes, string $key, mxied $default = null )
Find attribute value by key.
Find attribute value by key.
Parameters
- $attributes
- $key
- $default
Returns
mixed
|
public
mixed
|
#
first( callable $callback = null )
Get the first item in the collection.
Get the first item in the collection.
Parameters
Returns
mixed
|
public
boolean
|
#
is_empty( )
Determine if the collection is empty or not.
Determine if the collection is empty or not.
Returns
boolean
|
public
mixed
|
#
last( callable $callback = null )
Get the last item in the collection.
Get the last item in the collection.
Parameters
Returns
mixed
|
public
Xu\Model\Collection
|
#
map( callable $callback )
Run map over each of the items.
Run map over each of the items.
Parameters
Returns
|
public
boolean
|
#
offsetExists( mixed $offset )
Determine if the given offset exists.
Determine if the given offset exists.
Parameters
Returns
boolean
Implementation of
ArrayAccess::offsetExists()
|
public
mixed
|
#
offsetGet( mixed $offset )
Get the value for a given offset.
Get the value for a given offset.
Parameters
Returns
mixed
Implementation of
ArrayAccess::offsetGet()
|
public
|
#
offsetSet( mixed $offset, mixed $value )
Set the value for a given offset.
Set the value for a given offset.
Parameters
Implementation of
ArrayAccess::offsetSet()
|
public
|
#
offsetUnset( mixed $offset )
Unset the value for a given offset.
Unset the value for a given offset.
Parameters
Implementation of
ArrayAccess::offsetUnset()
|
public
array
|
#
pluck( string $key )
Pluck a certain field out of each item in a list.
Pluck a certain field out of each item in a list.
Parameters
Returns
array
|
public
mixed
|
#
pop( )
Removes and return the last item from the collection.
Removes and return the last item from the collection.
Returns
mixed
|
public
Xu\Model\Collection
|
#
reject( callable|string $callback, mixed $value = null )
Create a collection of all elements that do not pass
the given truth test.
Create a collection of all elements that do not pass
the given truth test.
Parameters
Returns
|
public
array
|
#
reverse( )
Reverse the collection items.
Reverse the collection items.
Returns
array
|
public
mixed
|
#
shift( )
Removes and return the first item from the collection.
Removes and return the first item from the collection.
Returns
mixed
|
public
Xu\Model\Collection
|
#
slice( integer $offset, integer $length = null, boolean $preserve_keys = false )
Extract a slice of the collection.
Extract a slice of the collection.
Parameters
- $offset
- $length
- $preserve_keys
Returns
|
public
Xu\Model\Collection
|
#
sort( callable $callback )
Sort through each item in the collection.
Sort through each item in the collection.
Parameters
Returns
|
public
Xu\Model\Collection
|
#
where( string $key, mixed $value = null )
Filter models by the given key value pair.
Filter models by the given key value pair.
Parameters
Returns
|
public
array
|
#
to_array( )
Convert the collection items to an array.
Convert the collection items to an array.
Returns
array
|