Code Duplication    Length = 13-13 lines in 2 locations

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

@@ 182-194 (lines=13) @@
179
                $stmt->bindValue(':streamId', $streamId);
180
                $stmt->execute();
181
            }
182
            foreach ($storedEvents as $storedEvent) {
183
                $stmt = $this->connection->prepare(
184
                    'INSERT INTO events (stream_id, type, event, metadata, occurred_on, version)
185
                 VALUES (:streamId, :type, :event, :metadata, :occurredOn, :version)'
186
                );
187
                $stmt->bindValue(':streamId', $streamId);
188
                $stmt->bindValue(':type', $storedEvent->type());
189
                $stmt->bindValue(':event', $storedEvent->data());
190
                $stmt->bindValue(':metadata', $storedEvent->metadata());
191
                $stmt->bindValue(':occurredOn', $storedEvent->occurredOn()->format('Y-m-d H:i:s'));
192
                $stmt->bindValue(':version', $storedEvent->version());
193
                $stmt->execute();
194
            }
195
            $streamFinalVersion = $this->streamVersion($streamId);
196
            if (count($storedEvents) !== $streamFinalVersion - $expectedVersion) {
197
                throw ConcurrencyException::fromVersions(

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

@@ 152-164 (lines=13) @@
149
                $stmt->bindValue(':streamId', $streamId);
150
                $stmt->execute();
151
            }
152
            foreach ($storedEvents as $storedEvent) {
153
                $stmt = $this->connection->prepare(
154
                    'INSERT INTO events (stream_id, type, event, metadata, occurred_on, version)
155
                 VALUES (:streamId, :type, :event, :metadata, :occurredOn, :version)'
156
                );
157
                $stmt->bindValue(':streamId', $streamId);
158
                $stmt->bindValue(':type', $storedEvent->type());
159
                $stmt->bindValue(':event', $storedEvent->data());
160
                $stmt->bindValue(':metadata', $storedEvent->metadata());
161
                $stmt->bindValue(':occurredOn', $storedEvent->occurredOn()->format('Y-m-d H:i:s'));
162
                $stmt->bindValue(':version', $storedEvent->version());
163
                $stmt->execute();
164
            }
165
            $streamFinalVersion = $this->streamVersion($streamId);
166
            if (count($storedEvents) !== $streamFinalVersion - $expectedVersion) {
167
                throw ConcurrencyException::fromVersions(