Refactor
This commit is contained in:
parent
7fab80a113
commit
820f8d4055
2 changed files with 6 additions and 1 deletions
|
@ -26,6 +26,11 @@ readonly final class Events implements \IteratorAggregate {
|
||||||
return new \ArrayIterator($this->events);
|
return new \ArrayIterator($this->events);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPast(): self {
|
||||||
|
return (new self($this->events))
|
||||||
|
->filter(fn (Event $event): bool => $event->isPast());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Event[] $events
|
* @param Event[] $events
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -13,7 +13,7 @@ final class Presentation extends Node implements NodeInterface {
|
||||||
|
|
||||||
public function getPastEvents(): Events {
|
public function getPastEvents(): Events {
|
||||||
return Events::fromEvents($this->get('field_events')->referencedEntities())
|
return Events::fromEvents($this->get('field_events')->referencedEntities())
|
||||||
->filter(fn (Event $event) => $event->isPast());
|
->getPast();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue