public static function all() { $environment = PhwoolconConfig::environment(); if (null === ($config = Cache::get($key = 'db_configs_' . $environment))) { $db = Db::connection(); $db->tableExists('config') or static::createConfigTable(); $config = []; /* @var static $row */ foreach (static::find() as $row) { $value = json_decode($row->getData('value'), true); $config[$row->getData('key')] = $value; } Cache::set($key, $config, Cache::TTL_ONE_MONTH); } return $config; }