protected function interact(InputInterface $input, OutputInterface $output)
{
$emptyValidator = function ($string) {
if (trim($string) === '') {
throw new \InvalidArgumentException('This value cannot be empty');
}
return $string;
};
$styleHelper = $this->getHelper('gush_style');
if ('' === (string) $input->getOption('title')) {
$input->setOption('title', $styleHelper->ask('Issue title', null, $emptyValidator));
}
if ('' === (string) $input->getOption('body')) {
$body = $styleHelper->ask('Body (enter "e" to open editor)', '');
if ('e' === $body) {
/** @var EditorHelper $editor */
$editor = $this->getHelper('editor');
$body = $editor->fromString('');
}
$input->setOption('body', $body);
}
}