original_string: 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));
      }
code: 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));
      }
code_tokens: 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 ) ) ; }
docstring: internal method that throws an exception should the expected
  events not exist within the event store
  
  @param DomainEvent ...$events
  @throws FailureException
docstring_tokens: internal method that throws an exception should the expected events not exist within the event store