/** * @param Task $task * @return array */ private function formatTask(Task $task) { return ['id' => $task->getId(), 'text' => $task->getText(), 'status' => $task->getStatus() === Task::STATUS_DONE ? 'Done' : 'Undone', 'created_at' => $task->getCreatedAt(), 'list' => $task->getTodoList()->getId()]; }