1 | <?php |
||
21 | class IteratorDataSource extends DataSource |
||
22 | { |
||
23 | /** |
||
24 | * @var \Traversable |
||
25 | */ |
||
26 | protected $iterator; |
||
27 | |||
28 | /** |
||
29 | * @var bool |
||
30 | */ |
||
31 | private $iteratorSorted; |
||
32 | |||
33 | /** |
||
34 | * @param \Traversable $iterator |
||
35 | * @param SpecificationInterface $searchCriteria |
||
36 | * @param ComparatorInterface $sortCriteria |
||
37 | * @param int $offset |
||
38 | * @param int $length |
||
39 | */ |
||
40 | public function __construct( |
||
52 | |||
53 | /** |
||
54 | * {@inheritdoc} |
||
55 | */ |
||
56 | public function getIterator() |
||
76 | |||
77 | /** |
||
78 | * {@inheritdoc} |
||
79 | */ |
||
80 | public function findOne() |
||
88 | |||
89 | /** |
||
90 | * {@inheritdoc} |
||
91 | */ |
||
92 | public function filteredDataSource(SpecificationInterface $criteria) |
||
106 | |||
107 | /** |
||
108 | * {@inheritdoc} |
||
109 | */ |
||
110 | public function slicedDataSource($offset, $length = null) |
||
120 | |||
121 | /** |
||
122 | * {@inheritdoc} |
||
123 | */ |
||
124 | public function sortedDataSource(ComparatorInterface $sortCriteria) |
||
134 | |||
135 | /** |
||
136 | * {@inheritdoc} |
||
137 | */ |
||
138 | protected function calculateCount() |
||
142 | |||
143 | /** |
||
144 | * @param mixed $item |
||
145 | * |
||
146 | * @return bool |
||
147 | */ |
||
148 | protected function evaluate($item) |
||
152 | |||
153 | /** |
||
154 | * @param int $offset |
||
155 | * |
||
156 | * @return bool |
||
157 | */ |
||
158 | private function checkOffset($offset) |
||
162 | |||
163 | /** |
||
164 | * @param int $count |
||
165 | * |
||
166 | * @return bool |
||
167 | */ |
||
168 | private function checkLenght($count) |
||
172 | |||
173 | private function sort() |
||
186 | } |
||
187 |