Elgg
Version 1.11
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
engine
classes
Elgg
Structs
ArrayCollection.php
Go to the documentation of this file.
1
<?php
2
namespace
Elgg\Structs
;
3
4
use
Exception
;
5
15
final
class
ArrayCollection
implements
Collection
{
17
private
$items;
18
24
public
function
__construct
(array $items = array()) {
25
$this->items = $items;
26
}
27
29
public
function
contains
(
$item
) {
30
return
in_array(
$item
, $this->items,
true
);
31
}
32
34
public
function
count
() {
35
return
count
($this->items);
36
}
37
39
public
function
current
() {
40
return
current
($this->items);
41
}
42
44
public
function
filter
(callable
$filter
) {
45
$results = array();
46
47
foreach
($this->items as
$item
) {
48
if
(
$filter
($item)) {
49
$results[] =
$item
;
50
}
51
}
52
53
return
new
ArrayCollection
($results);
54
}
55
57
public
function
key
() {
58
return
key
($this->items);
59
}
60
62
public
function
map
(callable $mapper) {
63
$results = array();
64
foreach
($this->items as
$item
) {
65
$results[] = $mapper($item);
66
}
67
return
new
ArrayCollection
($results);
68
}
69
71
public
function
next
() {
72
return
next
($this->items);
73
}
74
76
public
function
rewind
() {
77
reset($this->items);
78
}
79
81
public
function
valid
() {
82
return
key
($this->items) !== NULL;
83
}
84
}
Elgg\Structs\ArrayCollection
Definition:
ArrayCollection.php:15
Elgg\Structs\ArrayCollection\current
current()
Definition:
ArrayCollection.php:39
Elgg\Structs\ArrayCollection\count
count()
Definition:
ArrayCollection.php:34
Elgg\Structs\ArrayCollection\valid
valid()
Definition:
ArrayCollection.php:81
Elgg\Structs\ArrayCollection\key
key()
Definition:
ArrayCollection.php:57
Elgg\Structs
Definition:
ArrayCollection.php:2
Elgg\Structs\ArrayCollection\map
map(callable $mapper)
Definition:
ArrayCollection.php:62
$item
$item
Definition:
item.php:12
$filter
if(!$vars['title']&&$vars['title']!==false) if(isset($vars['filter_override'])) if(!isset($vars['filter'])&&elgg_is_logged_in()&&$context) $filter
Definition:
content.php:62
Elgg\Structs\ArrayCollection\next
next()
Definition:
ArrayCollection.php:71
Elgg\Structs\Collection
Definition:
Collection.php:35
Elgg\Structs\ArrayCollection\__construct
__construct(array $items=array())
Constructor.
Definition:
ArrayCollection.php:24
Elgg\Structs\ArrayCollection\filter
filter(callable $filter)
Definition:
ArrayCollection.php:44
Elgg\Structs\ArrayCollection\rewind
rewind()
Definition:
ArrayCollection.php:76
Elgg\Structs\ArrayCollection\contains
contains($item)
Definition:
ArrayCollection.php:29
Exception
Generated on Sat Dec 21 2024 00:00:49 for Elgg by
1.8.11