/** * @param Request $request * @param array $matches * * @return Timer|TimerInterface */ protected function restart(Request $request, array $matches = []) { $time = isset($matches[1]) ? $matches[1] : 0; if ($time > 0) { $this->logger->info("Restarting in {$time} seconds."); return $request->runAfter($time, function () use($request) { $this->restart($request); }); } $request->getLogger()->info('Restarting!'); $request->reply('Restarting'); die(1); }