mirror of
https://github.com/egulias/EmailValidator.git
synced 2026-08-28 11:07:55 +00:00
e4f04d5d8a
* Spoof validation
39 lines
762 B
PHP
39 lines
762 B
PHP
<?php
|
|
|
|
namespace Egulias\EmailValidator\Validation;
|
|
|
|
use Egulias\EmailValidator\EmailLexer;
|
|
use Egulias\EmailValidator\Validation\Error\SpoofEmail;
|
|
use \Spoofchecker;
|
|
|
|
class SpoofCheckValidation implements EmailValidation
|
|
{
|
|
/**
|
|
* @var InvalidEmail
|
|
*/
|
|
private $error;
|
|
|
|
public function isValid($email, EmailLexer $emailLexer)
|
|
{
|
|
$checker = new Spoofchecker();
|
|
$checker->setChecks(Spoofchecker::SINGLE_SCRIPT);
|
|
|
|
if ($checker->isSuspicious($email)) {
|
|
$this->error = new SpoofEmail();
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public function getError()
|
|
{
|
|
return $this->error;
|
|
}
|
|
|
|
public function getWarnings()
|
|
{
|
|
return [];
|
|
}
|
|
}
|