| @@ 38-44 (lines=7) @@ | ||
| 35 | ||
| 36 | abstract public function parse() : Result; |
|
| 37 | ||
| 38 | protected function parseFWS() : Result |
|
| 39 | { |
|
| 40 | $foldingWS = new FoldingWhiteSpace($this->lexer); |
|
| 41 | $resultFWS = $foldingWS->parse(); |
|
| 42 | $this->warnings = array_merge($this->warnings, $foldingWS->getWarnings()); |
|
| 43 | return $resultFWS; |
|
| 44 | } |
|
| 45 | ||
| 46 | protected function checkConsecutiveDots() : Result |
|
| 47 | { |
|
| @@ 96-105 (lines=10) @@ | ||
| 93 | return new ValidEmail(); |
|
| 94 | } |
|
| 95 | ||
| 96 | private function parseLocalFWS() : Result |
|
| 97 | { |
|
| 98 | $foldingWS = new FoldingWhiteSpace($this->lexer); |
|
| 99 | $resultFWS = $foldingWS->parse(); |
|
| 100 | if ($resultFWS->isValid()) { |
|
| 101 | $this->warnings = array_merge($this->warnings, $foldingWS->getWarnings()); |
|
| 102 | } |
|
| 103 | return $resultFWS; |
|
| 104 | } |
|
| 105 | ||
| 106 | private function hasDotAtStart() : bool |
|
| 107 | { |
|
| 108 | return $this->lexer->token['type'] === EmailLexer::S_DOT && null === $this->lexer->getPrevious()['type']; |
|
| @@ 111-118 (lines=8) @@ | ||
| 108 | return $this->lexer->token['type'] === EmailLexer::S_DOT && null === $this->lexer->getPrevious()['type']; |
|
| 109 | } |
|
| 110 | ||
| 111 | private function parseDoubleQuote() : Result |
|
| 112 | { |
|
| 113 | $dquoteParser = new DoubleQuote($this->lexer); |
|
| 114 | $parseAgain = $dquoteParser->parse(); |
|
| 115 | $this->warnings = array_merge($this->warnings, $dquoteParser->getWarnings()); |
|
| 116 | ||
| 117 | return $parseAgain; |
|
| 118 | } |
|
| 119 | ||
| 120 | private function parseComments(): Result |
|
| 121 | { |
|
| @@ 120-129 (lines=10) @@ | ||
| 117 | return $parseAgain; |
|
| 118 | } |
|
| 119 | ||
| 120 | private function parseComments(): Result |
|
| 121 | { |
|
| 122 | $commentParser = new Comment($this->lexer, new LocalComment()); |
|
| 123 | $result = $commentParser->parse(); |
|
| 124 | $this->warnings = array_merge($this->warnings, $commentParser->getWarnings()); |
|
| 125 | if($result->isInvalid()) { |
|
| 126 | return $result; |
|
| 127 | } |
|
| 128 | return $result; |
|
| 129 | } |
|
| 130 | ||
| 131 | private function validateEscaping() : Result |
|
| 132 | { |
|
| @@ 130-137 (lines=8) @@ | ||
| 127 | return $this->domainPart; |
|
| 128 | } |
|
| 129 | ||
| 130 | protected function parseComments(): Result |
|
| 131 | { |
|
| 132 | $commentParser = new Comment($this->lexer, new DomainComment()); |
|
| 133 | $result = $commentParser->parse(); |
|
| 134 | $this->warnings = array_merge($this->warnings, $commentParser->getWarnings()); |
|
| 135 | ||
| 136 | return $result; |
|
| 137 | } |
|
| 138 | ||
| 139 | protected function doParseDomainPart() : Result |
|
| 140 | { |
|