Code Duplication    Length = 13-13 lines in 2 locations

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

@@ 191-203 (lines=13) @@
188
                $stmt->bindValue(':streamId', $streamId);
189
                $stmt->execute();
190
            }
191
            foreach ($storedEvents as $storedEvent) {
192
                $stmt = $this->connection->prepare(
193
                    'INSERT INTO events (stream_id, type, event, metadata, occurred_on, version)
194
                 VALUES (:streamId, :type, :event, :metadata, :occurredOn, :version)'
195
                );
196
                $stmt->bindValue(':streamId', $streamId);
197
                $stmt->bindValue(':type', $storedEvent->type());
198
                $stmt->bindValue(':event', $storedEvent->data());
199
                $stmt->bindValue(':metadata', $storedEvent->metadata());
200
                $stmt->bindValue(':occurredOn', $storedEvent->occurredOn()->format('Y-m-d H:i:s'));
201
                $stmt->bindValue(':version', $storedEvent->version());
202
                $stmt->execute();
203
            }
204
            $streamFinalVersion = $this->streamVersion($streamId);
205
            if (count($storedEvents) !== $streamFinalVersion - $expectedVersion) {
206
                throw ConcurrencyException::fromVersions(

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

@@ 161-173 (lines=13) @@
158
                $stmt->bindValue(':streamId', $streamId);
159
                $stmt->execute();
160
            }
161
            foreach ($storedEvents as $storedEvent) {
162
                $stmt = $this->connection->prepare(
163
                    'INSERT INTO events (stream_id, type, event, metadata, occurred_on, version)
164
                 VALUES (:streamId, :type, :event, :metadata, :occurredOn, :version)'
165
                );
166
                $stmt->bindValue(':streamId', $streamId);
167
                $stmt->bindValue(':type', $storedEvent->type());
168
                $stmt->bindValue(':event', $storedEvent->data());
169
                $stmt->bindValue(':metadata', $storedEvent->metadata());
170
                $stmt->bindValue(':occurredOn', $storedEvent->occurredOn()->format('Y-m-d H:i:s'));
171
                $stmt->bindValue(':version', $storedEvent->version());
172
                $stmt->execute();
173
            }
174
            $streamFinalVersion = $this->streamVersion($streamId);
175
            if (count($storedEvents) !== $streamFinalVersion - $expectedVersion) {
176
                throw ConcurrencyException::fromVersions(