private function isTaskCancelled(Task $task) { if ($task instanceof Cancellable) { return $task->isCancelled(); } return false; }