Code Duplication    Length = 16-16 lines in 2 locations

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

@@ 232-247 (lines=16) @@
229
     * @return int
230
     * @throws EventStreamDoesNotExistException
231
     */
232
    public function getStreamVersionAt($streamId, \DateTimeImmutable $datetime)
233
    {
234
        if (!$this->streamExists($streamId)) {
235
            throw EventStreamDoesNotExistException::fromStreamId($streamId);
236
        }
237
        $stmt = $this->connection->prepare(
238
            'SELECT COUNT(*)
239
             FROM events
240
             WHERE stream_id = :streamId
241
             AND occurred_on <= :occurred_on'
242
        );
243
        $stmt->bindValue(':streamId', $streamId);
244
        $stmt->bindValue(':occurred_on', $datetime->format('Y-m-d H:i:s'));
245
        $stmt->execute();
246
        return intval($stmt->fetchColumn());
247
    }
248
249
    /**
250
     * @param string $streamId

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

@@ 299-314 (lines=16) @@
296
     * @return int
297
     * @throws EventStreamDoesNotExistException
298
     */
299
    public function getStreamVersionAt($streamId, \DateTimeImmutable $datetime)
300
    {
301
        if (!$this->streamExists($streamId)) {
302
            throw EventStreamDoesNotExistException::fromStreamId($streamId);
303
        }
304
        $stmt = $this->connection->prepare(
305
            'SELECT COUNT(*)
306
             FROM events
307
             WHERE stream_id = :streamId
308
             AND occurred_on <= :occurred_on'
309
        );
310
        $stmt->bindValue(':streamId', $streamId);
311
        $stmt->bindValue(':occurred_on', $datetime->format('Y-m-d H:i:s'));
312
        $stmt->execute();
313
        return intval($stmt->fetchColumn());
314
    }
315
}
316