Code Duplication    Length = 15-16 lines in 2 locations

src/Console/Snapshots/DeleteSnapshotCommand.php 1 location

@@ 44-59 (lines=16) @@
41
        $this->comment("Snapshot number {$snapshotNumber} deleted!");
42
    }
43
44
    public function displaySnapshots()
45
    {
46
        $titles = ['Number', 'Projector', 'Last processed event id', 'Created at', 'Name'];
47
48
        $rows = $this->snapshots->map(function (Snapshot $snapshot, int $index) {
49
            return [
50
                $index,
51
                $snapshot->projectorName(),
52
                $snapshot->lastProcessedEventId(),
53
                $snapshot->createdAt(),
54
                $snapshot->name(),
55
            ];
56
        });
57
58
        $this->table($titles, $rows);
59
    }
60
}
61

src/Console/Snapshots/ListSnapshotsCommand.php 1 location

@@ 25-39 (lines=15) @@
22
        $this->snapshotRepository = $snapshotRepository;
23
    }
24
25
    public function handle()
26
    {
27
        $titles = ['Projector', 'Last processed event id', 'Created at', 'Name'];
28
29
        $rows = $this->snapshotRepository->get()->map(function (Snapshot $snapshot) {
30
            return [
31
                $snapshot->projectorName(),
32
                $snapshot->lastProcessedEventId(),
33
                $snapshot->createdAt(),
34
                $snapshot->name(),
35
            ];
36
        });
37
38
        $this->table($titles, $rows);
39
    }
40
}
41