1 | <?php |
||
8 | abstract class TraversableBackedCollection implements SnapshotCapableCollection |
||
9 | { |
||
10 | /** |
||
11 | * @var \Traversable |
||
12 | */ |
||
13 | private $items; |
||
14 | |||
15 | /** |
||
16 | * @param \Traversable $items |
||
17 | */ |
||
18 | public function __construct(\Traversable $items) |
||
22 | |||
23 | /** |
||
24 | * {@inheritDoc} |
||
25 | */ |
||
26 | public function filterWith(callable $filter) |
||
32 | |||
33 | /** |
||
34 | * @param callable $filter |
||
35 | * @return \Generator |
||
36 | */ |
||
37 | private function applyFilter(callable $filter) |
||
45 | |||
46 | /** |
||
47 | * {@inheritDoc} |
||
48 | */ |
||
49 | public function traverseWith(callable $callback) |
||
57 | |||
58 | /** |
||
59 | * {@inheritDoc} |
||
60 | */ |
||
61 | public function takeSnapshot() |
||
67 | |||
68 | /** |
||
69 | * {@inheritDoc} |
||
70 | */ |
||
71 | public function getIterator() |
||
75 | |||
76 | /** |
||
77 | * {@inheritDoc} |
||
78 | */ |
||
79 | public function count() |
||
83 | |||
84 | /** |
||
85 | * @return array |
||
86 | */ |
||
87 | public function toArray() |
||
91 | |||
92 | /** |
||
93 | * @param array $items |
||
94 | * @return static |
||
95 | */ |
||
96 | public static function fromArray(array $items) |
||
102 | } |