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