Code Duplication    Length = 16-16 lines in 2 locations

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

@@ 213-228 (lines=16) @@
210
     * @return int
211
     * @throws EventStreamDoesNotExistException
212
     */
213
    public function getStreamVersionAt($streamId, \DateTimeImmutable $datetime)
214
    {
215
        if (!$this->streamExists($streamId)) {
216
            throw EventStreamDoesNotExistException::fromStreamId($streamId);
217
        }
218
        $stmt = $this->connection->prepare(
219
            'SELECT COUNT(*)
220
             FROM events
221
             WHERE stream_id = :streamId
222
             AND occurred_on <= :occurred_on'
223
        );
224
        $stmt->bindValue(':streamId', $streamId);
225
        $stmt->bindValue(':occurred_on', $datetime->format('Y-m-d H:i:s'));
226
        $stmt->execute();
227
        return intval($stmt->fetchColumn());
228
    }
229
230
    /**
231
     * @param string $streamId

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

@@ 280-295 (lines=16) @@
277
     * @return int
278
     * @throws EventStreamDoesNotExistException
279
     */
280
    public function getStreamVersionAt($streamId, \DateTimeImmutable $datetime)
281
    {
282
        if (!$this->streamExists($streamId)) {
283
            throw EventStreamDoesNotExistException::fromStreamId($streamId);
284
        }
285
        $stmt = $this->connection->prepare(
286
            'SELECT COUNT(*)
287
             FROM events
288
             WHERE stream_id = :streamId
289
             AND occurred_on <= :occurred_on'
290
        );
291
        $stmt->bindValue(':streamId', $streamId);
292
        $stmt->bindValue(':occurred_on', $datetime->format('Y-m-d H:i:s'));
293
        $stmt->execute();
294
        return intval($stmt->fetchColumn());
295
    }
296
}
297