Code Duplication    Length = 7-12 lines in 2 locations

src/Email/Swift3.php 1 location

@@ 31-42 (lines=12) @@
28
    {
29
        if(is_null($this->mailer))
30
        {
31
            if (isset($this->config['type']) && $this->config['type'] == 'smtp') {
32
33
                $transport = new \Swift_Connection_SMTP(
34
                    $this->config['smtp_options']['host'],
35
                    $this->config['smtp_options']['port']
36
                );
37
                
38
                $transport->setUsername($this->config['smtp_options']['connection_config']['username']);
39
                $transport->setPassword($this->config['smtp_options']['connection_config']['password']);
40
            } else {
41
                $transport = new \Swift_Connection_NativeMail();
42
            }
43
            
44
            $this->mailer = new \Swift($transport);
45
        }

src/Email/Swift5.php 1 location

@@ 50-56 (lines=7) @@
47
    {
48
        if(is_null($this->mailer))
49
        {
50
            if (isset($this->config['type']) && $this->config['type'] == 'smtp') {
51
                $transport = \Swift_SmtpTransport::newInstance($this->config['smtp_options']['host'], $this->config['smtp_options']['port']);
52
                $transport->setUsername($this->config['smtp_options']['connection_config']['username']);
53
                $transport->setPassword($this->config['smtp_options']['connection_config']['password']);
54
            } else {
55
                $transport = \Swift_MailTransport::newInstance();
56
            }
57
            
58
            $this->mailer = \Swift_Mailer::newInstance($transport);
59
            $this->mailer_logger = new \Swift_Plugins_Loggers_ArrayLogger();