From 7f29e327c34bb7855e2c33c0348f622b4b997c3a Mon Sep 17 00:00:00 2001 From: David Grudl Date: Tue, 12 Jan 2021 12:14:44 +0100 Subject: [PATCH] refactoring --- src/Application/Application.php | 2 +- src/Application/UI/Presenter.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Application/Application.php b/src/Application/Application.php index 6e3351c7f..41c851aa3 100644 --- a/src/Application/Application.php +++ b/src/Application/Application.php @@ -179,7 +179,7 @@ public function processException(\Throwable $e): void $this->httpResponse->setCode($e instanceof BadRequestException ? ($e->getHttpCode() ?: 404) : 500); } - $args = ['exception' => $e, 'request' => end($this->requests) ?: null]; + $args = ['exception' => $e, 'request' => Arrays::last($this->requests) ?: null]; if ($this->presenter instanceof UI\Presenter) { try { $this->presenter->forward(":$this->errorPresenter:", $args); diff --git a/src/Application/UI/Presenter.php b/src/Application/UI/Presenter.php index 1261b0070..34b5a85c3 100644 --- a/src/Application/UI/Presenter.php +++ b/src/Application/UI/Presenter.php @@ -463,7 +463,7 @@ public function sendTemplate(Template $template = null): void } if (!$template->getFile()) { - $file = strtr(reset($files), '/', DIRECTORY_SEPARATOR); + $file = strtr(Arrays::first($files), '/', DIRECTORY_SEPARATOR); $this->error("Page not found. Missing template '$file'."); } } @@ -489,7 +489,7 @@ public function findLayoutTemplateFile(): ?string } if ($this->layout) { - $file = strtr(reset($files), '/', DIRECTORY_SEPARATOR); + $file = strtr(Arrays::first($files), '/', DIRECTORY_SEPARATOR); throw new Nette\FileNotFoundException("Layout not found. Missing template '$file'."); } return null;