Passed
Push — release ( 33e265...632ae2 )
by Mateusz
14:41 queued 11:19
created

MessageEncodingPluginFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 75%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 16
ccs 6
cts 8
cp 0.75
rs 10
c 2
b 0
f 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 13 3
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 MtMail\ComposerPlugin\MessageEncoding;
14
15
class MessageEncodingPluginFactory
16
{
17 3
    public function __invoke(ContainerInterface $serviceLocator)
18
    {
19 3
        if (!method_exists($serviceLocator, 'configure')) {
20
            $serviceLocator = $serviceLocator->getServiceLocator();
21
        }
22 3
        $config = $serviceLocator->get('Configuration');
23 3
        $plugin = new MessageEncoding();
24 3
        if (isset($config['mt_mail']['message_encoding'])) {
25
            $plugin->setEncoding($config['mt_mail']['message_encoding']);
26
        }
27
28 3
        return $plugin;
29
    }
30
}
31