Reset Global Report State
1<?php ...
2
3namespace Thunk\Verbs\Examples\Subscriptions\Events;
4
5use Thunk\Verbs\Event;
6use Thunk\Verbs\Examples\Subscriptions\States\GlobalReportState;
7use Thunk\Verbs\Support\StateCollection;
8
9class ResetGlobalReportState extends Event
10{
11 public function states(): StateCollection
12 {
13 return new StateCollection([
14 GlobalReportState::class => GlobalReportState::singleton(),
15 ]);
16 }
17
18 public function apply(GlobalReportState $state)
19 {
20 $state->subscribes_since_last_report = 0;
21 $state->unsubscribes_since_last_report = 0;
22 $state->last_reported_at = now();
23 }
24}