Code Duplication    Length = 13-13 lines in 2 locations

src/EloquentStoredEventRepository.php 2 locations

@@ 24-36 (lines=13) @@
21
        }
22
    }
23
24
    public function retrieveAll(string $uuid = null): LazyCollection
25
    {
26
        /** @var \Illuminate\Database\Query\Builder $query */
27
        $query = $this->storedEventModel::query();
28
29
        if ($uuid) {
30
            $query->uuid($uuid);
31
        }
32
33
        return $query->orderBy('id')->cursor()->map(function (EloquentStoredEvent $storedEvent) {
34
            return $storedEvent->toStoredEvent();
35
        });
36
    }
37
38
    public function retrieveAllStartingFrom(int $startingFrom, string $uuid = null): LazyCollection
39
    {
@@ 38-50 (lines=13) @@
35
        });
36
    }
37
38
    public function retrieveAllStartingFrom(int $startingFrom, string $uuid = null): LazyCollection
39
    {
40
        /** @var \Illuminate\Database\Query\Builder $query */
41
        $query = $this->storedEventModel::query()->startingFrom($startingFrom);
42
43
        if ($uuid) {
44
            $query->uuid($uuid);
45
        }
46
47
        return $query->orderBy('id')->cursor()->map(function (EloquentStoredEvent $storedEvent) {
48
            return $storedEvent->toStoredEvent();
49
        });
50
    }
51
52
    public function persist(ShouldBeStored $event, string $uuid = null): StoredEvent
53
    {