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