public function extractPendingStreamEvents($anEventSourcedAggregateRoot): array
    {
        if (null === $this->pendingEventsExtractor) {
            $this->pendingEventsExtractor = function (): array {
                return $this->popRecordedEvents();
            };
        }

        return $this->pendingEventsExtractor->call($anEventSourcedAggregateRoot);
    }
public function extractPendingStreamEvents($anEventSourcedAggregateRoot): array
    {
        if (null === $this->pendingEventsExtractor) {
            $this->pendingEventsExtractor = function (): array {
                return $this->popRecordedEvents();
            };
        }

        return $this->pendingEventsExtractor->call($anEventSourcedAggregateRoot);
    }
@param object $anEventSourcedAggregateRoot

@return Message[]