$host =
substr($email,
$lastAtPos + 1
);
} // Get the domain parts
$hostParts =
explode('.',
$host);
$isLocalDomain =
count($hostParts) <= 1;
$isReservedTopLevel =
in_array($hostParts[(count($hostParts) - 1
)], self::RESERVED_DNS_TOP_LEVEL_NAMES, true
);
// Exclude reserved top level DNS names
if ($isLocalDomain ||
$isReservedTopLevel) { $this->error =
new InvalidEmail(new LocalOrReservedDomain(),
$host);
return false;
} return $this->
checkDns($host);
} public function getError(): ?InvalidEmail
{ return $this->error;
}