public function initConfig($basePath) { $this->instance('config', new Parameter()); date_default_timezone_set($this->config->get('app.timezone', 'Asia/Chongqing')); if (is_null($basePath)) { $this->config->replace($this->getDefaultConfig()); } else { $this['path.base'] = $basePath . DIRECTORY_SEPARATOR; foreach (['public', 'config', 'cache', 'private'] as $path) { $this['path.' . $path] = $this['path.base'] . $path . DIRECTORY_SEPARATOR; } $configs = File::readDir($this->configPath()); if ($configs) { foreach ($configs as $configPath) { $this->config->set($configPath['fileName'], require $this->configPath($configPath['path'])); } } } }
public function render() { if (!$this->isCacheable()) { try { $content = File::readFile($this->path . $this->filename); } catch (Exception $e) { throw new RuntimeException("View [{$this->filename}] not found"); } $engine = $this->factory->resolveEngine($this->getRequireEngine()); $content = $engine->render($content); $this->cache($content); } return $this->renderContent(); }