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/src/CliProgram/Validation/Validators/EmailValidator.php

23 lines
490 B
PHP

<?php
namespace jrosset\CliProgram\Validation\Validators;
/**
* An argument/option value validator expecting an email address
*/
class EmailValidator implements IValidator {
use TInternalValueValidator;
use TIdenticalValidDefaultValidator;
/**
* @inheritDoc
*/
public function validate ($value): bool {
if (!filter_var($value, FILTER_VALIDATE_EMAIL)) {
return false;
}
$this->setValue($value);
return true;
}
}