Conditions | 3 |
Paths | 7 |
Total Lines | 17 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
34 | 3 | public function manifest(ConnectionInterface $connection, Session $session): Session |
|
35 | { |
||
36 | try { |
||
37 | 3 | $address = new EmailAddress(substr($session->getCommand(), 9, -1)); |
|
38 | |||
39 | 2 | if ($this->backend->contains($address) === false) { |
|
40 | 1 | $connection->send('550 Unknown mailbox'); |
|
41 | 1 | return $session; |
|
42 | } |
||
43 | |||
44 | 1 | $connection->send('250 OK'); |
|
45 | 1 | return $session->withRecipient($address); |
|
46 | 1 | } catch (\InvalidArgumentException $e) { |
|
47 | 1 | $connection->send('501 Invalid recipient'); |
|
48 | 1 | return $session; |
|
49 | } |
||
50 | } |
||
51 | |||
59 | } |