protected function execute(InputInterface $input, OutputInterface $output)
{
$info = $this->api()->getMyAccount((bool) $input->getOption('refresh'));
$formatter = new PropertyFormatter($input);
$propertyWhitelist = ['id', 'uuid', 'display_name', 'username', 'mail', 'has_key'];
$info = array_intersect_key($info, array_flip($propertyWhitelist));
$property = $input->getArgument('property');
if ($input->getOption('property')) {
if ($property) {
throw new InvalidArgumentException(sprintf('You cannot use both the <%s> argument and the --%s option', 'property', 'property'));
}
$property = $input->getOption('property');
}
if ($property) {
if (!isset($info[$property])) {
throw new \InvalidArgumentException('Property not found: ' . $property);
}
$output->writeln($formatter->format($info[$property], $property));
return 0;
}
unset($info['uuid']);
$values = [];
$header = [];
foreach ($propertyWhitelist as $property) {
if (isset($info[$property])) {
$values[] = $formatter->format($info[$property], $property);
$header[] = $property;
}
}
$table = new Table($input, $output);
$table->renderSimple($values, $header);
return 0;
}