| @@ 34-39 (lines=6) @@ | ||
| 31 | ||
| 32 | public function parse() : Result |
|
| 33 | { |
|
| 34 | if ($this->lexer->token['type'] === EmailLexer::S_OPENPARENTHESIS) { |
|
| 35 | $this->openedParenthesis++; |
|
| 36 | if($this->noClosingParenthesis()) { |
|
| 37 | return new InvalidEmail(new UnclosedComment(), $this->lexer->token['value']); |
|
| 38 | } |
|
| 39 | } |
|
| 40 | ||
| 41 | if ($this->lexer->token['type'] === EmailLexer::S_CLOSEPARENTHESIS) { |
|
| 42 | return new InvalidEmail(new UnOpenedComment(), $this->lexer->token['value']); |
|
| @@ 284-289 (lines=6) @@ | ||
| 281 | ||
| 282 | private function checkLabelLength(bool $isEndOfDomain = false) : Result |
|
| 283 | { |
|
| 284 | if ($this->lexer->token['type'] === EmailLexer::S_DOT || $isEndOfDomain) { |
|
| 285 | if ($this->isLabelTooLong($this->label)) { |
|
| 286 | $this->label = ''; |
|
| 287 | return new InvalidEmail(new LabelTooLong(), $this->lexer->token['value']); |
|
| 288 | } |
|
| 289 | } |
|
| 290 | $this->label .= $this->lexer->token['value']; |
|
| 291 | return new ValidEmail(); |
|
| 292 | } |
|