Creates an iterator that returns elements grouped in pairs
$iterator = new ZipIterator([[1, 2], [3, 4]]); $iterator->toList(); // Returns [[1, 3], [2, 4]]
You can also chose a custom function to zip the elements together, such as doing a sum by index:
$iterator = new ZipIterator([[1, 2], [3, 4]], function ($a, $b) { return $a + $b; }); $iterator->toList(); // Returns [4, 6]
__construct( array $sets , callable $callable null )
Creates the iterator to merge together the values by for all the passed iterators by their corresponding index.
$sets
$callable
optional null MultipleIterator::__construct()
current( )
Returns the value resulting out of zipping all the elements for all the iterators with the same positional index.
mixed
MultipleIterator::current()
serialize( )
Returns a string representation of this object that can be used to reconstruct it
string
Serializable::serialize()
unserialize( string $iterators )
Unserializes the passed string and rebuilds the ZipIterator instance
$iterators
Serializable::unserialize()
_unwrap( )
Backwards compatible wrapper for unwrap()
Iterator
append( mixed $items )
Cake\Collection\CollectionInterface::append()
buffered( )
Cake\Collection\Iterator\BufferedIterator
Cake\Collection\CollectionInterface::buffered()
chunk( mixed $chunkSize )
Cake\Collection\CollectionInterface::chunk()
combine( mixed $keyPath , mixed $valuePath , mixed $groupPath null )
Cake\Collection\CollectionInterface::combine()
compile( mixed $preserveKeys true )
Cake\Collection\CollectionInterface::compile()
contains( mixed $value )
Cake\Collection\CollectionInterface::contains()
countBy( mixed $callback )
Cake\Collection\CollectionInterface::countBy()
every( callable $c )
Cake\Collection\CollectionInterface::every()
extract( mixed $matcher )
Cake\Collection\CollectionInterface::extract()
filter( callable $c null )
Cake\Collection\Iterator\FilterIterator
Cake\Collection\CollectionInterface::filter()
firstMatch( array $conditions )
Cake\Collection\CollectionInterface::firstMatch()
groupBy( mixed $callback )
Cake\Collection\CollectionInterface::groupBy()
indexBy( mixed $callback )
Cake\Collection\CollectionInterface::indexBy()
insert( mixed $path , mixed $values )
Cake\Collection\Iterator\InsertIterator
Cake\Collection\CollectionInterface::insert()
jsonSerialize( )
Cake\Collection\CollectionInterface::jsonSerialize()
listNested( mixed $dir 'desc' , mixed $nestingKey 'children' )
Cake\Collection\Iterator\TreeIterator
Cake\Collection\CollectionInterface::listNested()
map( callable $c )
Cake\Collection\Iterator\ReplaceIterator
Cake\Collection\CollectionInterface::map()
match( array $conditions )
Cake\Collection\CollectionInterface::match()
max( mixed $callback , mixed $type SORT_NUMERIC )
Cake\Collection\CollectionInterface::max()
min( mixed $callback , mixed $type SORT_NUMERIC )
Cake\Collection\CollectionInterface::min()
nest( mixed $idPath , mixed $parentPath )
Cake\Collection\CollectionInterface::nest()
reduce( callable $c , mixed $zero null )
Cake\Collection\CollectionInterface::reduce()
reject( callable $c )
Cake\Collection\Iterator\FilterIterator
Cake\Collection\CollectionInterface::reject()
sample( mixed $size 10 )
Cake\Collection\CollectionInterface::sample()
skip( mixed $howMany )
Cake\Collection\CollectionInterface::skip()
sortBy( mixed $callback , mixed $dir SORT_DESC , mixed $type SORT_NUMERIC )
Cake\Collection\CollectionInterface::sortBy()
stopWhen( mixed $condition )
Cake\Collection\Iterator\StoppableIterator
Cake\Collection\CollectionInterface::stopWhen()
sumOf( mixed $matcher null )
Cake\Collection\CollectionInterface::sumOf()
take( mixed $size 1 , mixed $from 0 )
Cake\Collection\CollectionInterface::take()
through( callable $handler )
Cake\Collection\CollectionInterface::through()
toArray( mixed $preserveKeys true )
Cake\Collection\CollectionInterface::toArray()
unfold( callable $transformer null )
Cake\Collection\CollectionInterface::unfold()
zipWith( mixed $items , mixed $callable )
Cake\Collection\CollectionInterface::zipWith()
_createMatcherFilter( array $conditions )
Returns a callable that receives a value and will return whether or not it matches certain condition.
$conditions
callable
_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 {*}
$data
$path
mixed
_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.
$callback
callable
_simpleExtract( array|ArrayAccess $data , array $path )
Returns a column from $data that can be extracted by iterating over the column names contained in $path
$data
$path
mixed
MIT_KEYS_ASSOC, MIT_KEYS_NUMERIC, MIT_NEED_ALL, MIT_NEED_ANY |
© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
http://api.cakephp.org/3.1/class-Cake.Collection.Iterator.ZipIterator.html