Skip to content

Commit 7f29e32

Browse files
committed
refactoring
1 parent 78fad1a commit 7f29e32

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Application/Application.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public function processException(\Throwable $e): void
179179
$this->httpResponse->setCode($e instanceof BadRequestException ? ($e->getHttpCode() ?: 404) : 500);
180180
}
181181

182-
$args = ['exception' => $e, 'request' => end($this->requests) ?: null];
182+
$args = ['exception' => $e, 'request' => Arrays::last($this->requests) ?: null];
183183
if ($this->presenter instanceof UI\Presenter) {
184184
try {
185185
$this->presenter->forward(":$this->errorPresenter:", $args);

src/Application/UI/Presenter.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ public function sendTemplate(Template $template = null): void
463463
}
464464

465465
if (!$template->getFile()) {
466-
$file = strtr(reset($files), '/', DIRECTORY_SEPARATOR);
466+
$file = strtr(Arrays::first($files), '/', DIRECTORY_SEPARATOR);
467467
$this->error("Page not found. Missing template '$file'.");
468468
}
469469
}
@@ -489,7 +489,7 @@ public function findLayoutTemplateFile(): ?string
489489
}
490490

491491
if ($this->layout) {
492-
$file = strtr(reset($files), '/', DIRECTORY_SEPARATOR);
492+
$file = strtr(Arrays::first($files), '/', DIRECTORY_SEPARATOR);
493493
throw new Nette\FileNotFoundException("Layout not found. Missing template '$file'.");
494494
}
495495
return null;

0 commit comments

Comments
 (0)