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 | * @return string |
||
68 | */ |
||
69 | public function getCommand(): string |
||
73 | |||
74 | /** |
||
75 | * @return int |
||
76 | */ |
||
77 | public function getState(): int |
||
81 | |||
82 | /** |
||
83 | * @param int $state |
||
84 | * @return Session |
||
85 | */ |
||
86 | public function withState(int $state): self |
||
92 | |||
93 | /** |
||
94 | * @param string $command |
||
95 | * @return Session |
||
96 | */ |
||
97 | public function withCommand(string $command): self |
||
103 | |||
104 | /** |
||
105 | * @param EmailAddress $envelope |
||
106 | * @return Session |
||
107 | */ |
||
108 | public function withEnvelope(EmailAddress $envelope): self |
||
115 | |||
116 | /** |
||
117 | * @param EmailAddress $recipient |
||
118 | * @return Session |
||
119 | */ |
||
120 | public function withRecipient(EmailAddress $recipient): self |
||
127 | |||
128 | /** |
||
129 | * @param MessageInterface $message |
||
130 | * @return Session |
||
131 | */ |
||
132 | public function withMessage(MessageInterface $message): self |
||
139 | |||
140 | /** |
||
141 | * @return array|EmailAddress[] |
||
142 | */ |
||
143 | public function getRecipients(): array |
||
147 | |||
148 | /** |
||
149 | * @return MessageInterface |
||
150 | */ |
||
151 | public function getMessage(): MessageInterface |
||
159 | |||
160 | /** |
||
161 | * @return EmailAddress |
||
162 | */ |
||
163 | public function getEnvelope(): EmailAddress |
||
171 | } |
||
172 |