| Total Complexity | 6 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | class Loop |
||
| 21 | { |
||
| 22 | |||
| 23 | protected $iteration = 0; |
||
| 24 | protected $index = -1; |
||
| 25 | protected $key; |
||
| 26 | |||
| 27 | protected $first; |
||
| 28 | protected $firstIndex; |
||
| 29 | protected $last; |
||
| 30 | protected $lastIndex; |
||
| 31 | |||
| 32 | 8 | public function __construct($data) |
|
| 42 | } |
||
| 43 | 8 | } |
|
| 44 | |||
| 45 | 5 | public function next($key) |
|
| 46 | { |
||
| 47 | 5 | $this->index++; |
|
| 48 | 5 | $this->iteration++; |
|
| 49 | 5 | $this->key = $key; |
|
| 50 | 5 | $this->first = $this->firstIndex === $this->key; |
|
| 51 | 5 | $this->last = $this->lastIndex === $this->key; |
|
| 52 | 5 | } |
|
| 53 | |||
| 54 | 2 | public function __get(string $name) |
|
| 55 | { |
||
| 56 | 2 | return $this->{$name}; |
|
| 57 | } |
||
| 58 | |||
| 59 | 1 | public function __set(string $name, $value) |
|
| 60 | { |
||
| 61 | 1 | throw new Invalid('Loop::' . $name . ' readonly'); |
|
| 62 | } |
||
| 63 | |||
| 64 | 1 | public function __isset(string $name) |
|
| 67 | } |
||
| 68 | |||
| 69 | } |
||
| 70 |