Eccube\Application::parseConfig PHP Метод

parseConfig() публичный Метод

$config_name.yml ファイルをパースし、連想配列を返します. $config_name.php が存在する場合は、 PHP ファイルに記述された連想配列を使用します。
public parseConfig ( string $config_name, array &$configAll, boolean $wrap_key = false, string $ymlPath = null, string $distPath = null ) : Application
$config_name string Config 名称
$configAll array Config の連想配列
$wrap_key boolean Config の連想配列に config_name のキーを生成する場合 true, デフォルト false
$ymlPath string config yaml を格納したディレクトリ
$distPath string config yaml dist を格納したディレクトリ
Результат Application
    public function parseConfig($config_name, array &$configAll, $wrap_key = false, $ymlPath = null, $distPath = null)
    {
        $ymlPath = $ymlPath ? $ymlPath : __DIR__ . '/../../app/config/eccube';
        $distPath = $distPath ? $distPath : __DIR__ . '/../../src/Eccube/Resource/config';
        $config = array();
        $config_php = $ymlPath . '/' . $config_name . '.php';
        if (!file_exists($config_php)) {
            $config_yml = $ymlPath . '/' . $config_name . '.yml';
            if (file_exists($config_yml)) {
                $config = Yaml::parse(file_get_contents($config_yml));
                $config = empty($config) ? array() : $config;
                if (isset($this['output_config_php']) && $this['output_config_php']) {
                    file_put_contents($config_php, sprintf('<?php return %s', var_export($config, true)) . ';');
                }
            }
        } else {
            $config = (require $config_php);
        }
        $config_dist = array();
        $config_php_dist = $distPath . '/' . $config_name . '.dist.php';
        if (!file_exists($config_php_dist)) {
            $config_yml_dist = $distPath . '/' . $config_name . '.yml.dist';
            if (file_exists($config_yml_dist)) {
                $config_dist = Yaml::parse(file_get_contents($config_yml_dist));
                if (isset($this['output_config_php']) && $this['output_config_php']) {
                    file_put_contents($config_php_dist, sprintf('<?php return %s', var_export($config_dist, true)) . ';');
                }
            }
        } else {
            $config_dist = (require $config_php_dist);
        }
        if ($wrap_key) {
            $configAll = array_replace_recursive($configAll, array($config_name => $config_dist), array($config_name => $config));
        } else {
            $configAll = array_replace_recursive($configAll, $config_dist, $config);
        }
        return $this;
    }