Code Duplication    Length = 16-16 lines in 2 locations

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

@@ 244-259 (lines=16) @@
241
     * @return int
242
     * @throws EventStreamDoesNotExistException
243
     */
244
    public function getStreamVersionAt($streamId, \DateTimeImmutable $datetime)
245
    {
246
        if (!$this->streamExists($streamId)) {
247
            throw EventStreamDoesNotExistException::fromStreamId($streamId);
248
        }
249
        $stmt = $this->connection->prepare(
250
            'SELECT COUNT(*)
251
             FROM events
252
             WHERE stream_id = :streamId
253
             AND occurred_on <= :occurred_on'
254
        );
255
        $stmt->bindValue(':streamId', $streamId);
256
        $stmt->bindValue(':occurred_on', $datetime->format('Y-m-d H:i:s'));
257
        $stmt->execute();
258
        return intval($stmt->fetchColumn());
259
    }
260
261
    /**
262
     * @param string $streamId

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

@@ 311-326 (lines=16) @@
308
     * @return int
309
     * @throws EventStreamDoesNotExistException
310
     */
311
    public function getStreamVersionAt($streamId, \DateTimeImmutable $datetime)
312
    {
313
        if (!$this->streamExists($streamId)) {
314
            throw EventStreamDoesNotExistException::fromStreamId($streamId);
315
        }
316
        $stmt = $this->connection->prepare(
317
            'SELECT COUNT(*)
318
             FROM events
319
             WHERE stream_id = :streamId
320
             AND occurred_on <= :occurred_on'
321
        );
322
        $stmt->bindValue(':streamId', $streamId);
323
        $stmt->bindValue(':occurred_on', $datetime->format('Y-m-d H:i:s'));
324
        $stmt->execute();
325
        return intval($stmt->fetchColumn());
326
    }
327
}
328