public function load($path, $prefix = null, $override = true)
    {
        $file = new SplFileInfo($path);

        $className = $file->isDir() ? 'Directory' : ucfirst(strtolower($file->getExtension()));
        $classPath = 'PHLAK\\Config\\Loaders\\' . $className;

        $loader = new $classPath($file->getRealPath());

        $newConfig = $prefix ? [$prefix => $loader->getArray()] : $loader->getArray();

        if ($override) {
            $this->config = array_replace_recursive($this->config, $newConfig);
        } else {
            $this->config = array_replace_recursive($newConfig, $this->config);
        }

        return $this;
    }
public function load($path, $prefix = null, $override = true)
    {
        $file = new SplFileInfo($path);

        $className = $file->isDir() ? 'Directory' : ucfirst(strtolower($file->getExtension()));
        $classPath = 'PHLAK\\Config\\Loaders\\' . $className;

        $loader = new $classPath($file->getRealPath());

        $newConfig = $prefix ? [$prefix => $loader->getArray()] : $loader->getArray();

        if ($override) {
            $this->config = array_replace_recursive($this->config, $newConfig);
        } else {
            $this->config = array_replace_recursive($newConfig, $this->config);
        }

        return $this;
    }
public function load ( $ path , $ prefix = null , $ override = true ) { $ file = new SplFileInfo ( $ path ) ; $ className = $ file -> isDir ( ) ? 'Directory' : ucfirst ( strtolower ( $ file -> getExtension ( ) ) ) ; $ classPath = 'PHLAK\\Config\\Loaders\\' . $ className ; $ loader = new $ classPath ( $ file -> getRealPath ( ) ) ; $ newConfig = $ prefix ? [ $ prefix => $ loader -> getArray ( ) ] : $ loader -> getArray ( ) ; if ( $ override ) { $ this -> config = array_replace_recursive ( $ this -> config , $ newConfig ) ; } else { $ this -> config = array_replace_recursive ( $ newConfig , $ this -> config ) ; } return $ this ; }
Load configuration options from a file or directory.

@param string $path     Path to configuration file or directory
@param string $prefix   A key under which the loaded config will be nested
@param bool   $override Whether or not to override existing options with
values from the loaded file

@return self This Config object
Load configuration options from a file or directory .