/**
* Upcast an event and returns the result as an array as when upcasting an event might
* have been split into many new ones.
*/
private function upcastEvent(RecordedEventDescriptor $event): array
{
// Here a test to see if the upcasterChain supports the event should be performed
return $this->upcasterChain->upcast(UpcastableEventDescriptor::fromRecordedEventDescriptor($event));
}
And also in the UpcasterChain:
if (empty($chain)) {
return [$event];
}
$head = \array_slice($chain, 0, 1);
$tail = \array_slice($chain, 1);
// SHOULD BE TESTED here again
$events = $head[0]->upcast($event);
There is the following code:
And also in the
UpcasterChain
: