mirror of
https://github.com/flarum/core.git
synced 2025-07-20 00:01:17 +02:00
Clean up code, use PHP 7 feature :)
This commit is contained in:
@@ -101,7 +101,7 @@ class HandleErrors
|
|||||||
// Log the exception (with trace)
|
// Log the exception (with trace)
|
||||||
$this->logger->debug($error);
|
$this->logger->debug($error);
|
||||||
|
|
||||||
if (! $this->view->exists($name = 'flarum.forum::error.'.$status)) {
|
if (! $this->view->exists($name = "flarum.forum::error.$status")) {
|
||||||
$name = 'flarum.forum::error.default';
|
$name = 'flarum.forum::error.default';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,20 +114,16 @@ class HandleErrors
|
|||||||
|
|
||||||
private function getMessage($status)
|
private function getMessage($status)
|
||||||
{
|
{
|
||||||
if (! $translation = $this->getTranslationIfExists($status)) {
|
return $this->getTranslationIfExists($status)
|
||||||
if (! $translation = $this->getTranslationIfExists(500)) {
|
?? $this->getTranslationIfExists(500)
|
||||||
$translation = 'An error occurred while trying to load this page.';
|
?? 'An error occurred while trying to load this page.';
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $translation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getTranslationIfExists($status)
|
private function getTranslationIfExists($status)
|
||||||
{
|
{
|
||||||
$key = 'core.views.error.'.$status.'_message';
|
$key = "core.views.error.${status}_message";
|
||||||
$translation = $this->translator->trans($key, ['{forum}' => $this->settings->get('forum_title')]);
|
$translation = $this->translator->trans($key, ['{forum}' => $this->settings->get('forum_title')]);
|
||||||
|
|
||||||
return $translation === $key ? false : $translation;
|
return $translation === $key ? null : $translation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user