get('old', new Old()); $errors = $session->get('errors', new Errors()); $id = filter_input(INPUT_GET, 'id'); $todos = new TodoRepository($config['path_to_repository']); $template = new Template($config['path_to_templates']); $todo = $todos->find($id); if ($todo === null) { respondAndExit(404, 'Not Found'); } $html = $template->render('edit', compact( 'todo', 'errors', 'old' )); respondAndExit(200, 'OK', $html);