private function load($env = 'local', $file = 'config')
    {
        $path = BASE_PATH . ($file === '.env' ? '' : '/config');

        // File paths
        $configPath = "{$path}/{$file}.yml";
        $envConfigPath = "{$path}/{$file}_{$env}.yml";

        if (!file_exists($configPath)) {
            throw new \Exception("Config file not found at \"{$configPath}\".");
        }

        $data = file_get_contents($configPath);

        if ($data === false) {
            throw new \Exception("Unable to load configuration from: {$configPath}");
        }

        $yaml = new Parser();

        // Load config
        $config = $yaml->parse($data);
        $this->config = $config ? $config : [];

        // Load environment specific config
        if (file_exists($envConfigPath)) {
            $data = file_get_contents($envConfigPath);

            if ($data) {
                $config = $yaml->parse($data);
                $config = $config ? $config : [];

                // Merge config values
                $this->config = array_merge($this->config, $config);
            }
        }
    }
private function load($env = 'local', $file = 'config')
    {
        $path = BASE_PATH . ($file === '.env' ? '' : '/config');

        // File paths
        $configPath = "{$path}/{$file}.yml";
        $envConfigPath = "{$path}/{$file}_{$env}.yml";

        if (!file_exists($configPath)) {
            throw new \Exception("Config file not found at \"{$configPath}\".");
        }

        $data = file_get_contents($configPath);

        if ($data === false) {
            throw new \Exception("Unable to load configuration from: {$configPath}");
        }

        $yaml = new Parser();

        // Load config
        $config = $yaml->parse($data);
        $this->config = $config ? $config : [];

        // Load environment specific config
        if (file_exists($envConfigPath)) {
            $data = file_get_contents($envConfigPath);

            if ($data) {
                $config = $yaml->parse($data);
                $config = $config ? $config : [];

                // Merge config values
                $this->config = array_merge($this->config, $config);
            }
        }
    }
private function load ( $ env = 'local' , $ file = 'config' ) { $ path = BASE_PATH . ( $ file === '.env' ? '' : '/config' ) ; // File paths $ configPath = "{$path}/{$file}.yml" ; $ envConfigPath = "{$path}/{$file}_{$env}.yml" ; if ( ! file_exists ( $ configPath ) ) { throw new \ Exception ( "Config file not found at \"{$configPath}\"." ) ; } $ data = file_get_contents ( $ configPath ) ; if ( $ data === false ) { throw new \ Exception ( "Unable to load configuration from: {$configPath}" ) ; } $ yaml = new Parser ( ) ; // Load config $ config = $ yaml -> parse ( $ data ) ; $ this -> config = $ config ? $ config : [ ] ; // Load environment specific config if ( file_exists ( $ envConfigPath ) ) { $ data = file_get_contents ( $ envConfigPath ) ; if ( $ data ) { $ config = $ yaml -> parse ( $ data ) ; $ config = $ config ? $ config : [ ] ; // Merge config values $ this -> config = array_merge ( $ this -> config , $ config ) ; } } }
Loads and parses the config file

@param string $env  Environment
@param string $file Config filename
@return void
@throws \Exception
Loads and parses the config file