This commit is contained in:
Oliver Davies 2025-06-12 02:10:08 +01:00
parent c184f79f8a
commit 9308ce76a5
2 changed files with 9 additions and 5 deletions

View file

@ -15,6 +15,13 @@ readonly final class Events implements \IteratorAggregate {
private function __construct(private array $events) {
}
public function filter(\Closure $callback): self {
return new self(array_filter(
array: $this->events,
callback: $callback,
));
}
public function first(): Event {
return array_values($this->events)[0];
}