1 | <?php |
||
23 | abstract class LazyCollection implements CollectionInterface |
||
24 | { |
||
25 | /** |
||
26 | * @var CollectionInterface |
||
27 | */ |
||
28 | protected $collection; |
||
29 | |||
30 | /** |
||
31 | * @var bool |
||
32 | */ |
||
33 | protected $initialized = false; |
||
34 | |||
35 | /** |
||
36 | * {@inheritdoc} |
||
37 | */ |
||
38 | public function clear() |
||
44 | |||
45 | /** |
||
46 | * {@inheritdoc} |
||
47 | */ |
||
48 | public function isEmpty() |
||
54 | |||
55 | /** |
||
56 | * {@inheritdoc} |
||
57 | */ |
||
58 | public function toArray() |
||
64 | |||
65 | /** |
||
66 | * {@inheritdoc} |
||
67 | */ |
||
68 | public function getIterator() |
||
74 | |||
75 | /** |
||
76 | * {@inheritdoc} |
||
77 | */ |
||
78 | public function count() |
||
84 | |||
85 | /** |
||
86 | * {@inheritdoc} |
||
87 | */ |
||
88 | public function slice($offset, $length = null) |
||
94 | |||
95 | /** |
||
96 | * {@inheritdoc} |
||
97 | */ |
||
98 | public function find(SpecificationInterface $criteria) |
||
104 | |||
105 | /** |
||
106 | * {@inheritdoc} |
||
107 | */ |
||
108 | public function sorted(ComparatorInterface $criteria) |
||
114 | |||
115 | /** |
||
116 | * Lazy initialize. |
||
117 | */ |
||
118 | protected function lazyInitialize() |
||
125 | |||
126 | /** |
||
127 | * @return bool |
||
128 | */ |
||
129 | protected function isInitialized() |
||
133 | |||
134 | /** |
||
135 | * Initialize the collection. |
||
136 | */ |
||
137 | abstract protected function initialize(); |
||
138 | |||
139 | /** |
||
140 | * @return CollectionInterface |
||
141 | */ |
||
142 | protected function collection() |
||
146 | } |
||
147 |