You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PhpCliProgram/tests/Commands/Email.php

34 lines
940 B
PHP

<?php
namespace jrosset\Tests\Commands;
use jrosset\CliProgram\Validation\CommandWithValidation;
use jrosset\CliProgram\Validation\Validators\EmailValidator;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class Email extends CommandWithValidation {
/**
* @inheritDoc
*/
protected function configure () {
parent::configure();
$this->addArgument(
'email',
InputArgument::REQUIRED,
'The email address',
null,
new EmailValidator()
);
}
/**
* @inheritDoc
*/
protected function execute (InputInterface $input, OutputInterface $output): int {
$output->writeln('<info>' . $input->getArgument('email') . '</info>');
return Command::SUCCESS;
}
}