instances added god may help
This commit is contained in:
@@ -9,24 +9,24 @@ class ThemeConfigService
|
||||
'dark' => 'Dark',
|
||||
];
|
||||
|
||||
private static ?array $themes = null;
|
||||
private ?array $themes = null;
|
||||
|
||||
public static function all(): array
|
||||
public function all(): array
|
||||
{
|
||||
if (self::$themes !== null) {
|
||||
return self::$themes;
|
||||
if ($this->themes !== null) {
|
||||
return $this->themes;
|
||||
}
|
||||
|
||||
$file = dirname(__DIR__, 3) . '/config/themes.php';
|
||||
if (!is_file($file)) {
|
||||
self::$themes = self::DEFAULT_THEMES;
|
||||
return self::$themes;
|
||||
$this->themes = self::DEFAULT_THEMES;
|
||||
return $this->themes;
|
||||
}
|
||||
|
||||
$loaded = include $file;
|
||||
if (!is_array($loaded)) {
|
||||
self::$themes = self::DEFAULT_THEMES;
|
||||
return self::$themes;
|
||||
$this->themes = self::DEFAULT_THEMES;
|
||||
return $this->themes;
|
||||
}
|
||||
|
||||
$clean = [];
|
||||
@@ -39,7 +39,7 @@ class ThemeConfigService
|
||||
$clean[$themeKey] = $themeLabel;
|
||||
}
|
||||
|
||||
self::$themes = $clean ?: self::DEFAULT_THEMES;
|
||||
return self::$themes;
|
||||
$this->themes = $clean ?: self::DEFAULT_THEMES;
|
||||
return $this->themes;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user