Refactor
Try a different way of naming and grouping classes.
This commit is contained in:
parent
52c1b33711
commit
6b6b362a49
15 changed files with 111 additions and 59 deletions
|
@ -1,28 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Drupal\opd_presentations\Collection;
|
||||
|
||||
use Drupal\opd_presentations\Entity\Event;
|
||||
|
||||
/**
|
||||
* @implements \IteratorAggregate<Event>
|
||||
*/
|
||||
readonly final class EventCollection implements \IteratorAggregate {
|
||||
|
||||
/**
|
||||
* @param Event[] $events
|
||||
*/
|
||||
public function __construct(private array $events) {
|
||||
}
|
||||
|
||||
public function first(): Event {
|
||||
return array_values($this->events)[0];
|
||||
}
|
||||
|
||||
public function getIterator(): \Traversable {
|
||||
return new \ArrayIterator($this->events);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue