protected function executeWithStack(Stack $stack, InputInterface $input, OutputInterface $output)
{
$methodName = 'get' . ucfirst($this->property);
$key = $input->getArgument('key');
if ($key) {
$methodName = substr($methodName, 0, -1);
$output->writeln($stack->{$methodName}($key));
return;
}
$data = $stack->{$methodName}();
$rows = [];
foreach ($data as $k => $v) {
$v = strlen($v) > 100 ? substr($v, 0, 100) . "..." : $v;
$rows[] = [$k, $v];
}
$table = new Table($output);
$table->setHeaders(['Key', 'Value'])->setRows($rows)->render();
}