Removed unnecessary SearchHandler::error() method

This commit is contained in:
Chris Kankiewicz
2020-02-17 23:38:59 -07:00
parent f714ac5b55
commit b113fed2d3

View File

@@ -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'
]);
}
}