From 2981e01945687745b2b473b8e272c3d250024e00 Mon Sep 17 00:00:00 2001 From: Julien Rosset Date: Fri, 14 Jul 2023 19:27:27 +0200 Subject: [PATCH] Add EmailValidator --- .../Validation/Validators/EmailValidator.php | 23 +++++++++++++ tests/Commands/Email.php | 34 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 src/CliProgram/Validation/Validators/EmailValidator.php create mode 100644 tests/Commands/Email.php diff --git a/src/CliProgram/Validation/Validators/EmailValidator.php b/src/CliProgram/Validation/Validators/EmailValidator.php new file mode 100644 index 0000000..3b0a6bf --- /dev/null +++ b/src/CliProgram/Validation/Validators/EmailValidator.php @@ -0,0 +1,23 @@ +setValue($value); + return true; + } +} \ No newline at end of file diff --git a/tests/Commands/Email.php b/tests/Commands/Email.php new file mode 100644 index 0000000..c0d8fbb --- /dev/null +++ b/tests/Commands/Email.php @@ -0,0 +1,34 @@ +addArgument( + 'email', + InputArgument::REQUIRED, + 'The email address', + null, + new EmailValidator() + ); + } + /** + * @inheritDoc + */ + protected function execute (InputInterface $input, OutputInterface $output): int { + $output->writeln('' . $input->getArgument('email') . ''); + return Command::SUCCESS; + } +} \ No newline at end of file