| 1 | <?php declare(strict_types = 1); |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 2 | |||
| 3 | namespace App\Entities; |
||
| 4 | |||
| 5 | class Posts implements \IteratorAggregate { |
||
| 6 | |||
| 7 | /** @var array<\App\Entities\Post> */ |
||
| 8 | private array $posts; |
||
| 9 | |||
| 10 | 1 | public function __construct( Post ...$posts ) { |
|
| 11 | 1 | $this->posts = $posts; |
|
| 12 | 1 | } |
|
| 13 | |||
| 14 | /** |
||
| 15 | * {@inheritDoc} |
||
| 16 | */ |
||
| 17 | 1 | public function getIterator() { |
|
| 18 | 1 | return new \ArrayIterator( $this->posts ); |
|
| 19 | } |
||
| 20 | |||
| 21 | } |
||
| 22 |