Elgg  Version master
Public Member Functions | Static Public Member Functions | List of all members
Elgg\Structs\Collection\InMemory Class Reference

Uses native PHP array to implement the Collection interface. More...

Inheritance diagram for Elgg\Structs\Collection\InMemory:
Elgg\Structs\Collection

Public Member Functions

 contains ($item)
 Returns true iff the item is in this collection at least once.
Parameters
mixed$itemThe object or value to check for
Returns
boolean
More...
 
 count ()
 
 current ()
 
 filter (callable $filter)
 Returns a new collection only containing the elements which pass the filter.
Parameters
callable$filterReceives an item. Return true to keep the item.
Returns
Collection
More...
 
 key ()
 
 map (callable $mapper)
 Take items of the collection and return a new collection with all the items having the $mapper applied to them.The callable is not guaranteed to execute immediately for each item.
Parameters
callable$mapperReturns the mapped value
Returns
Collection
More...
 
 next ()
 
 rewind ()
 
 valid ()
 

Static Public Member Functions

static fromArray (array $items)
 Factory function for converting from an array to a ton of items. More...
 

Detailed Description

Uses native PHP array to implement the Collection interface.

Since
1.10

Definition at line 13 of file InMemory.php.

Member Function Documentation

Elgg\Structs\Collection\InMemory::contains (   $item)

Returns true iff the item is in this collection at least once.

Parameters
mixed$itemThe object or value to check for
Returns
boolean

Implements Elgg\Structs\Collection.

Definition at line 26 of file InMemory.php.

Elgg\Structs\Collection\InMemory::count ( )

Definition at line 34 of file InMemory.php.

Elgg\Structs\Collection\InMemory::current ( )

Definition at line 42 of file InMemory.php.

Elgg\Structs\Collection\InMemory::filter ( callable  $filter)

Returns a new collection only containing the elements which pass the filter.

Parameters
callable$filterReceives an item. Return true to keep the item.
Returns
Collection

Implements Elgg\Structs\Collection.

Definition at line 49 of file InMemory.php.

static Elgg\Structs\Collection\InMemory::fromArray ( array  $items)
static

Factory function for converting from an array to a ton of items.

Parameters
array$itemsThe list of objects to include. Generics come later.
Returns
self

Definition at line 112 of file InMemory.php.

Elgg\Structs\Collection\InMemory::key ( )

Definition at line 65 of file InMemory.php.

Elgg\Structs\Collection\InMemory::map ( callable  $mapper)

Take items of the collection and return a new collection with all the items having the $mapper applied to them.The callable is not guaranteed to execute immediately for each item.

Parameters
callable$mapperReturns the mapped value
Returns
Collection

Implements Elgg\Structs\Collection.

Definition at line 72 of file InMemory.php.

Elgg\Structs\Collection\InMemory::next ( )

Definition at line 85 of file InMemory.php.

Elgg\Structs\Collection\InMemory::rewind ( )

Definition at line 93 of file InMemory.php.

Elgg\Structs\Collection\InMemory::valid ( )

Definition at line 101 of file InMemory.php.


The documentation for this class was generated from the following file: