for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Phypes\Validator;
use Phypes\Error\TypeError\TypeError;
use Phypes\Error\TypeError\TypeErrorCode;
use Phypes\Result;
class EmailValidator extends AbstractValidator
{
public function validate($email, $options = []): Result
$this->validated = true;
validated
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
return $this->success();
}
$error = new TypeError(TypeErrorCode::EMAIL_INVALID, 'The provided email is invalid.');
return $this->failure($error);