Code Duplication    Length = 13-13 lines in 2 locations

src/EventSourcing/EventStore/Vendor/DoctrineDbalEventStore.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(

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

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