Trait CollectionTrait
Offers a handful of method to manipulate iterators
- Cake\Collection\CollectionTrait uses Cake\Collection\ExtractTrait
Direct Users
Indirect Users
- Cake\Collection\Iterator\BufferedIterator
- Cake\Collection\Iterator\ExtractIterator
- Cake\Collection\Iterator\FilterIterator
- Cake\Collection\Iterator\InsertIterator
- Cake\Collection\Iterator\NestIterator
- Cake\Collection\Iterator\NoChildrenIterator
- Cake\Collection\Iterator\ReplaceIterator
- Cake\Collection\Iterator\SortIterator
- Cake\Datasource\ResultSetDecorator
Method Summary
-
_unwrap() public
-
append() public
-
appendItem() public
-
avg() public
-
buffered() public
-
cartesianProduct() public
-
chunk() public
-
chunkWithKeys() public
-
combine() public
-
compile() public
-
contains() public
-
count() public
-
countBy() public
-
countKeys() public
-
each() public
-
every() public
-
extract() public
-
filter() public
-
first() public
-
firstMatch() public
-
groupBy() public
-
indexBy() public
-
insert() public
-
isEmpty() public
-
jsonSerialize() public
-
last() public
-
lazy() public
-
listNested() public
-
map() public
-
match() public
-
max() public
-
median() public
-
min() public
-
nest() public
-
optimizeUnwrap() protected
Unwraps this iterator and returns the simplest traversable that can be used for getting the data out
-
prepend() public
-
prependItem() public
-
reduce() public
-
reject() public
-
sample() public
-
shuffle() public
-
skip() public
-
some() public
-
sortBy() public
-
stopWhen() public
-
sumOf() public
-
take() public
-
takeLast() public
-
through() public
-
toArray() public
-
toList() public
-
transpose() public
-
unfold() public
-
unwrap() public
-
zip() public
-
zipWith() public
Method Detail
cartesianProduct() public ¶
cartesianProduct( callable $operation null , callable $filter null )
Parameters
- callable $operation optional null
- Operation
- callable $filter optional null
- Filter
Returns
Throws
optimizeUnwrap() protected ¶
optimizeUnwrap( )
Unwraps this iterator and returns the simplest traversable that can be used for getting the data out
Returns
Methods used from Cake\Collection\ExtractTrait
_createMatcherFilter() protected ¶
_createMatcherFilter( array $conditions )
Returns a callable that receives a value and will return whether or not it matches certain condition.
Parameters
- array $conditions
A key-value list of conditions to match where the key is the property path to get from the current item and the value is the value to be compared the item with.
Returns
_extract() protected ¶
_extract( array|ArrayAccess $data , array $path )
Returns a column from $data that can be extracted
by iterating over the column names contained in $path.
It will return arrays for elements in represented with {*}
Parameters
- array|ArrayAccess $data
- Data.
- array $path
- Path to extract from.
Returns
_propertyExtractor() protected ¶
_propertyExtractor( string|callable $callback )
Returns a callable that can be used to extract a property or column from an array or object based on a dot separated path.
Parameters
- string|callable $callback
A dot separated path of column to follow so that the final one can be returned or a callable that will take care of doing that.
Returns
_simpleExtract() protected ¶
_simpleExtract( array|ArrayAccess $data , array $path )
Returns a column from $data that can be extracted by iterating over the column names contained in $path
Parameters
- array|ArrayAccess $data
- Data.
- array $path
- Path to extract from.