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

MtMailPlugin::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 11
ccs 8
cts 8
cp 1
rs 9.4285
cc 2
eloc 6
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 MtMail\Controller\Plugin\MtMail;
14
use MtMail\Service\Mail;
15
16
class MtMailPlugin
17
{
18 1
    public function __invoke(ContainerInterface $serviceLocator)
19
    {
20 1
        if (!method_exists($serviceLocator, 'configure')) {
21 1
            $serviceLocator = $serviceLocator->getServiceLocator();
22 1
        }
23 1
        $service = new MtMail(
24 1
            $serviceLocator->get(Mail::class)
25 1
        );
26
27 1
        return $service;
28
    }
29
}
30