private function handle(TaskHandler $handler) { if ($handler->isDelayed()) { $nextRun = $this->currentTick + $handler->getDelay(); } else { $nextRun = $this->currentTick; } $handler->setNextRun($nextRun); $this->tasks[$handler->getTaskId()] = $handler; $this->queue->insert($handler, $nextRun); return $handler; }