Code Duplication    Length = 13-13 lines in 2 locations

src/EventSourcing/EventStore/Vendor/DoctrineDbalEventStore.php 1 location

@@ 201-213 (lines=13) @@
198
                $stmt->bindValue(':streamId', $streamId);
199
                $stmt->execute();
200
            }
201
            foreach ($storedEvents as $storedEvent) {
202
                $stmt = $this->connection->prepare(
203
                    'INSERT INTO events (stream_id, type, event, metadata, occurred_on, version)
204
                 VALUES (:streamId, :type, :event, :metadata, :occurredOn, :version)'
205
                );
206
                $stmt->bindValue(':streamId', $streamId);
207
                $stmt->bindValue(':type', $storedEvent->type());
208
                $stmt->bindValue(':event', $storedEvent->data());
209
                $stmt->bindValue(':metadata', $storedEvent->metadata());
210
                $stmt->bindValue(':occurredOn', $storedEvent->occurredOn()->format('Y-m-d H:i:s'));
211
                $stmt->bindValue(':version', $storedEvent->version());
212
                $stmt->execute();
213
            }
214
            $streamFinalVersion = $this->streamVersion($streamId);
215
            if (count($storedEvents) !== $streamFinalVersion - $expectedVersion) {
216
                throw ConcurrencyException::fromVersions(

src/EventSourcing/EventStore/Vendor/MySqlJsonEventStore.php 1 location

@@ 171-183 (lines=13) @@
168
                $stmt->bindValue(':streamId', $streamId);
169
                $stmt->execute();
170
            }
171
            foreach ($storedEvents as $storedEvent) {
172
                $stmt = $this->connection->prepare(
173
                    'INSERT INTO events (stream_id, type, event, metadata, occurred_on, version)
174
                 VALUES (:streamId, :type, :event, :metadata, :occurredOn, :version)'
175
                );
176
                $stmt->bindValue(':streamId', $streamId);
177
                $stmt->bindValue(':type', $storedEvent->type());
178
                $stmt->bindValue(':event', $storedEvent->data());
179
                $stmt->bindValue(':metadata', $storedEvent->metadata());
180
                $stmt->bindValue(':occurredOn', $storedEvent->occurredOn()->format('Y-m-d H:i:s'));
181
                $stmt->bindValue(':version', $storedEvent->version());
182
                $stmt->execute();
183
            }
184
            $streamFinalVersion = $this->streamVersion($streamId);
185
            if (count($storedEvents) !== $streamFinalVersion - $expectedVersion) {
186
                throw ConcurrencyException::fromVersions(