Eccube\Command\ConfigCommand::execute PHP Method

execute() protected method

protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        /** @var \Eccube\Application $app */
        $app = $this->getSilexApplication();
        $filter = $input->getArgument('filter');
        $optional = $input->getOption('configphp');
        if ($optional) {
            // ymlファイルではなく、phpファイルが有効になっているかチェック
            $ymlPath = $this->getProjectDirectory() . '/app/config/eccube';
            $config_php = $ymlPath . '/config.php';
            if (file_exists($config_php)) {
                $output->writeln('Config PHP File : <info>used.</info>');
            } else {
                $output->writeln('Config PHP File : <info>not used.</info>');
            }
            if (!$filter) {
                return;
            }
        }
        $recursive = function ($config, $space = '    ') use(&$recursive, $output) {
            foreach ($config as $key => $item) {
                if (is_array($item)) {
                    $space = '    ';
                    $output->writeln($space . "<comment>{$key}</comment> :");
                    $space .= '    ';
                    $recursive($item, $space);
                } else {
                    $output->writeln($space . "<comment>{$key}</comment> : <info>{$item}</info>");
                }
            }
        };
        if ($filter) {
            // コマンド実行時にパラメータを指定
            $config = array();
            $app->parseConfig($filter, $config);
            if (!empty($config)) {
                // ymlファイル名が指定された場合、ymlファイルの内容を出力
                $output->writeln("YML File Name : <info>{$filter}</info>");
                foreach ($config as $key => $item) {
                    if (is_array($item)) {
                        $output->writeln("<comment>{$key}</comment> :");
                        $recursive($item);
                    } else {
                        $output->writeln("<comment>{$key}</comment> : <info>{$item}</info>");
                    }
                }
                return;
            }
            if (!isset($app['config'][$filter])) {
                $output->writeln('Not Found filter : $app[\'config\'][\'<error>' . $filter . '</error>\']');
                return;
            }
            $config = $app['config'][$filter];
            $output->writeln('$app[\'config\'][\'<comment>' . $filter . '</comment>\']');
            if (is_array($config)) {
                foreach ($config as $key => $item) {
                    if (is_array($item)) {
                        $output->writeln("<comment>{$key}</comment> :");
                        $recursive($item);
                    } else {
                        $output->writeln("<comment>{$key}</comment> : <info>{$item}</info>");
                    }
                }
            } else {
                $output->writeln("<comment>{$filter}</comment> : <info>{$config}</info>");
            }
        } else {
            // $app['config']の内容を全て出力する
            $config = $app['config'];
            foreach ($config as $key => $item) {
                if (is_array($item)) {
                    $output->writeln("<comment>{$key}</comment> :");
                    $recursive($item);
                } else {
                    $output->writeln("<comment>{$key}</comment> : <info>{$item}</info>");
                }
            }
        }
    }