| Conditions | 3 |
| Paths | 5 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3.1825 |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | 9 | public function isValid(string $email, EmailLexer $emailLexer): bool |
|
| 24 | { |
||
| 25 | 9 | $parser = new MessageIDParser($emailLexer); |
|
| 26 | try { |
||
| 27 | 9 | $result = $parser->parse($email); |
|
| 28 | 9 | $this->warnings = $parser->getWarnings(); |
|
| 29 | 9 | if ($result->isInvalid()) { |
|
| 30 | /** @psalm-suppress PropertyTypeCoercion */ |
||
| 31 | 6 | $this->error = $result; |
|
| 32 | 9 | return false; |
|
| 33 | } |
||
| 34 | } catch (\Exception $invalid) { |
||
| 35 | $this->error = new InvalidEmail(new ExceptionFound($invalid), ''); |
||
| 36 | return false; |
||
| 37 | } |
||
| 38 | |||
| 39 | 3 | return true; |
|
| 40 | } |
||
| 41 | |||
| 52 |