| 1 | <?php declare(strict_types=1); |
||
| 16 | abstract class AbstractIterable implements Iterator, Countable |
||
| 17 | { |
||
| 18 | /** string Internal collection name for iteration and counting */ |
||
| 19 | protected const COLLECTION_NAME = 'internalCollection'; |
||
| 20 | |||
| 21 | /** @var array Internal internalCollection storage */ |
||
| 22 | private $internalCollection; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * GenericIterable constructor. |
||
| 26 | * |
||
| 27 | */ |
||
| 28 | 22 | public function __construct() |
|
| 38 | |||
| 39 | /** |
||
| 40 | * @inheritdoc |
||
| 41 | */ |
||
| 42 | 5 | public function current() |
|
| 46 | |||
| 47 | /** |
||
| 48 | * @inheritdoc |
||
| 49 | */ |
||
| 50 | 5 | public function next() |
|
| 54 | |||
| 55 | /** |
||
| 56 | * @inheritdoc |
||
| 57 | */ |
||
| 58 | 5 | public function valid() |
|
| 64 | |||
| 65 | /** |
||
| 66 | * @inheritdoc |
||
| 67 | */ |
||
| 68 | 5 | public function key() |
|
| 72 | |||
| 73 | /** |
||
| 74 | * Rewind the Iterator to the first element |
||
| 75 | * @link http://php.net/manual/en/iterator.rewind.php |
||
| 76 | * @return void Any returned value is ignored. |
||
| 77 | * @since 5.0.0 |
||
| 78 | */ |
||
| 79 | 5 | public function rewind() |
|
| 83 | |||
| 84 | /** |
||
| 85 | * @inheritdoc |
||
| 86 | */ |
||
| 87 | 3 | public function count() |
|
| 91 | } |
||
| 92 |