/** * Non-namespaced order: * /concrete/config/group.php * /application/config/generated_overrides/group.php * /application/config/group.php * /application/config/environment.group.php. * * Namespaced order: * /path/to/namespace/group.php * /path/to/namespace/environment.group.php * /application/config/generated_overrides/namespace/group.php * /application/config/namespace/group.php * /application/config/namespace/environment.group.php * * @param string $environment * @param string $group * @param null $namespace * * @return array */ public function load($environment, $group, $namespace = null) { $items = array(); // First we'll get the root configuration path for the environment which is // where all of the configuration files live for that namespace, as well // as any environment folders with their specific configuration items. $path = $this->getPath($namespace); if (is_null($path)) { return $items; } $paths = array(); if ($namespace === null || $namespace == '') { // No namespace, let's load up the concrete config first. $items = parent::load($environment, $group, 'core'); $paths = array("{$path}/generated_overrides/{$group}.php", "{$path}/{$group}.php", "{$path}/{$environment}.{$group}.php"); } else { $paths = array("{$path}/{$group}.php", "{$path}/{$environment}.{$group}.php", "{$this->defaultPath}/generated_overrides/{$namespace}/{$group}.php", "{$this->defaultPath}/{$namespace}/{$group}.php", "{$this->defaultPath}/{$namespace}/{$environment}.{$group}.php"); } foreach ($paths as $file) { if ($this->files->exists($file)) { $items = $this->mergeEnvironment($items, $file); } } return $items; }
public function load($environment, $group, $namespace = null) { $items = array(); // First we'll get the root configuration path for the environment which is // where all of the configuration files live for that namespace, as well // as any environment folders with their specific configuration items. $path = $this->getPath($namespace); if (is_null($path)) { return $items; } if ($namespace === null) { // No namespace, let's load up the concrete config first. $items = parent::load($environment, $group, 'core'); $file = "{$path}/generated_overrides/{$group}.php"; if ($this->files->exists($file)) { $items = $this->mergeEnvironment($items, $file); } $file = "{$path}/{$group}.php"; if ($this->files->exists($file)) { $items = $this->mergeEnvironment($items, $file); } } else { // First we'll get the main configuration file for the groups. Once we have // that we can check for any environment specific files, which will get // merged on top of the main arrays to make the environments cascade. $file = "{$path}/{$group}.php"; if ($this->files->exists($file)) { $items = (array) $this->files->getRequire($file); } $file = "{$path}/generated_overrides/{$namespace}/{$group}.php"; if ($this->files->exists($file)) { $items = $this->mergeEnvironment($items, $file); } $file = "{$path}/{$namespace}/{$group}.php"; if ($this->files->exists($file)) { $items = $this->mergeEnvironment($items, $file); } } // Finally we're ready to check for the environment specific configuration // file which will be merged on top of the main arrays so that they get // precedence over them if we are currently in an environments setup. $file = "{$path}/{$environment}/{$group}.php"; if ($this->files->exists($file)) { $items = $this->mergeEnvironment($items, $file); } return $items; }