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