Try a different way of naming and grouping classes.
This commit is contained in:
Oliver Davies 2025-06-12 02:10:08 +01:00
parent 52c1b33711
commit 6b6b362a49
15 changed files with 111 additions and 59 deletions

View file

@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace Drupal\opd_presentations;
/**
* @implements \IteratorAggregate<Event>
*/
readonly final class Events implements \IteratorAggregate {
/**
* @param Event[] $events
*/
private function __construct(private array $events) {
}
public function first(): Event {
return array_values($this->events)[0];
}
public function getIterator(): \Traversable {
return new \ArrayIterator($this->events);
}
/**
* @param Event[] $events
*/
public static function new(array $events): self {
return new self($events);
}
}