config = $config; parent::__construct(); } protected function configure() { $this ->setName('config:set-atomic') ->setDescription('Sets a configuration option\'s value') ->addArgument( 'config-key', InputArgument::REQUIRED, 'The configuration option\'s name' ) ->addArgument( 'old-value', InputArgument::REQUIRED, 'Current configuration value' ) ->addArgument( 'new-value', InputArgument::REQUIRED, 'New configuration value' ) ->addArgument( 'use-cache', InputArgument::OPTIONAL, 'Whether this variable should be cached or if it changes too frequently to be efficiently cached.', true ) ; } protected function execute(InputInterface $input, OutputInterface $output) { $key = $input->getArgument('config-key'); $old_value = $input->getArgument('old-value'); $new_value = $input->getArgument('new-value'); $use_cache = $input->getArgument('use-cache'); $use_cache = (strtolower($use_cache) !== 'false' && $use_cache); if ($this->config->set_atomic($key, $old_value, $new_value, $use_cache)) { $output->writeln("Successfully set config $key"); return 0; } else { $output->writeln("Could not set config $key"); return 1; } } }