| @@ 231-233 (lines=3) @@ | ||
| 228 | return new InvalidEmail(new ExpectingATEXT('OPENBRACKET not after AT'), $this->lexer->token['value']); |
|
| 229 | } |
|
| 230 | ||
| 231 | if ($this->lexer->token['type'] === EmailLexer::S_HYPHEN && $this->lexer->isNextToken(EmailLexer::S_DOT)) { |
|
| 232 | return new InvalidEmail(new DomainHyphened('Hypen found near DOT'), $this->lexer->token['value']); |
|
| 233 | } |
|
| 234 | ||
| 235 | if ($this->lexer->token['type'] === EmailLexer::S_BACKSLASH |
|
| 236 | && $this->lexer->isNextToken(EmailLexer::GENERIC)) { |
|
| @@ 235-238 (lines=4) @@ | ||
| 232 | return new InvalidEmail(new DomainHyphened('Hypen found near DOT'), $this->lexer->token['value']); |
|
| 233 | } |
|
| 234 | ||
| 235 | if ($this->lexer->token['type'] === EmailLexer::S_BACKSLASH |
|
| 236 | && $this->lexer->isNextToken(EmailLexer::GENERIC)) { |
|
| 237 | return new InvalidEmail(new ExpectingATEXT('Escaping following "ATOM"'), $this->lexer->token['value']); |
|
| 238 | } |
|
| 239 | ||
| 240 | return new ValidEmail(); |
|
| 241 | } |
|
| @@ 36-38 (lines=3) @@ | ||
| 33 | return new InvalidEmail(new AtextAfterCFWS(), $this->lexer->token['value']); |
|
| 34 | } |
|
| 35 | ||
| 36 | if ($this->lexer->token['type'] === EmailLexer::S_LF || $this->lexer->token['type'] === EmailLexer::C_NUL) { |
|
| 37 | return new InvalidEmail(new ExpectingCTEXT(), $this->lexer->token['value']); |
|
| 38 | } |
|
| 39 | ||
| 40 | if ($this->lexer->isNextToken(EmailLexer::S_AT) || $previous['type'] === EmailLexer::S_AT) { |
|
| 41 | $this->warnings[CFWSNearAt::CODE] = new CFWSNearAt(); |
|
| @@ 57-59 (lines=3) @@ | ||
| 54 | } |
|
| 55 | } |
|
| 56 | ||
| 57 | if ($this->lexer->token['type'] === EmailLexer::S_DOT && $this->lexer->isNextToken(EmailLexer::S_DOT)) { |
|
| 58 | return new InvalidEmail(new ConsecutiveDot(), $this->lexer->token['value']); |
|
| 59 | } |
|
| 60 | ||
| 61 | if ($this->lexer->token['type'] === EmailLexer::S_DOT && |
|
| 62 | $this->lexer->isNextToken(EmailLexer::S_AT) |
|
| @@ 61-65 (lines=5) @@ | ||
| 58 | return new InvalidEmail(new ConsecutiveDot(), $this->lexer->token['value']); |
|
| 59 | } |
|
| 60 | ||
| 61 | if ($this->lexer->token['type'] === EmailLexer::S_DOT && |
|
| 62 | $this->lexer->isNextToken(EmailLexer::S_AT) |
|
| 63 | ) { |
|
| 64 | return new InvalidEmail(new DotAtEnd(), $this->lexer->token['value']); |
|
| 65 | } |
|
| 66 | ||
| 67 | $resultEscaping = $this->validateEscaping(); |
|
| 68 | if ($resultEscaping->isInvalid()) { |
|
| @@ 48-50 (lines=3) @@ | ||
| 45 | ||
| 46 | protected function checkConsecutiveDots() : Result |
|
| 47 | { |
|
| 48 | if ($this->lexer->token['type'] === EmailLexer::S_DOT && $this->lexer->isNextToken(EmailLexer::S_DOT)) { |
|
| 49 | return new InvalidEmail(new ConsecutiveDot(), $this->lexer->token['value']); |
|
| 50 | } |
|
| 51 | ||
| 52 | return new ValidEmail(); |
|
| 53 | } |
|