setName('redis:read') ->setDescription('Read Redis data') ->setHelp('This command allows test redis') ->setDefinition(array( new InputOption('key', null, InputOption::VALUE_OPTIONAL, "Key redis", null) )) ; } /** * @param InputInterface $input * @param OutputInterface $output */ protected function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $key = $input->getOption('key'); if(is_null($key)) { $this->output->writeln("key es nulo."); return true; } $data = $this->getData($key, true); if(empty($data)) { $this->output->writeln("Se requiere {$key}."); return true; } print_r(PHP_EOL."######################".PHP_EOL); print_r($data); print_r(PHP_EOL."######################".PHP_EOL); } }