diff --git a/app/src/Handlers/SearchHandler.php b/app/src/Handlers/SearchHandler.php index 3fc4506..bd33aea 100644 --- a/app/src/Handlers/SearchHandler.php +++ b/app/src/Handlers/SearchHandler.php @@ -41,7 +41,9 @@ class SearchHandler $search = $request->getQueryParams()['search']; if (empty($search)) { - return $this->error($response); + return $this->view->render($response, 'error.twig', [ + 'message' => 'No results found' + ]); } $files = $this->finder->in('.')->name( @@ -54,18 +56,4 @@ class SearchHandler 'title' => $search, ]); } - - /** - * Return an error response. - * - * @param \Psr\Http\Message\ResponseInterface $response - * - * @return \Psr\Http\Message\ResponseInterface - */ - protected function error(ResponseInterface $response): ResponseInterface - { - return $this->view->render($response, 'error.twig', [ - 'message' => 'No results found' - ]); - } }