Slide 14
Slide 14 text
変更後
class FetchTodoService
{
public function exec(
string $user_id,
int $todo_id,
TodoRepository $todo_repos,
): array {
$result = $todo_repos->fetchTodo($todo_id, $user_id);
if ($result === []) {
throw new LogicException('Todoのデータが存在しません');
}
return $result;
}
}
TodoRepository
を外部から注入