state = $state; $this->keyValue = $keyValue; parent::__construct(); } /** * {@inheritdoc} */ protected function configure() { $this ->setName('state:debug') ->setDescription($this->trans('commands.state.debug.description')) ->setHelp($this->trans('commands.state.debug.help')) ->addArgument( 'key', InputArgument::OPTIONAL, $this->trans('commands.state.debug.arguments.key') ); } /** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); $key = $input->getArgument('key'); if ($key) { $io->info($key); $io->writeln(Yaml::encode($this->state->get($key))); return 0; } $tableHeader = [$this->trans('commands.state.debug.messages.key')]; $keyStoreStates = array_keys($this->keyValue->get('state')->getAll()); $io->table($tableHeader, $keyStoreStates); return 0; } }