repo->byName($page); // fix the next and previous buttons to work with our routing $content = preg_replace('/\(\d\d-/m', '(', $page->content); assert(is_string($content)); $content = str_replace('.md)', ')', $content); $data = [ 'title' => $page->title, 'content' => $this->parser->parse($content), ]; $html = $this->renderer->render('page/show', $data); $this->response->getBody()->write($html); return $this->response; } public function list(): ResponseInterface { $pages = array_map(function (MarkdownPage $page) { return [ 'id' => $page->id, 'title' => $page->title, ]; }, $this->repo->all()); $html = $this->renderer->render('page/list', ['pages' => $pages]); $this->response->getBody()->write($html); return $this->response; } }