protected function parseMainFile(string $file): MutableBag
    {
        $envs = $this->parse($file);

        if (!$envs->has('default')) {
            $envs['default'] = new MutableBag();
        }

        $envs = $this->sortEnvs($envs);

        // Merge in parent configs for each environment, specified with "_extends" key
        foreach ($envs as $name => $config) {
            // Skip "default" since this is the based for all
            if ($name === 'default') {
                continue;
            }

            $parent = $config->remove('_extends', 'default');
            $envs[$name] = $envs[$parent]->replaceRecursive($config);
        }

        return $envs;
    }
protected function parseMainFile(string $file): MutableBag
    {
        $envs = $this->parse($file);

        if (!$envs->has('default')) {
            $envs['default'] = new MutableBag();
        }

        $envs = $this->sortEnvs($envs);

        // Merge in parent configs for each environment, specified with "_extends" key
        foreach ($envs as $name => $config) {
            // Skip "default" since this is the based for all
            if ($name === 'default') {
                continue;
            }

            $parent = $config->remove('_extends', 'default');
            $envs[$name] = $envs[$parent]->replaceRecursive($config);
        }

        return $envs;
    }
protected function parseMainFile ( string $ file ) : MutableBag { $ envs = $ this -> parse ( $ file ) ; if ( ! $ envs -> has ( 'default' ) ) { $ envs [ 'default' ] = new MutableBag ( ) ; } $ envs = $ this -> sortEnvs ( $ envs ) ; // Merge in parent configs for each environment, specified with "_extends" key foreach ( $ envs as $ name => $ config ) { // Skip "default" since this is the based for all if ( $ name === 'default' ) { continue ; } $ parent = $ config -> remove ( '_extends' , 'default' ) ; $ envs [ $ name ] = $ envs [ $ parent ] -> replaceRecursive ( $ config ) ; } return $ envs ; }
Parse main config file.

@param string $file

@throws ConfigException If env extends an env not parsed yet.

@return MutableBag|MutableBag[]
Parse main config file .