Total Complexity | 5 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class SmtpTransport implements TransportInterface |
||
10 | { |
||
11 | /** |
||
12 | * @var EsmtpTransport |
||
13 | */ |
||
14 | private $instance; |
||
15 | /** |
||
16 | * @var string the mail server host name or ip |
||
17 | */ |
||
18 | private $host; |
||
19 | /** |
||
20 | * @var int the mail server port |
||
21 | */ |
||
22 | private $port; |
||
23 | /** |
||
24 | * @var array the extra options for the Smtp transport -ie username, password, encryption, authMode |
||
25 | */ |
||
26 | private $options = []; |
||
27 | /** |
||
28 | * SmtpTransport constructor. |
||
29 | * |
||
30 | * @param string $host the mail server name or ip address |
||
31 | * @param int $port the mail server port |
||
32 | 2 | * @param array $options the extra options |
|
33 | */ |
||
34 | 2 | public function __construct($host = 'localhost', $port = 25, $options = []) |
|
39 | } |
||
40 | |||
41 | /** |
||
42 | * @return EsmtpTransport |
||
43 | */ |
||
44 | 1 | public function getInstance(): EsmtpTransport |
|
45 | { |
||
46 | 1 | if ($this->instance === null) { |
|
47 | 1 | $user = $this->options['username'] ?? null; |
|
48 | 1 | $password = $this->options['password'] ?? null; |
|
49 | 1 | $this->instance = (new EsmtpTransportFactory())->create(new Dsn('smtp', $this->host, $user, $password, $this->port, $this->options)); |
|
50 | 1 | } |
|
51 | 1 | ||
52 | return $this->instance; |
||
53 | 1 | } |
|
54 | |||
55 | private function getScheme() |
||
60 | } |
||
61 | } |
||
62 |
This check looks for private methods that have been defined, but are not used inside the class.