public static function get($key) { $cacheKey = 'configuration'; $di = \Phalcon\DI::getDefault(); $cacheService = $di->get('modelsCache'); if ($cacheService->exists($cacheKey)) { self::$conf = $cacheService->get($cacheKey); } // If conf is not initialized, try manual query if (empty(self::$conf)) { if (!Configuration::loadConfiguration()) { return false; } if (!isset(self::$conf[$key])) { $configuration = Configuration::findFirst('key = \'' . $key . '\''); if (!$configuration) { return false; } $value = $configuration->getValue(); if ($configuration->getType() == self::TYPE_ARRAY) { $value = explode(self::ARRAY_TYPE_SEPARATOR, $configuration->getValue()); $value = array_combine($value, $value); } return $value; } } return self::$conf[$key]; }