Code Duplication    Length = 13-13 lines in 2 locations

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

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

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

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