Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
7 / 7 |
CRAP | |
100.00% |
12 / 12 |
| ItemSet | |
100.00% |
1 / 1 |
|
100.00% |
7 / 7 |
7 | |
100.00% |
12 / 12 |
| __construct | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
|||
| rewind | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| current | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| key | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| next | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| valid | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| count | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| <?php | |
| namespace SimpleMediumRSS\Item; | |
| use Countable; | |
| use Iterator; | |
| use SimpleXMLElement; | |
| class ItemSet implements Iterator, Countable | |
| { | |
| private $position; | |
| /** @var SimpleXMLElement */ | |
| private $itens; | |
| /** | |
| * @param SimpleXMLElement $itens | |
| */ | |
| public function __construct($itens) | |
| { | |
| $this->itens = $itens; | |
| $this->position = 0; | |
| } | |
| public function rewind(): void | |
| { | |
| $this->position = 0; | |
| } | |
| public function current(): Item | |
| { | |
| $item = new Item($this->itens[$this->position]); | |
| return $item; | |
| } | |
| public function key(): int | |
| { | |
| return $this->position; | |
| } | |
| public function next(): void | |
| { | |
| ++$this->position; | |
| } | |
| public function valid(): bool | |
| { | |
| return isset($this->itens[$this->position]); | |
| } | |
| public function count(): int | |
| { | |
| return count($this->itens); | |
| } | |
| } |