TemplateManagerFactory::__invoke()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

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