1 | <?php |
||
13 | final class Session |
||
14 | { |
||
15 | |||
16 | /** |
||
17 | * |
||
18 | */ |
||
19 | public CONST STATE_CONNECTED = 0; |
||
20 | /** |
||
21 | * |
||
22 | */ |
||
23 | public CONST STATE_EHLO = 1; |
||
24 | /** |
||
25 | * |
||
26 | */ |
||
27 | public CONST STATE_NEGOTIATION = 2; |
||
28 | /** |
||
29 | * |
||
30 | */ |
||
31 | public CONST STATE_AUTHENTICATED = 3; |
||
32 | /** |
||
33 | * |
||
34 | */ |
||
35 | public CONST STATE_MESSAGE = 4; |
||
36 | /** |
||
37 | * |
||
38 | */ |
||
39 | public CONST STATE_MESSAGE_RECEIVED = 5; |
||
40 | /** |
||
41 | * |
||
42 | */ |
||
43 | public CONST STATE_DISCONNECT = 6; |
||
44 | |||
45 | /** |
||
46 | * @var int |
||
47 | */ |
||
48 | private $state = self::STATE_CONNECTED; |
||
49 | /** |
||
50 | * @var string |
||
51 | */ |
||
52 | private $command; |
||
53 | /** |
||
54 | * @var MessageInterface |
||
55 | */ |
||
56 | private $message; |
||
57 | /** |
||
58 | * @var EmailAddress |
||
59 | */ |
||
60 | private $envelope; |
||
61 | /** |
||
62 | * @var EmailAddress[] |
||
63 | */ |
||
64 | private $recipients = []; |
||
65 | |||
66 | /** |
||
67 | * @param int $state |
||
68 | * @return Session |
||
69 | */ |
||
70 | 8 | public function withState(int $state): self |
|
76 | |||
77 | /** |
||
78 | * @param string $command |
||
79 | * @return Session |
||
80 | */ |
||
81 | 10 | public function withCommand(string $command): self |
|
87 | |||
88 | /** |
||
89 | * @param EmailAddress $envelope |
||
90 | * @return Session |
||
91 | */ |
||
92 | 3 | public function withEnvelope(EmailAddress $envelope): self |
|
99 | |||
100 | /** |
||
101 | * @param EmailAddress $recipient |
||
102 | * @return Session |
||
103 | */ |
||
104 | 4 | public function withRecipient(EmailAddress $recipient): self |
|
111 | |||
112 | /** |
||
113 | * @param MessageInterface $message |
||
114 | * @return Session |
||
115 | */ |
||
116 | 4 | public function withMessage(MessageInterface $message): self |
|
123 | |||
124 | /** |
||
125 | * @return string |
||
126 | */ |
||
127 | 10 | public function getCommand(): string |
|
135 | |||
136 | /** |
||
137 | * @return int |
||
138 | */ |
||
139 | 19 | public function getState(): int |
|
143 | |||
144 | /** |
||
145 | * @return array|EmailAddress[] |
||
146 | */ |
||
147 | 3 | public function getRecipients(): array |
|
151 | |||
152 | /** |
||
153 | * @return MessageInterface |
||
154 | */ |
||
155 | 2 | public function getMessage(): MessageInterface |
|
163 | |||
164 | /** |
||
165 | * @return EmailAddress |
||
166 | */ |
||
167 | 2 | public function getEnvelope(): EmailAddress |
|
175 | } |
||
176 |