SmtpTransportFactory::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Da\Mailer\Transport;
4
5
use Da\Mailer\Helper\ArrayHelper;
6
7
class SmtpTransportFactory extends AbstractTransportFactory
8
{
9
    /**
10
     * {@inheritdoc}
11 2
     */
12
    public function __construct(array $options)
13 2
    {
14 2
        parent::__construct($options);
15
    }
16
17
    /**
18
     * Creates a SmtpTransport.
19
     *
20
     * @return SmtpTransport the instance created
21 2
     */
22
    public function create()
23 2
    {
24 2
        $host = ArrayHelper::remove($this->options, 'host');
25 2
        $port = ArrayHelper::remove($this->options, 'port');
26
        $options = ArrayHelper::getValue($this->options, 'options', []);
27 2
        return new SmtpTransport($host, $port, $options);
28
    }
29
}
30