Initial commit
This commit is contained in:
49
vendor/egulias/email-validator/src/Result/InvalidEmail.php
vendored
Normal file
49
vendor/egulias/email-validator/src/Result/InvalidEmail.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result;
|
||||
|
||||
use Egulias\EmailValidator\Result\Reason\Reason;
|
||||
|
||||
class InvalidEmail implements Result
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private string $token;
|
||||
|
||||
/**
|
||||
* @var Reason
|
||||
*/
|
||||
protected Reason $reason;
|
||||
|
||||
public function __construct(Reason $reason, string $token)
|
||||
{
|
||||
$this->token = $token;
|
||||
$this->reason = $reason;
|
||||
}
|
||||
|
||||
public function isValid(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function isInvalid(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function description(): string
|
||||
{
|
||||
return $this->reason->description() . " in char " . $this->token;
|
||||
}
|
||||
|
||||
public function code(): int
|
||||
{
|
||||
return $this->reason->code();
|
||||
}
|
||||
|
||||
public function reason(): Reason
|
||||
{
|
||||
return $this->reason;
|
||||
}
|
||||
}
|
||||
56
vendor/egulias/email-validator/src/Result/MultipleErrors.php
vendored
Normal file
56
vendor/egulias/email-validator/src/Result/MultipleErrors.php
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result;
|
||||
|
||||
use Egulias\EmailValidator\Result\Reason\EmptyReason;
|
||||
use Egulias\EmailValidator\Result\Reason\Reason;
|
||||
|
||||
/**
|
||||
* @psalm-suppress PropertyNotSetInConstructor
|
||||
*/
|
||||
class MultipleErrors extends InvalidEmail
|
||||
{
|
||||
/**
|
||||
* @var Reason[]
|
||||
*/
|
||||
private $reasons = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public function addReason(Reason $reason) : void
|
||||
{
|
||||
$this->reasons[$reason->code()] = $reason;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Reason[]
|
||||
*/
|
||||
public function getReasons() : array
|
||||
{
|
||||
return $this->reasons;
|
||||
}
|
||||
|
||||
public function reason() : Reason
|
||||
{
|
||||
return 0 !== count($this->reasons)
|
||||
? current($this->reasons)
|
||||
: new EmptyReason();
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
$description = '';
|
||||
foreach($this->reasons as $reason) {
|
||||
$description .= $reason->description() . PHP_EOL;
|
||||
}
|
||||
|
||||
return $description;
|
||||
}
|
||||
|
||||
public function code() : int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/AtextAfterCFWS.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/AtextAfterCFWS.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class AtextAfterCFWS implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 133;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return 'ATEXT found after CFWS';
|
||||
}
|
||||
}
|
||||
19
vendor/egulias/email-validator/src/Result/Reason/CRLFAtTheEnd.php
vendored
Normal file
19
vendor/egulias/email-validator/src/Result/Reason/CRLFAtTheEnd.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class CRLFAtTheEnd implements Reason
|
||||
{
|
||||
public const CODE = 149;
|
||||
public const REASON = "CRLF at the end";
|
||||
|
||||
public function code() : int
|
||||
{
|
||||
return 149;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return 'CRLF at the end';
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/CRLFX2.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/CRLFX2.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class CRLFX2 implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 148;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return 'CR LF tokens found twice';
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/CRNoLF.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/CRNoLF.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class CRNoLF implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 150;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return 'Missing LF after CR';
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/CharNotAllowed.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/CharNotAllowed.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class CharNotAllowed implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return "Character not allowed";
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/CommaInDomain.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/CommaInDomain.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class CommaInDomain implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 200;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return "Comma ',' is not allowed in domain part";
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/CommentsInIDRight.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/CommentsInIDRight.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class CommentsInIDRight implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 400;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return 'Comments are not allowed in IDRight for message-id';
|
||||
}
|
||||
}
|
||||
17
vendor/egulias/email-validator/src/Result/Reason/ConsecutiveAt.php
vendored
Normal file
17
vendor/egulias/email-validator/src/Result/Reason/ConsecutiveAt.php
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class ConsecutiveAt implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 128;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return '@ found after another @';
|
||||
}
|
||||
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/ConsecutiveDot.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/ConsecutiveDot.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class ConsecutiveDot implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 132;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return 'Concecutive DOT found';
|
||||
}
|
||||
}
|
||||
13
vendor/egulias/email-validator/src/Result/Reason/DetailedReason.php
vendored
Normal file
13
vendor/egulias/email-validator/src/Result/Reason/DetailedReason.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
abstract class DetailedReason implements Reason
|
||||
{
|
||||
protected $detailedDescription;
|
||||
|
||||
public function __construct(string $details)
|
||||
{
|
||||
$this->detailedDescription = $details;
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/DomainAcceptsNoMail.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/DomainAcceptsNoMail.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class DomainAcceptsNoMail implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 154;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return 'Domain accepts no mail (Null MX, RFC7505)';
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/DomainHyphened.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/DomainHyphened.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class DomainHyphened extends DetailedReason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 144;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return 'S_HYPHEN found in domain';
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/DomainTooLong.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/DomainTooLong.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class DomainTooLong implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 244;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return 'Domain is longer than 253 characters';
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/DotAtEnd.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/DotAtEnd.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class DotAtEnd implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 142;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return 'Dot at the end';
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/DotAtStart.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/DotAtStart.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class DotAtStart implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 141;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return "Starts with a DOT";
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/EmptyReason.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/EmptyReason.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class EmptyReason implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return 'Empty reason';
|
||||
}
|
||||
}
|
||||
26
vendor/egulias/email-validator/src/Result/Reason/ExceptionFound.php
vendored
Normal file
26
vendor/egulias/email-validator/src/Result/Reason/ExceptionFound.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class ExceptionFound implements Reason
|
||||
{
|
||||
/**
|
||||
* @var \Exception
|
||||
*/
|
||||
private $exception;
|
||||
|
||||
public function __construct(\Exception $exception)
|
||||
{
|
||||
$this->exception = $exception;
|
||||
|
||||
}
|
||||
public function code() : int
|
||||
{
|
||||
return 999;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return $this->exception->getMessage();
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/ExpectingATEXT.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/ExpectingATEXT.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class ExpectingATEXT extends DetailedReason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 137;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return "Expecting ATEXT (Printable US-ASCII). Extended: " . $this->detailedDescription;
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/ExpectingCTEXT.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/ExpectingCTEXT.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class ExpectingCTEXT implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 139;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return 'Expecting CTEXT';
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/ExpectingDTEXT.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/ExpectingDTEXT.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class ExpectingDTEXT implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 129;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return 'Expecting DTEXT';
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/ExpectingDomainLiteralClose.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/ExpectingDomainLiteralClose.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class ExpectingDomainLiteralClose implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 137;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return "Closing bracket ']' for domain literal not found";
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/LabelTooLong.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/LabelTooLong.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class LabelTooLong implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 245;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return 'Domain "label" is longer than 63 characters';
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/LocalOrReservedDomain.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/LocalOrReservedDomain.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class LocalOrReservedDomain implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 153;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return 'Local, mDNS or reserved domain (RFC2606, RFC6762)';
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/NoDNSRecord.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/NoDNSRecord.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class NoDNSRecord implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return 'No MX or A DSN record was found for this email';
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/NoDomainPart.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/NoDomainPart.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class NoDomainPart implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 131;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return 'No domain part found';
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/NoLocalPart.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/NoLocalPart.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class NoLocalPart implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 130;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return "No local part";
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/RFCWarnings.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/RFCWarnings.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class RFCWarnings implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 997;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return 'Warnings found after validating';
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/Reason.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/Reason.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
interface Reason
|
||||
{
|
||||
/**
|
||||
* Code for user land to act upon;
|
||||
*/
|
||||
public function code() : int;
|
||||
|
||||
/**
|
||||
* Short description of the result, human readable.
|
||||
*/
|
||||
public function description() : string;
|
||||
}
|
||||
17
vendor/egulias/email-validator/src/Result/Reason/SpoofEmail.php
vendored
Normal file
17
vendor/egulias/email-validator/src/Result/Reason/SpoofEmail.php
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class SpoofEmail implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 298;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return 'The email contains mixed UTF8 chars that makes it suspicious';
|
||||
}
|
||||
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/UnOpenedComment.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/UnOpenedComment.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class UnOpenedComment implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 152;
|
||||
}
|
||||
|
||||
public function description(): string
|
||||
{
|
||||
return 'Missing opening comment parentheses - https://tools.ietf.org/html/rfc5322#section-3.2.2';
|
||||
}
|
||||
}
|
||||
19
vendor/egulias/email-validator/src/Result/Reason/UnableToGetDNSRecord.php
vendored
Normal file
19
vendor/egulias/email-validator/src/Result/Reason/UnableToGetDNSRecord.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
/**
|
||||
* Used on SERVFAIL, TIMEOUT or other runtime and network errors
|
||||
*/
|
||||
class UnableToGetDNSRecord extends NoDNSRecord
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return 'Unable to get DNS records for the host';
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/UnclosedComment.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/UnclosedComment.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class UnclosedComment implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 146;
|
||||
}
|
||||
|
||||
public function description(): string
|
||||
{
|
||||
return 'No closing comment token found';
|
||||
}
|
||||
}
|
||||
16
vendor/egulias/email-validator/src/Result/Reason/UnclosedQuotedString.php
vendored
Normal file
16
vendor/egulias/email-validator/src/Result/Reason/UnclosedQuotedString.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class UnclosedQuotedString implements Reason
|
||||
{
|
||||
public function code() : int
|
||||
{
|
||||
return 145;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return "Unclosed quoted string";
|
||||
}
|
||||
}
|
||||
26
vendor/egulias/email-validator/src/Result/Reason/UnusualElements.php
vendored
Normal file
26
vendor/egulias/email-validator/src/Result/Reason/UnusualElements.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result\Reason;
|
||||
|
||||
class UnusualElements implements Reason
|
||||
{
|
||||
/**
|
||||
* @var string $element
|
||||
*/
|
||||
private $element;
|
||||
|
||||
public function __construct(string $element)
|
||||
{
|
||||
$this->element = $element;
|
||||
}
|
||||
|
||||
public function code() : int
|
||||
{
|
||||
return 201;
|
||||
}
|
||||
|
||||
public function description() : string
|
||||
{
|
||||
return 'Unusual element found, wourld render invalid in majority of cases. Element found: ' . $this->element;
|
||||
}
|
||||
}
|
||||
27
vendor/egulias/email-validator/src/Result/Result.php
vendored
Normal file
27
vendor/egulias/email-validator/src/Result/Result.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result;
|
||||
|
||||
interface Result
|
||||
{
|
||||
/**
|
||||
* Is validation result valid?
|
||||
*/
|
||||
public function isValid() : bool;
|
||||
|
||||
/**
|
||||
* Is validation result invalid?
|
||||
* Usually the inverse of isValid()
|
||||
*/
|
||||
public function isInvalid() : bool;
|
||||
|
||||
/**
|
||||
* Short description of the result, human readable.
|
||||
*/
|
||||
public function description() : string;
|
||||
|
||||
/**
|
||||
* Code for user land to act upon.
|
||||
*/
|
||||
public function code() : int;
|
||||
}
|
||||
13
vendor/egulias/email-validator/src/Result/SpoofEmail.php
vendored
Normal file
13
vendor/egulias/email-validator/src/Result/SpoofEmail.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
namespace Egulias\EmailValidator\Result;
|
||||
|
||||
use Egulias\EmailValidator\Result\Reason\SpoofEmail as ReasonSpoofEmail;
|
||||
|
||||
class SpoofEmail extends InvalidEmail
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->reason = new ReasonSpoofEmail();
|
||||
parent::__construct($this->reason, '');
|
||||
}
|
||||
}
|
||||
27
vendor/egulias/email-validator/src/Result/ValidEmail.php
vendored
Normal file
27
vendor/egulias/email-validator/src/Result/ValidEmail.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Egulias\EmailValidator\Result;
|
||||
|
||||
class ValidEmail implements Result
|
||||
{
|
||||
public function isValid(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isInvalid(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function description(): string
|
||||
{
|
||||
return "Valid email";
|
||||
}
|
||||
|
||||
public function code(): int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user