Passed
Push — v3_compat ( af37b8...c7ae23 )
by Mateusz
03:38
created

FileTransportFactory::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
ccs 7
cts 7
cp 1
rs 9.4285
cc 2
eloc 7
nc 2
nop 1
crap 2
1
<?php
2
/**
3
 * MtMail - e-mail module for Zend Framework 2
4
 *
5
 * @link      http://github.com/mtymek/MtMail
6
 * @copyright Copyright (c) 2013-2014 Mateusz Tymek
7
 * @license   BSD 2-Clause
8
 */
9
10
namespace MtMail\Factory;
11
12
use Interop\Container\ContainerInterface;
13
use Zend\Mail\Transport\File;
14
use Zend\Mail\Transport\FileOptions;
15
16
class FileTransportFactory
17
{
18 2
    public function __invoke(ContainerInterface $serviceLocator)
19
    {
20 2
        $configuration = $serviceLocator->get('Configuration');
21 2
        $serviceConfig = isset($configuration['mt_mail']['transport_options'])
22 2
            ? $configuration['mt_mail']['transport_options'] : [];
23 2
        $options = new FileOptions($serviceConfig);
24 2
        $file = new File($options);
25
26 2
        return $file;
27
    }
28
}
29