'joueclubnoel' => 'JouéClub Noël',
];
+ protected static $db = null;
+
public static function isCustomLink($url)
{
$e = explode(':', trim($url));
- return isset(static::$_db[trim($e[0])]);
+ return isset(static::getTypes()[trim($e[0])]);
}
public function fluidbookrefurl()
protected function _getOptions()
{
- $keys = array_keys(self::$_db);
- $res = self::$_db;
- foreach (FluidbookReference::whereNotIn('type', $keys)->get() as $item) {
- if (isset($res[$item->type])) {
- continue;
+ return self::getTypes();
+ }
+
+ /**
+ * @return string[]
+ */
+ public static function getTypes()
+ {
+ if (null === static::$db) {
+ $keys = array_keys(static::$_db);
+ static::$db = static::$_db;
+ foreach (FluidbookReference::whereNotIn('type', $keys)->get() as $item) {
+ if (isset(static::$db[$item->type])) {
+ continue;
+ }
+ static::$db[$item->type] = $item->type;
}
- $res[$item->type] = $item->type;
+
}
- return $res;
+ return static::$db;
}
protected static function _normalizeType($type)