Conditions | 4 |
Paths | 2 |
Total Lines | 32 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
25 | public function handle() |
||
26 | { |
||
27 | $titles = ['Name', 'Up to date', 'Last processed event id', 'Last event processed at']; |
||
28 | |||
29 | $projectors = $this->eventProjectionist->getProjectors(); |
||
30 | |||
31 | if ($projectors->isEmpty()) { |
||
32 | $this->warn('No projectors found. You can register projector like this : `Spatie\EventProjector\Facades\EventProjectionist::addProjector($projectorClassName)`.'); |
||
33 | |||
34 | return; |
||
35 | } |
||
36 | |||
37 | $rows = $projectors |
||
38 | ->map(function ($eventHandler) { |
||
39 | if (is_string($eventHandler)) { |
||
40 | $eventHandler = app($eventHandler); |
||
41 | } |
||
42 | |||
43 | return $eventHandler; |
||
44 | }) |
||
45 | ->map(function (Projector $projector) { |
||
46 | return [ |
||
47 | $projector->getName(), |
||
48 | $projector->hasReceivedAllEvents() ? '✅' : '❌', |
||
49 | $projector->getLastProcessedEventId(), |
||
50 | $projector->lastEventProcessedAt()->format('Y-m-d H:i:s'), |
||
51 | ]; |
||
52 | }) |
||
53 | ->toArray(); |
||
54 | |||
55 | $this->table($titles, $rows); |
||
56 | } |
||
57 | } |
||
58 |