| 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 | * @param string $collectionName Collection variable nested class name |
||
| 28 | */ |
||
| 29 | 22 | public function __construct(string $collectionName = self::COLLECTION_NAME) |
|
| 37 | |||
| 38 | /** |
||
| 39 | * @inheritdoc |
||
| 40 | */ |
||
| 41 | 4 | public function current() |
|
| 45 | |||
| 46 | /** |
||
| 47 | * @inheritdoc |
||
| 48 | */ |
||
| 49 | 4 | public function next() |
|
| 53 | |||
| 54 | /** |
||
| 55 | * @inheritdoc |
||
| 56 | */ |
||
| 57 | 5 | public function valid() |
|
| 63 | |||
| 64 | /** |
||
| 65 | * @inheritdoc |
||
| 66 | */ |
||
| 67 | 5 | public function key() |
|
| 71 | |||
| 72 | /** |
||
| 73 | * Rewind the Iterator to the first element |
||
| 74 | * @link http://php.net/manual/en/iterator.rewind.php |
||
| 75 | * @return void Any returned value is ignored. |
||
| 76 | * @since 5.0.0 |
||
| 77 | */ |
||
| 78 | 5 | public function rewind() |
|
| 82 | |||
| 83 | /** |
||
| 84 | * @inheritdoc |
||
| 85 | */ |
||
| 86 | 3 | public function count() |
|
| 90 | } |
||
| 91 |