public function load($dir, array $options = [])
    {
        $config = new Config();

        if (!$this->assertDir($dir, $options)) {
            return $config;
        }
        
        $dir = rtrim($dir, DIRECTORY_SEPARATOR);

        foreach (scandir($dir) as $file) {
            if ($file[0] == '.') {
                continue;
            }

            $key = pathinfo($file, PATHINFO_FILENAME);
            $data = $this->loadFile($dir . DIRECTORY_SEPARATOR . $file, $options);
            
            if (!isset($data)) {
                continue;
            }

            if (isset($config->$key) && $config->$key instanceof Config) {
                $config->$key->merge($data);
            } else {
                $config->$key = $data;
            }
        }
        
        return $config;
    }
public function load($dir, array $options = [])
    {
        $config = new Config();

        if (!$this->assertDir($dir, $options)) {
            return $config;
        }
        
        $dir = rtrim($dir, DIRECTORY_SEPARATOR);

        foreach (scandir($dir) as $file) {
            if ($file[0] == '.') {
                continue;
            }

            $key = pathinfo($file, PATHINFO_FILENAME);
            $data = $this->loadFile($dir . DIRECTORY_SEPARATOR . $file, $options);
            
            if (!isset($data)) {
                continue;
            }

            if (isset($config->$key) && $config->$key instanceof Config) {
                $config->$key->merge($data);
            } else {
                $config->$key = $data;
            }
        }
        
        return $config;
    }
public function load ( $ dir , array $ options = [ ] ) { $ config = new Config ( ) ; if ( ! $ this -> assertDir ( $ dir , $ options ) ) { return $ config ; } $ dir = rtrim ( $ dir , DIRECTORY_SEPARATOR ) ; foreach ( scandir ( $ dir ) as $ file ) { if ( $ file [ 0 ] == '.' ) { continue ; } $ key = pathinfo ( $ file , PATHINFO_FILENAME ) ; $ data = $ this -> loadFile ( $ dir . DIRECTORY_SEPARATOR . $ file , $ options ) ; if ( ! isset ( $ data ) ) { continue ; } if ( isset ( $ config -> $ key ) && $ config -> $ key instanceof Config ) { $ config -> $ key -> merge ( $ data ) ; } else { $ config -> $ key = $ data ; } } return $ config ; }
Load a config directory

@param string $dir
@param array  $options
@return Config
Load a config directory