Library/Phalcon/Builder/Path.php
public function getConfig($type = null)
    {
        $types = ['php' => true, 'ini' => true];
        $type  = isset($types[$type]) ? $type : 'ini';

        foreach (['app/config/', 'config/', 'apps/config/', 'apps/frontend/config/'] as $configPath) {
            if ('ini' == $type && file_exists($this->rootPath . $configPath . 'config.ini')) {
                return new ConfigIni($this->rootPath . $configPath . 'config.ini');
            } else {
                if (file_exists($this->rootPath . $configPath. 'config.php')) {
                    $config = include($this->rootPath . $configPath . 'config.php');
                    if (is_array($config)) {
                        $config = new Config($config);
                    }

                    return $config;
                }
            }
        }

        $directory = new RecursiveDirectoryIterator('.');
        $iterator = new RecursiveIteratorIterator($directory);
        foreach ($iterator as $f) {
            if (preg_match('/config\.php$/i', $f->getPathName())) {
                $config = include $f->getPathName();
                if (is_array($config)) {
                    $config = new Config($config);
                }

                return $config;
            } else {
                if (preg_match('/config\.ini$/i', $f->getPathName())) {
                    return new ConfigIni($f->getPathName());
                }
            }
        }

        throw new BuilderException("Builder can't locate the configuration file");
    }
public function getConfig($type = null)
    {
        $types = ['php' => true, 'ini' => true];
        $type  = isset($types[$type]) ? $type : 'ini';

        foreach (['app/config/', 'config/', 'apps/config/', 'apps/frontend/config/'] as $configPath) {
            if ('ini' == $type && file_exists($this->rootPath . $configPath . 'config.ini')) {
                return new ConfigIni($this->rootPath . $configPath . 'config.ini');
            } else {
                if (file_exists($this->rootPath . $configPath. 'config.php')) {
                    $config = include($this->rootPath . $configPath . 'config.php');
                    if (is_array($config)) {
                        $config = new Config($config);
                    }

                    return $config;
                }
            }
        }

        $directory = new RecursiveDirectoryIterator('.');
        $iterator = new RecursiveIteratorIterator($directory);
        foreach ($iterator as $f) {
            if (preg_match('/config\.php$/i', $f->getPathName())) {
                $config = include $f->getPathName();
                if (is_array($config)) {
                    $config = new Config($config);
                }

                return $config;
            } else {
                if (preg_match('/config\.ini$/i', $f->getPathName())) {
                    return new ConfigIni($f->getPathName());
                }
            }
        }

        throw new BuilderException("Builder can't locate the configuration file");
    }
public function getConfig ( $ type = null ) { $ types = [ 'php' => true , 'ini' => true ] ; $ type = isset ( $ types [ $ type ] ) ? $ type : 'ini' ; foreach ( [ 'app/config/' , 'config/' , 'apps/config/' , 'apps/frontend/config/' ] as $ configPath ) { if ( 'ini' == $ type && file_exists ( $ this -> rootPath . $ configPath . 'config.ini' ) ) { return new ConfigIni ( $ this -> rootPath . $ configPath . 'config.ini' ) ; } else { if ( file_exists ( $ this -> rootPath . $ configPath . 'config.php' ) ) { $ config = include ( $ this -> rootPath . $ configPath . 'config.php' ) ; if ( is_array ( $ config ) ) { $ config = new Config ( $ config ) ; } return $ config ; } } } $ directory = new RecursiveDirectoryIterator ( '.' ) ; $ iterator = new RecursiveIteratorIterator ( $ directory ) ; foreach ( $ iterator as $ f ) { if ( preg_match ( '/config\.php$/i' , $ f -> getPathName ( ) ) ) { $ config = include $ f -> getPathName ( ) ; if ( is_array ( $ config ) ) { $ config = new Config ( $ config ) ; } return $ config ; } else { if ( preg_match ( '/config\.ini$/i' , $ f -> getPathName ( ) ) ) { return new ConfigIni ( $ f -> getPathName ( ) ) ; } } } throw new BuilderException ( "Builder can't locate the configuration file" ) ; }
Tries to find the current configuration in the application

@param string $type Config type: ini | php
@return \Phalcon\Config
@throws BuilderException
Tries to find the current configuration in the application