Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
simplearray.php
1<?php
2
4
5class SimpleArray extends DataSource implements \Iterator
6{
7 protected $data = array();
8 protected $currentPos = 0;
9
10 public function current()
11 {
12 return $this->data[$this->currentPos];
13 }
14
15 public function key()
16 {
17 return $this->currentPos;
18 }
19
20 public function next()
21 {
22 $this->currentPos++;
23 }
24
25 public function rewind()
26 {
27 $this->currentPos = 0;
28 }
29
30 public function valid()
31 {
32 return isset($this->data[$this->currentPos]) && !empty($this->data[$this->currentPos]);
33 }
34
35 public function setData(array $data)
36 {
37 $this->data = $data;
38 }
39}