/** * @param ReopenTodo $command */ public function __invoke(ReopenTodo $command) { $todo = $this->todoList->get($command->todoId()); if (!$todo) { throw TodoNotFound::withTodoId($command->todoId()); } $todo->reopenTodo(); }
/** * @param MarkTodoAsExpired $command */ public function __invoke(MarkTodoAsExpired $command) { $todo = $this->todoList->get($command->todoId()); if (!$todo) { throw TodoNotFound::withTodoId($command->todoId()); } $todo->markAsExpired(); }
/** * @param AddReminderToTodo $command */ public function __invoke(AddReminderToTodo $command) { $todo = $this->todoList->get($command->todoId()); if (!$todo) { throw TodoNotFound::withTodoId($command->todoId()); } $todo->addReminder($command->userId(), $command->reminder()); }
/** * @param RemindTodoAssignee $command */ public function __invoke(RemindTodoAssignee $command) { $todo = $this->todoList->get($command->todoId()); if (!$todo) { throw TodoNotFound::withTodoId($command->todoId()); } $reminder = $todo->reminder(); if ($this->reminderShouldBeProcessed($todo, $reminder)) { $todo->remindAssignee($reminder); } }
/** * @param MarkTodoAsDone $command */ public function __invoke(MarkTodoAsDone $command) { $todo = $this->todoList->get($command->todoId()); $todo->markAsDone(); }
/** * @param AddDeadlineToTodo $command * @return void */ public function __invoke(AddDeadlineToTodo $command) { $todo = $this->todoList->get($command->todoId()); $todo->addDeadline($command->userId(), $command->deadline()); }