mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2026-01-23 02:35:23 +00:00
improve readability of logic
This commit is contained in:
parent
530f360497
commit
fd6ba6595f
1 changed files with 8 additions and 12 deletions
|
|
@ -101,14 +101,13 @@ class TemplateSwitcher
|
|||
*/
|
||||
public static function isTemplateAvailable(string $template): bool
|
||||
{
|
||||
$available = in_array($template, self::getAvailableTemplates());
|
||||
|
||||
if (!$available && !View::isBootstrapTemplate($template)) {
|
||||
$path = View::getTemplateFilePath($template);
|
||||
$available = file_exists($path);
|
||||
if (in_array($template, self::getAvailableTemplates())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $available;
|
||||
if (View::isBootstrapTemplate($template)) {
|
||||
return false;
|
||||
}
|
||||
return file_exists(View::getTemplateFilePath($template));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -120,13 +119,10 @@ class TemplateSwitcher
|
|||
*/
|
||||
private static function getSelectedByUserTemplate(): ?string
|
||||
{
|
||||
$selectedTemplate = null;
|
||||
$templateCookieValue = $_COOKIE['template'] ?? '';
|
||||
|
||||
if (self::isTemplateAvailable($templateCookieValue)) {
|
||||
$selectedTemplate = $templateCookieValue;
|
||||
return $templateCookieValue;
|
||||
}
|
||||
|
||||
return $selectedTemplate;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue