mirror of
https://github.com/slawkens/myaac.git
synced 2026-03-16 16:03:31 +01:00
Use static methods instead, looks better
This commit is contained in:
@@ -8,22 +8,22 @@ class Groups
|
||||
{
|
||||
private static array $groups = [];
|
||||
|
||||
public function __construct() {
|
||||
self::$groups = Cache::remember('groups', 10 * 60, function () {
|
||||
if (file_exists(config('server_path') . 'config/groups.toml')) {
|
||||
$groups = new TOML\Groups();
|
||||
}
|
||||
else {
|
||||
$groups = new XML\Groups();
|
||||
}
|
||||
public static function get() {
|
||||
if (count(self::$groups) == 0) {
|
||||
self::$groups = Cache::remember('groups', 10 * 60, function () {
|
||||
if (file_exists(config('server_path') . TOML\Groups::FILE)) {
|
||||
$groups = new TOML\Groups();
|
||||
}
|
||||
else {
|
||||
$groups = new XML\Groups();
|
||||
}
|
||||
|
||||
$groups->load();
|
||||
$groups->load();
|
||||
|
||||
return $groups->getGroups();
|
||||
});
|
||||
}
|
||||
return $groups->getGroups();
|
||||
});
|
||||
}
|
||||
|
||||
public static function getGroups(): array {
|
||||
return self::$groups;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user