diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2018-08-11 23:46:28 +0200 |
---|---|---|
committer | Igor Scheller <igor.scheller@igorshp.de> | 2018-08-19 13:59:39 +0200 |
commit | f3b3b6683ca90b70ec4d4daae002dc0caac9ebdd (patch) | |
tree | c550252995a46763d8c540c9bd7f41e4b1c4f246 /src/Middleware/NotFoundResponse.php | |
parent | f3f05f6cc4bef3338dbfb6eb340da4fb1c5ba1e1 (diff) |
Added middleware tests
Diffstat (limited to 'src/Middleware/NotFoundResponse.php')
-rw-r--r-- | src/Middleware/NotFoundResponse.php | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/Middleware/NotFoundResponse.php b/src/Middleware/NotFoundResponse.php index c5d51d2d..f9431c1d 100644 --- a/src/Middleware/NotFoundResponse.php +++ b/src/Middleware/NotFoundResponse.php @@ -2,6 +2,7 @@ namespace Engelsystem\Middleware; +use Engelsystem\Http\Response; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\MiddlewareInterface; @@ -22,12 +23,20 @@ class NotFoundResponse implements MiddlewareInterface ServerRequestInterface $request, RequestHandlerInterface $handler ): ResponseInterface { + $info = _('This page could not be found or you don\'t have permission to view it. You probably have to sign in or register in order to gain access!'); + + return $this->renderPage($info); + } + + /** + * @param string $content + * @return Response + * @codeCoverageIgnore + */ + protected function renderPage($content) + { global $user; $event_config = EventConfig(); - $content = info( - _('This page could not be found or you don\'t have permission to view it. You probably have to sign in or register in order to gain access!'), - true - ); return response(view(__DIR__ . '/../../templates/layout.html', [ 'theme' => isset($user) ? $user['color'] : config('theme'), @@ -36,7 +45,7 @@ class NotFoundResponse implements MiddlewareInterface 'start_page_url' => page_link_to('/'), 'credits_url' => page_link_to('credits'), 'menu' => make_menu(), - 'content' => msg() . $content, + 'content' => msg() . info($content), 'header_toolbar' => header_toolbar(), 'faq_url' => config('faq_url'), 'contact_email' => config('contact_email'), |