/** * Loads the configuration file. * * @access protected * @param string $file File name * @return array */ protected function load($file) { // Load configuration foreach ($this->getCascadingFilePaths($file) as $path) { if ($this->fileSystem->exists($path)) { $config = $this->fileSystem->includeFile($path); break; } } if (!isset($config)) { throw new RuntimeException(vsprintf("%s(): The [ %s ] config file does not exist.", [__METHOD__, $file])); } // Merge environment specific configuration if ($this->environment !== null) { $namespace = strpos($file, '::'); $namespaced = $namespace === false ? $this->environment . '.' . $file : substr_replace($file, $this->environment . '.', $namespace + 2, 0); foreach ($this->getCascadingFilePaths($namespaced) as $path) { if ($this->fileSystem->exists($path)) { $config = array_replace_recursive($config, $this->fileSystem->includeFile($path)); break; } } } $this->configuration[$file] = $config; }
/** * Loads and returns language strings. * * @access public * @param string $language Name of the language pack * @param string $file File we want to load * @return array */ public function loadStrings($language, $file) { $strings = false; foreach ($this->getCascadingFilePaths($file, null, $language . '/strings') as $file) { if ($this->fileSystem->exists($file)) { $strings = $this->fileSystem->includeFile($file); break; } } if ($strings === false) { throw new RuntimeException(vsprintf("%s(): The [ %s ] language file does not exist in the [ %s ] language pack.", [__METHOD__, $file, $language])); } return $strings; }