oliverdavies.uk/modules/opd_presentations/src/Collection/EventCollection.php

29 lines
563 B
PHP
Raw Normal View History

2025-06-10 20:47:23 +01:00
<?php
declare(strict_types=1);
namespace Drupal\opd_presentations\Collection;
use Drupal\paragraphs\ParagraphInterface;
/**
* @implements \IteratorAggregate<ParagraphInterface>
*/
readonly final class EventCollection implements \IteratorAggregate {
/**
* @param ParagraphInterface[] $events
*/
public function __construct(private array $events) {
}
2025-06-11 09:54:18 +01:00
public function first(): ParagraphInterface {
return array_values($this->events)[0];
}
2025-06-10 20:47:23 +01:00
public function getIterator(): \Traversable {
return new \ArrayIterator($this->events);
}
}