1 | <?php |
||
21 | final class ClientFactory |
||
22 | { |
||
23 | /** |
||
24 | * |
||
25 | */ |
||
26 | private CONST AUTH_ENUM = [Client::AUTH_NONE, Client::AUTH_PLAIN, Client::AUTH_LOGIN, Client::AUTH_AUTO]; |
||
27 | /** |
||
28 | * @var ConnectionInterface |
||
29 | */ |
||
30 | private $connection; |
||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | private $password = ''; |
||
35 | /** |
||
36 | * @var float |
||
37 | */ |
||
38 | private $timeout = 1; |
||
39 | /** |
||
40 | * @var string |
||
41 | */ |
||
42 | private $username = ''; |
||
43 | /** |
||
44 | * @var string |
||
45 | */ |
||
46 | private $ehlo = '127.0.0.1'; |
||
47 | /** |
||
48 | * @var int |
||
49 | */ |
||
50 | private $authMethod = Client::AUTH_NONE; |
||
51 | /** |
||
52 | * @var bool |
||
53 | */ |
||
54 | private $insecureConnectionAllowed = false; |
||
55 | /** |
||
56 | * @var bool |
||
57 | */ |
||
58 | private $rfc821ConnectionAllowed = false; |
||
59 | /** |
||
60 | * @var string |
||
61 | */ |
||
62 | private $reconnectAfter = 'PT300S'; |
||
63 | /** |
||
64 | * @var int |
||
65 | */ |
||
66 | private $startTls; |
||
67 | |||
68 | /** |
||
69 | * ClientFactory constructor. |
||
70 | * @param ConnectionInterface $connection |
||
71 | */ |
||
72 | 10 | public function __construct(ConnectionInterface $connection) |
|
77 | |||
78 | /** |
||
79 | * @param float $connectionTimeout |
||
80 | * @return ClientFactory |
||
81 | */ |
||
82 | 1 | public function withTimeout(float $connectionTimeout): ClientFactory |
|
88 | |||
89 | /** |
||
90 | * @param int $method |
||
91 | * @param string $password |
||
92 | * @param string $username |
||
93 | * @return ClientFactory |
||
94 | */ |
||
95 | 3 | public function withAuthentication(int $method, string $username, string $password): ClientFactory |
|
107 | |||
108 | /** |
||
109 | * @param string $ehlo |
||
110 | * @return ClientFactory |
||
111 | */ |
||
112 | 4 | public function withEhlo(string $ehlo): ClientFactory |
|
118 | |||
119 | /** |
||
120 | * @return ClientFactory |
||
121 | */ |
||
122 | 2 | public function withInsecureConnectionAllowed(): ClientFactory |
|
128 | |||
129 | /** |
||
130 | * @return ClientFactory |
||
131 | */ |
||
132 | 1 | public function withRfc821ConnectionAllowed(): ClientFactory |
|
138 | |||
139 | /** |
||
140 | * @param int $crypto |
||
141 | * @return ClientFactory |
||
142 | */ |
||
143 | 1 | public function withStartTls(int $crypto): ClientFactory |
|
149 | |||
150 | /** |
||
151 | * @return ClientFactory |
||
152 | */ |
||
153 | 1 | public function withoutStartTls(): ClientFactory |
|
159 | |||
160 | /** |
||
161 | * @return Client |
||
162 | */ |
||
163 | 8 | public function newClient(): Client |
|
206 | |||
207 | /** |
||
208 | * @param string $dataSourceName |
||
209 | * @return ClientFactory |
||
210 | */ |
||
211 | 7 | public static function fromString(string $dataSourceName):ClientFactory |
|
284 | } |
||
285 |