private function eventsShouldExistInStore(DomainEvent ...$events) {
        $expected = array_map(function (DomainEvent $event) {
            return $this->serializer->serialize($event);
        }, $events);

        $existing = $this->eventStore->getEvents()->map(function(DomainEvent $event) {
            return $this->serializer->serialize($event);
        })->toArray();

        $notFound = array_filter($expected, function($expectedEvent) use ($existing) {
            return ! in_array($expectedEvent, $existing);
        });

        if (empty($notFound)) return;

        throw new FailureException($this->missingEventExceptionMessage($notFound));
    }
private function eventsShouldExistInStore(DomainEvent ...$events) {
        $expected = array_map(function (DomainEvent $event) {
            return $this->serializer->serialize($event);
        }, $events);

        $existing = $this->eventStore->getEvents()->map(function(DomainEvent $event) {
            return $this->serializer->serialize($event);
        })->toArray();

        $notFound = array_filter($expected, function($expectedEvent) use ($existing) {
            return ! in_array($expectedEvent, $existing);
        });

        if (empty($notFound)) return;

        throw new FailureException($this->missingEventExceptionMessage($notFound));
    }
private function eventsShouldExistInStore ( DomainEvent ... $ events ) { $ expected = array_map ( function ( DomainEvent $ event ) { return $ this -> serializer -> serialize ( $ event ) ; } , $ events ) ; $ existing = $ this -> eventStore -> getEvents ( ) -> map ( function ( DomainEvent $ event ) { return $ this -> serializer -> serialize ( $ event ) ; } ) -> toArray ( ) ; $ notFound = array_filter ( $ expected , function ( $ expectedEvent ) use ( $ existing ) { return ! in_array ( $ expectedEvent , $ existing ) ; } ) ; if ( empty ( $ notFound ) ) return ; throw new FailureException ( $ this -> missingEventExceptionMessage ( $ notFound ) ) ; }
internal method that throws an exception should the expected
events not exist within the event store

@param DomainEvent ...$events
@throws FailureException
internal method that throws an exception should the expected events not exist within the event store