protected function loadPmConfig(InputInterface $input, OutputInterface $output)
    {
        $config = [];

        if ($path = $this->getPmConfigPath($input)) {
            $content = file_get_contents($path);
            $config = json_decode($content, true);
        }

        $config['bridge'] = $this->optionOrConfigValue($input, $config, 'bridge');
        $config['host'] = $this->optionOrConfigValue($input, $config, 'host');
        $config['port'] = (int)$this->optionOrConfigValue($input, $config, 'port');
        $config['workers'] = (int)$this->optionOrConfigValue($input, $config, 'workers');
        $config['app-env'] = $this->optionOrConfigValue($input, $config, 'app-env');
        $config['debug'] = $this->optionOrConfigValue($input, $config, 'debug');
        $config['logging'] = $this->optionOrConfigValue($input, $config, 'logging');
        $config['static-directory'] = $this->optionOrConfigValue($input, $config, 'static-directory');
        $config['bootstrap'] = $this->optionOrConfigValue($input, $config, 'bootstrap');
        $config['max-requests'] = (int)$this->optionOrConfigValue($input, $config, 'max-requests');
        $config['ttl'] = (int)$this->optionOrConfigValue($input, $config, 'ttl');
        $config['populate-server-var'] = (boolean)$this->optionOrConfigValue($input, $config, 'populate-server-var');
        $config['socket-path'] = $this->optionOrConfigValue($input, $config, 'socket-path');
        $config['pidfile'] = $this->optionOrConfigValue($input, $config, 'pidfile');
        $config['reload-timeout'] = $this->optionOrConfigValue($input, $config, 'reload-timeout');
        $config['max-memory-usage'] = $this->optionOrConfigValue($input, $config, 'max-memory-usage');

        $config['cli-path'] = $this->optionOrConfigValue($input, $config, 'cli-path');

        if (false === $config['cli-path']) {
            //not set in config nor in command options -> autodetect path
            $executableFinder = new PhpExecutableFinder();
            $binary = $executableFinder->find();
            $config['cli-path'] = $binary;

            if (false === $config['cli-path']) {
                $output->writeln('<error>PPM could find a php-cli path. Please specify by --cli-path=</error>');
                exit(1);
            }
        }

        return $config;
    }
protected function loadPmConfig(InputInterface $input, OutputInterface $output)
    {
        $config = [];

        if ($path = $this->getPmConfigPath($input)) {
            $content = file_get_contents($path);
            $config = json_decode($content, true);
        }

        $config['bridge'] = $this->optionOrConfigValue($input, $config, 'bridge');
        $config['host'] = $this->optionOrConfigValue($input, $config, 'host');
        $config['port'] = (int)$this->optionOrConfigValue($input, $config, 'port');
        $config['workers'] = (int)$this->optionOrConfigValue($input, $config, 'workers');
        $config['app-env'] = $this->optionOrConfigValue($input, $config, 'app-env');
        $config['debug'] = $this->optionOrConfigValue($input, $config, 'debug');
        $config['logging'] = $this->optionOrConfigValue($input, $config, 'logging');
        $config['static-directory'] = $this->optionOrConfigValue($input, $config, 'static-directory');
        $config['bootstrap'] = $this->optionOrConfigValue($input, $config, 'bootstrap');
        $config['max-requests'] = (int)$this->optionOrConfigValue($input, $config, 'max-requests');
        $config['ttl'] = (int)$this->optionOrConfigValue($input, $config, 'ttl');
        $config['populate-server-var'] = (boolean)$this->optionOrConfigValue($input, $config, 'populate-server-var');
        $config['socket-path'] = $this->optionOrConfigValue($input, $config, 'socket-path');
        $config['pidfile'] = $this->optionOrConfigValue($input, $config, 'pidfile');
        $config['reload-timeout'] = $this->optionOrConfigValue($input, $config, 'reload-timeout');
        $config['max-memory-usage'] = $this->optionOrConfigValue($input, $config, 'max-memory-usage');

        $config['cli-path'] = $this->optionOrConfigValue($input, $config, 'cli-path');

        if (false === $config['cli-path']) {
            //not set in config nor in command options -> autodetect path
            $executableFinder = new PhpExecutableFinder();
            $binary = $executableFinder->find();
            $config['cli-path'] = $binary;

            if (false === $config['cli-path']) {
                $output->writeln('<error>PPM could find a php-cli path. Please specify by --cli-path=</error>');
                exit(1);
            }
        }

        return $config;
    }
protected function loadPmConfig ( InputInterface $ input , OutputInterface $ output ) { $ config = [ ] ; if ( $ path = $ this -> getPmConfigPath ( $ input ) ) { $ content = file_get_contents ( $ path ) ; $ config = json_decode ( $ content , true ) ; } $ config [ 'bridge' ] = $ this -> optionOrConfigValue ( $ input , $ config , 'bridge' ) ; $ config [ 'host' ] = $ this -> optionOrConfigValue ( $ input , $ config , 'host' ) ; $ config [ 'port' ] = ( int ) $ this -> optionOrConfigValue ( $ input , $ config , 'port' ) ; $ config [ 'workers' ] = ( int ) $ this -> optionOrConfigValue ( $ input , $ config , 'workers' ) ; $ config [ 'app-env' ] = $ this -> optionOrConfigValue ( $ input , $ config , 'app-env' ) ; $ config [ 'debug' ] = $ this -> optionOrConfigValue ( $ input , $ config , 'debug' ) ; $ config [ 'logging' ] = $ this -> optionOrConfigValue ( $ input , $ config , 'logging' ) ; $ config [ 'static-directory' ] = $ this -> optionOrConfigValue ( $ input , $ config , 'static-directory' ) ; $ config [ 'bootstrap' ] = $ this -> optionOrConfigValue ( $ input , $ config , 'bootstrap' ) ; $ config [ 'max-requests' ] = ( int ) $ this -> optionOrConfigValue ( $ input , $ config , 'max-requests' ) ; $ config [ 'ttl' ] = ( int ) $ this -> optionOrConfigValue ( $ input , $ config , 'ttl' ) ; $ config [ 'populate-server-var' ] = ( boolean ) $ this -> optionOrConfigValue ( $ input , $ config , 'populate-server-var' ) ; $ config [ 'socket-path' ] = $ this -> optionOrConfigValue ( $ input , $ config , 'socket-path' ) ; $ config [ 'pidfile' ] = $ this -> optionOrConfigValue ( $ input , $ config , 'pidfile' ) ; $ config [ 'reload-timeout' ] = $ this -> optionOrConfigValue ( $ input , $ config , 'reload-timeout' ) ; $ config [ 'max-memory-usage' ] = $ this -> optionOrConfigValue ( $ input , $ config , 'max-memory-usage' ) ; $ config [ 'cli-path' ] = $ this -> optionOrConfigValue ( $ input , $ config , 'cli-path' ) ; if ( false === $ config [ 'cli-path' ] ) { //not set in config nor in command options -> autodetect path $ executableFinder = new PhpExecutableFinder ( ) ; $ binary = $ executableFinder -> find ( ) ; $ config [ 'cli-path' ] = $ binary ; if ( false === $ config [ 'cli-path' ] ) { $ output -> writeln ( '<error>PPM could find a php-cli path. Please specify by --cli-path=</error>' ) ; exit ( 1 ) ; } } return $ config ; }
Load config file content
@param InputInterface  $input
@param OutputInterface $output
@return array|mixed
@throws \Exception
Load config file content