From 01a7d7ffc45b17093bf71c6711adea36fe67ac62 Mon Sep 17 00:00:00 2001 From: Julien Rosset Date: Mon, 17 Jul 2023 16:11:59 +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..762d82e --- /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