$key)) { $exists = true; self::$initialized = true; return self::$settings->$key; } $exists = false; return $default; } /** * Shortcut for obtaining settings saved as JSON * * @param $key * * @return mixed */ public static function getJson($key) { return json_decode(self::get($key, '{}')); } /** * Get all settings * * @return array */ public static function all() { self::init(); return self::$settings; } /** * Initialize settings array */ private static function init() { if (!self::$initialized) { $model = new SettingsModel(); self::$settings = $model->getAll(); } } }