CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Team
    • Issues (Github)
    • YouTube Channel
    • Get Involved
    • Bakery
    • Featured Resources
    • Newsletter
    • Certification
    • My CakePHP
    • CakeFest
    • Facebook
    • Twitter
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.8 Red Velvet API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 3.8
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Cake
    • Auth
      • Storage
    • Cache
      • Engine
    • Collection
      • Iterator
    • Command
    • Console
      • Exception
    • Controller
      • Component
      • Exception
    • Core
      • Configure
        • Engine
      • Exception
      • Retry
    • Database
      • Driver
      • Exception
      • Expression
      • Schema
      • Statement
      • Type
    • Datasource
      • Exception
    • Error
      • Middleware
    • Event
      • Decorator
    • Filesystem
    • Form
    • Http
      • Client
        • Adapter
        • Auth
      • Cookie
      • Exception
      • Middleware
      • Session
    • I18n
      • Formatter
      • Middleware
      • Parser
    • Log
      • Engine
    • Mailer
      • Exception
      • Transport
    • Network
      • Exception
    • ORM
      • Association
      • Behavior
        • Translate
      • Exception
      • Locator
      • Rule
    • Routing
      • Exception
      • Filter
      • Middleware
      • Route
    • Shell
      • Helper
      • Task
    • TestSuite
      • Fixture
      • Stub
    • Utility
      • Exception
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget
  • None

Classes

  • BufferedIterator
  • ExtractIterator
  • FilterIterator
  • InsertIterator
  • MapReduce
  • NestIterator
  • NoChildrenIterator
  • ReplaceIterator
  • SortIterator
  • TreeIterator
  • TreePrinter
  • ZipIterator

Class BufferedIterator

Creates an iterator from another iterator that will keep the results of the inner iterator in memory, so that results don't have to be re-calculated.

IteratorIterator implements Iterator, Traversable, OuterIterator
Extended by Cake\Collection\Collection implements Cake\Collection\CollectionInterface, Serializable uses Cake\Collection\CollectionTrait
Extended by Cake\Collection\Iterator\BufferedIterator implements Countable, Serializable
Namespace: Cake\Collection\Iterator
Location: Collection/Iterator/BufferedIterator.php

Properties summary

  • $_buffer protected
    SplDoublyLinkedList
    The in-memory cache containing results from previous iterators
  • $_current protected
    mixed
    Last record fetched from the inner iterator
  • $_finished protected
    boolean
    Whether or not the internal iterator has reached its end.
  • $_index protected
    integer
    Points to the next record number that should be fetched
  • $_key protected
    mixed
    Last key obtained from the inner iterator
  • $_started protected
    boolean

    Whether or not the internal iterator's rewind method was already called

Method Summary

  • __construct() public

    Maintains an in-memory cache of the results yielded by the internal iterator.

  • count() public
    Returns the number or items in this collection
  • current() public
    Returns the current record in the iterator
  • key() public
    Returns the current key in the iterator
  • next() public
    Advances the iterator pointer to the next element
  • rewind() public
    Rewinds the collection
  • serialize() public

    Returns a string representation of this object that can be used to reconstruct it

  • unserialize() public
    Unserializes the passed string and rebuilds the BufferedIterator instance
  • valid() public
    Returns whether or not the iterator has more elements

Method Detail

__construct() public ¶

__construct( array|Traversable $items )

Maintains an in-memory cache of the results yielded by the internal iterator.

Parameters
array|Traversable $items
The items to be filtered.
Throws
InvalidArgumentException
If passed incorrect type for items.
Overrides
Cake\Collection\Collection::__construct()

count() public ¶

count( )

Returns the number or items in this collection

Returns
integer
Overrides
Cake\Collection\Collection::count()
Implementation of
Countable::count()

current() public ¶

current( )

Returns the current record in the iterator

Returns
mixed
Overrides
IteratorIterator::current()

key() public ¶

key( )

Returns the current key in the iterator

Returns
mixed
Overrides
IteratorIterator::key()

next() public ¶

next( )

Advances the iterator pointer to the next element

Overrides
IteratorIterator::next()

rewind() public ¶

rewind( )

Rewinds the collection

Overrides
IteratorIterator::rewind()

serialize() public ¶

serialize( )

Returns a string representation of this object that can be used to reconstruct it

Returns
string
Overrides
Cake\Collection\Collection::serialize()
Implementation of
Serializable::serialize()

unserialize() public ¶

unserialize( string $buffer )

Unserializes the passed string and rebuilds the BufferedIterator instance

Parameters
string $buffer
The serialized buffer iterator
Overrides
Cake\Collection\Collection::unserialize()
Implementation of
Serializable::unserialize()

valid() public ¶

valid( )

Returns whether or not the iterator has more elements

Returns
boolean
Overrides
IteratorIterator::valid()

Methods inherited from Cake\Collection\Collection

__debugInfo() public ¶

__debugInfo( )

Returns an array that can be used to describe the internal state of this object.

Returns
array

countKeys() public ¶

countKeys( )

Returns the number of unique keys in this iterator. This is, the number of elements the collection will contain after calling toArray()

Returns
integer
Implementation of
Cake\Collection\CollectionInterface::countKeys()

Methods used from Cake\Collection\CollectionTrait

_unwrap() public ¶

_unwrap( )

append() public ¶

append( $items )

appendItem() public ¶

appendItem( $item , $key = null )

avg() public ¶

avg( $matcher = null )

buffered() public ¶

buffered( )

Returns
Cake\Collection\Iterator\BufferedIterator

cartesianProduct() public ¶

cartesianProduct( callable $operation = null , callable $filter = null )

Parameters
callable $operation optional null
Operation
callable $filter optional null
Filter
Returns
Cake\Collection\CollectionInterface
Throws
LogicException

chunk() public ¶

chunk( $chunkSize )

chunkWithKeys() public ¶

chunkWithKeys( $chunkSize , $preserveKeys = true )

combine() public ¶

combine( $keyPath , $valuePath , $groupPath = null )

compile() public ¶

compile( $preserveKeys = true )

contains() public ¶

contains( $value )

countBy() public ¶

countBy( $callback )

each() public ¶

each( callable $c )

every() public ¶

every( callable $c )

extract() public ¶

extract( $matcher )

filter() public ¶

filter( callable $c = null )

Returns
Cake\Collection\Iterator\FilterIterator

first() public ¶

first( )

firstMatch() public ¶

firstMatch( array $conditions )

groupBy() public ¶

groupBy( $callback )

indexBy() public ¶

indexBy( $callback )

insert() public ¶

insert( $path , $values )

Returns
Cake\Collection\Iterator\InsertIterator

isEmpty() public ¶

isEmpty( )

jsonSerialize() public ¶

jsonSerialize( )

last() public ¶

last( )

lazy() public ¶

lazy( )

listNested() public ¶

listNested( $dir = 'desc' , $nestingKey = 'children' )

Returns
Cake\Collection\Iterator\TreeIterator

map() public ¶

map( callable $c )

Returns
Cake\Collection\Iterator\ReplaceIterator

match() public ¶

match( array $conditions )

max() public ¶

max( $callback , $type = \SORT_NUMERIC )

median() public ¶

median( $matcher = null )

min() public ¶

min( $callback , $type = \SORT_NUMERIC )

nest() public ¶

nest( $idPath , $parentPath , $nestingKey = 'children' )

newCollection() protected ¶

newCollection( ... $args )

Returns a new collection.

Allows classes which use this trait to determine their own type of returned collection interface

Parameters
... $args
$args Constructor arguments.
Returns
Cake\Collection\CollectionInterface

optimizeUnwrap() protected ¶

optimizeUnwrap( )

Unwraps this iterator and returns the simplest traversable that can be used for getting the data out

Returns
Traversable|array

prepend() public ¶

prepend( $items )

prependItem() public ¶

prependItem( $item , $key = null )

reduce() public ¶

reduce( callable $c , $zero = null )

reject() public ¶

reject( callable $c )

Returns
Cake\Collection\Iterator\FilterIterator

sample() public ¶

sample( $size = 10 )

shuffle() public ¶

shuffle( )

skip() public ¶

skip( $howMany )

some() public ¶

some( callable $c )

sortBy() public ¶

sortBy( $callback , $dir = \SORT_DESC , $type = \SORT_NUMERIC )

stopWhen() public ¶

stopWhen( $condition )

Returns
Cake\Collection\Iterator\StoppableIterator

sumOf() public ¶

sumOf( $matcher = null )

take() public ¶

take( $size = 1 , $from = 0 )

takeLast() public ¶

takeLast( $howMany )

through() public ¶

through( callable $handler )

toArray() public ¶

toArray( $preserveKeys = true )

toList() public ¶

toList( )

transpose() public ¶

transpose( )

Returns
Cake\Collection\CollectionInterface
Throws
LogicException

unfold() public ¶

unfold( callable $transformer = null )

unwrap() public ¶

unwrap( )

zip() public ¶

zip( $items )

zipWith() public ¶

zipWith( $items , $callable )

Magic methods inherited from Cake\Collection\CollectionInterface

cartesianProduct()

Properties detail

$_buffer ¶

protected SplDoublyLinkedList

The in-memory cache containing results from previous iterators

$_current ¶

protected mixed

Last record fetched from the inner iterator

$_finished ¶

protected boolean

Whether or not the internal iterator has reached its end.

false

$_index ¶

protected integer

Points to the next record number that should be fetched

$_key ¶

protected mixed

Last key obtained from the inner iterator

$_started ¶

protected boolean

Whether or not the internal iterator's rewind method was already called

false
Follow @CakePHP
#IRC
OpenHub
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Logos & Trademarks
  • Community
  • Team
  • Issues (Github)
  • YouTube Channel
  • Get Involved
  • Bakery
  • Featured Resources
  • Newsletter
  • Certification
  • My CakePHP
  • CakeFest
  • Facebook
  • Twitter
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs