diff options
| author | Greg Roach <fisharebest@webtrees.net> | 2019-07-13 22:13:09 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@webtrees.net> | 2019-07-13 22:13:09 +0100 |
| commit | ea75abda1c0370fb1de46fb302c8871017f17632 (patch) | |
| tree | 6ad700e0af225680cbeb9349882aa77f9292f5e9 /vendor/egulias | |
| parent | d0bcc06fc828c5fd8500d82c2aef6b766eb1c443 (diff) | |
| download | webtrees-ea75abda1c0370fb1de46fb302c8871017f17632.tar.gz webtrees-ea75abda1c0370fb1de46fb302c8871017f17632.tar.bz2 webtrees-ea75abda1c0370fb1de46fb302c8871017f17632.zip | |
Update vendor dependencies
Diffstat (limited to 'vendor/egulias')
| -rw-r--r-- | vendor/egulias/email-validator/EmailValidator/Parser/DomainPart.php | 48 |
1 files changed, 33 insertions, 15 deletions
diff --git a/vendor/egulias/email-validator/EmailValidator/Parser/DomainPart.php b/vendor/egulias/email-validator/EmailValidator/Parser/DomainPart.php index 51769dea1b..f2fd25a11b 100644 --- a/vendor/egulias/email-validator/EmailValidator/Parser/DomainPart.php +++ b/vendor/egulias/email-validator/EmailValidator/Parser/DomainPart.php @@ -41,21 +41,7 @@ class DomainPart extends Parser { $this->lexer->moveNext(); - if ($this->lexer->token['type'] === EmailLexer::S_DOT) { - throw new DotAtStart(); - } - - if ($this->lexer->token['type'] === EmailLexer::S_EMPTY) { - throw new NoDomainPart(); - } - if ($this->lexer->token['type'] === EmailLexer::S_HYPHEN) { - throw new DomainHyphened(); - } - - if ($this->lexer->token['type'] === EmailLexer::S_OPENPARENTHESIS) { - $this->warnings[DeprecatedComment::CODE] = new DeprecatedComment(); - $this->parseDomainComments(); - } + $this->performDomainStartChecks(); $domain = $this->doParseDomainPart(); @@ -77,6 +63,38 @@ class DomainPart extends Parser $this->domainPart = $domain; } + private function performDomainStartChecks() + { + $this->checkInvalidTokensAfterAT(); + $this->checkEmptyDomain(); + + if ($this->lexer->token['type'] === EmailLexer::S_OPENPARENTHESIS) { + $this->warnings[DeprecatedComment::CODE] = new DeprecatedComment(); + $this->parseDomainComments(); + } + } + + private function checkEmptyDomain() + { + $thereIsNoDomain = $this->lexer->token['type'] === EmailLexer::S_EMPTY || + ($this->lexer->token['type'] === EmailLexer::S_SP && + !$this->lexer->isNextToken(EmailLexer::GENERIC)); + + if ($thereIsNoDomain) { + throw new NoDomainPart(); + } + } + + private function checkInvalidTokensAfterAT() + { + if ($this->lexer->token['type'] === EmailLexer::S_DOT) { + throw new DotAtStart(); + } + if ($this->lexer->token['type'] === EmailLexer::S_HYPHEN) { + throw new DomainHyphened(); + } + } + public function getDomainPart() { return $this->domainPart; |
