public function register(Container $app) { $app->share('config', function () use($app) { $paths = $app->get('paths'); $configs = (require_once $paths['config']); $app_path = $paths['app']; $autoloads = ["files" => [$app_path . '/helpers.php']]; $config = new Config($configs, $autoloads); $request = $app->get('current_request'); $environment = $this->getEnvironment($request, $config->get('environments')); $config->set('environment', $environment ?: $config->get('environment')); $debugMode = $config->get('environment.development'); $config->set("paths", $paths); $handle = new HandleError($debugMode, $paths['log']); $config->setupErrors($handle); $this->setHandlers($config); $this->setScope($config, $request->getPathInfo()); $this->loadLang($config); return $config; }); }
public static function get($name) { return self::$config->get($name); }