Created
October 9, 2015 19:16
-
-
Save JoshuaEstes/0ef82116e842b4b1173d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
protected function interact(InputInterface $input, OutputInterface $output) | |
{ | |
$dialog = $this->getDialogHelper(); | |
$validator = Validation::createValidator(); | |
$inputValue = $dialog->askAndValidate($output, 'Enter some input: ', function($value) use($validator){ | |
$errors = $validator->validateValue($value, new Assert\NotBlank()); | |
if (count($errors)) { | |
throw new \InvalidArgumentException((string) $errors); | |
} | |
return $value; | |
}); | |
$MoreInputValue = $dialog->askAndValidate($output, 'Enter even more input input: ', function($value) use($validator){ | |
$errors = $validator->validateValue($value, new Assert\NotBlank()); | |
if (count($errors)) { | |
throw new \InvalidArgumentException((string) $errors); | |
} | |
return $value; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment