Integration::createSecureSocketConnector()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Helper;
4
5
use Kodus\Mail\SMTP\Authenticator\LoginAuthenticator;
6
use Kodus\Mail\SMTP\Connector\SecureSocketConnector;
7
use Kodus\Mail\SMTP\Connector\SocketConnector;
8
9
class Integration extends \Codeception\Module
10
{
11
    public function _before(\Codeception\TestInterface $test)
12
    {
13
        date_default_timezone_set("Europe/Copenhagen");
14
    }
15
16
    public function createSocketConnector(): SocketConnector
17
    {
18
        return new SocketConnector(
19
            $this->config["smtp_host"],
20
            $this->config["smtp_port"]
21
        );
22
    }
23
24
    public function createSecureSocketConnector(): SecureSocketConnector
25
    {
26
        return new SecureSocketConnector(
27
            $this->config["smtp_ssl_host"],
28
            $this->config["smtp_ssl_port"],
29
            constant($this->config["smtp_ssl_crypto"])
30
        );
31
    }
32
33
    public function createLoginAuthenticator(): LoginAuthenticator
34
    {
35
        return new LoginAuthenticator(
36
            $this->config["smtp_username"],
37
            $this->config["smtp_password"]
38
        );
39
    }
40
}
41