Elgg  Version master
CollectionInterface.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Collections;
4 
8 interface CollectionInterface {
9 
15  public function all();
16 
22  public function count();
23 
31  public function add($item);
32 
40  public function get($id);
41 
49  public function has($id);
50 
58  public function remove($id);
59 
67  public function fill($items);
68 
76  public function merge($items);
77 
86  public function filter(callable $callback = null);
87 
96  public function sort(callable $callback = null);
97 
111  public function walk(callable $callback);
112 
120  public function map(callable $callback);
121 }
if(!$items) $item
Definition: delete.php:13
fill($items)
Replace collection items.
merge($items)
Add new items to collection, replacing items with matching IDs.
sort(callable $callback=null)
Sort fields using custom callable If not provided, will sort items by priority.
walk(callable $callback)
Walk through members of the collection and apply a callback.
$items
Definition: delete.php:8
map(callable $callback)
Walk through all items in the collection and apply a callback.
filter(callable $callback=null)
Filter collection items using a custom filter Returns a new collection instance.
add($item)
Add a new item to collection.
An interface for organizing items into collections.
all()
Returns all collection items by reference.
count()
Count collection items.
has($id)
Check if collection has an item with a given ID.
$id
Generic annotation delete action.
Definition: delete.php:6