Code Duplication    Length = 13-13 lines in 2 locations

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

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

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

@@ 142-154 (lines=13) @@
139
                $stmt->bindValue(':streamId', $streamId);
140
                $stmt->execute();
141
            }
142
            foreach ($storedEvents as $storedEvent) {
143
                $stmt = $this->connection->prepare(
144
                    'INSERT INTO events (stream_id, type, event, metadata, occurred_on, version)
145
                 VALUES (:streamId, :type, :event, :metadata, :occurredOn, :version)'
146
                );
147
                $stmt->bindValue(':streamId', $streamId);
148
                $stmt->bindValue(':type', $storedEvent->type());
149
                $stmt->bindValue(':event', $storedEvent->data());
150
                $stmt->bindValue(':metadata', $storedEvent->metadata());
151
                $stmt->bindValue(':occurredOn', $storedEvent->occurredOn()->format('Y-m-d H:i:s'));
152
                $stmt->bindValue(':version', $storedEvent->version());
153
                $stmt->execute();
154
            }
155
            $streamFinalVersion = $this->streamVersion($streamId);
156
            if (count($storedEvents) !== $streamFinalVersion - $expectedVersion) {
157
                throw ConcurrencyException::fromVersions(