Creates a filtered iterator from another iterator. The filtering is done by passing a callback function to each of the elements and taking them out if it does not return true.
$_callback
protected callable
Creates a filtered iterator using the callback to determine which items are accepted or rejected.
__construct( Iterator $items , callable $callback )
Creates a filtered iterator using the callback to determine which items are accepted or rejected.
Each time the callback is executed it will receive the value of the element in the current iteration, the key of the element and the passed $items iterator as arguments, in that order.
$items
$callback
Cake\Collection\Collection::__construct()
unwrap( )
We perform here some strictness analysis so that the iterator logic is bypassed entirely.
Cake\Collection\CollectionTrait::unwrap()
__debugInfo( )
Returns an array that can be used to describe the internal state of this object.
count( )
Throws an exception.
Issuing a count on a Collection can have many side effects, some making the Collection unusable after the count operation.
serialize( )
Returns a string representation of this object that can be used to reconstruct it
Serializable::serialize()
unserialize( string $collection )
Unserializes the passed string and rebuilds the Collection instance
$collection
Serializable::unserialize()
_unwrap( )
append( $items )
avg( $matcher null )
cartesianProduct( callable $operation null , callable $filter null )
Cake\Collection\CollectionInterface
chunk( $chunkSize )
chunkWithKeys( $chunkSize , $preserveKeys true )
combine( $keyPath , $valuePath , $groupPath null )
compile( $preserveKeys true )
contains( $value )
countBy( $callback )
each( callable $c )
every( callable $c )
extract( $matcher )
first( )
firstMatch( array $conditions )
groupBy( $callback )
indexBy( $callback )
isEmpty( )
jsonSerialize( )
last( )
listNested( $dir 'desc' , $nestingKey 'children' )
Cake\Collection\Iterator\TreeIterator
match( array $conditions )
max( $callback , $type SORT_NUMERIC )
median( $matcher null )
min( $callback , $type SORT_NUMERIC )
nest( $idPath , $parentPath , $nestingKey 'children' )
optimizeUnwrap( )
Unwraps this iterator and returns the simplest traversable that can be used for getting the data out
reduce( callable $c , $zero null )
sample( $size 10 )
shuffle( )
skip( $howMany )
some( callable $c )
sortBy( $callback , $dir SORT_DESC , $type SORT_NUMERIC )
sumOf( $matcher null )
take( $size 1 , $from 0 )
through( callable $handler )
toArray( $preserveKeys true )
toList( )
unfold( callable $transformer null )
zip( $items )
zipWith( $items , $callable )
© 2005–2018 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.
https://api.cakephp.org/3.5/class-Cake.Collection.Iterator.FilterIterator.html