Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
simple fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel Notbohm committed Sep 19, 2017
1 parent fc38974 commit 697e597
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/Delegate/NotFoundDelegate.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public function __construct(
$layout = self::LAYOUT_DEFAULT
) {
$this->responsePrototype = $responsePrototype;
$this->renderer = $renderer;
$this->template = $template;
$this->layout = $layout;
$this->renderer = $renderer;
$this->template = $template;
$this->layout = $layout;
}

/**
Expand All @@ -67,7 +67,7 @@ public function __construct(
*/
public function process(ServerRequestInterface $request)
{
if (! $this->renderer) {
if (!$this->renderer) {
return $this->generatePlainTextResponse($request);
}

Expand All @@ -87,7 +87,7 @@ private function generatePlainTextResponse(ServerRequestInterface $request)
->write(sprintf(
'Cannot %s %s',
$request->getMethod(),
(string) $request->getUri()
(string)$request->getUri()
));
return $response;
}
Expand All @@ -102,14 +102,9 @@ private function generatePlainTextResponse(ServerRequestInterface $request)
*/
private function generateTemplatedResponse(ServerRequestInterface $request)
{
$templateData = [
'request' => $request,
'layout' => $this->layout,
];

$response = $this->responsePrototype->withStatus(StatusCodeInterface::STATUS_NOT_FOUND);
$response->getBody()->write(
$this->renderer->render($this->template, $templateData)
$this->renderer->render($this->template, ['request' => $request, 'layout' => $this->layout])
);

return $response;
Expand Down

0 comments on commit 697e597

Please sign in to comment.