@@ 159-172 (lines=14) @@ | ||
156 | * Method returns first [[visibleCount]] items from [[data]]. |
|
157 | * @return array |
|
158 | */ |
|
159 | protected function getVisibleItems() |
|
160 | { |
|
161 | if (count($this->data) <= $this->visibleCount) { |
|
162 | return $this->data; |
|
163 | } |
|
164 | $visible = []; |
|
165 | $iterator = (new ArrayObject($this->data))->getIterator(); |
|
166 | while (count($visible) < $this->visibleCount && $iterator->valid()) { |
|
167 | $visible[] = $iterator->current(); |
|
168 | $iterator->next(); |
|
169 | } |
|
170 | ||
171 | return $visible; |
|
172 | } |
|
173 | ||
174 | /** |
|
175 | * Method returns all items from [[data]], skipping first [[visibleCount]]. |
|
@@ 178-191 (lines=14) @@ | ||
175 | * Method returns all items from [[data]], skipping first [[visibleCount]]. |
|
176 | * @return array |
|
177 | */ |
|
178 | protected function getSpoiledItems() |
|
179 | { |
|
180 | if (count($this->data) <= $this->visibleCount) { |
|
181 | return []; |
|
182 | } |
|
183 | $spoiled = []; |
|
184 | $iterator = (new ArrayObject($this->data))->getIterator(); |
|
185 | $iterator->seek($this->visibleCount); |
|
186 | while ($iterator->valid()) { |
|
187 | $spoiled[] = $iterator->current(); |
|
188 | $iterator->next(); |
|
189 | } |
|
190 | return $spoiled; |
|
191 | } |
|
192 | ||
193 | /** |
|
194 | * Renders visible part of spoiler. |