public function register(Worker $worker) { $worker['stats'] = function ($worker) { return new StatsReporter(); }; $worker->dispatcher->addSubscriber(new StatsEventListener()); }