Completed
Push — develop ( 9a63dd...a5c294 )
by
unknown
09:36
created

MailServiceFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 3
Bugs 1 Features 0
Metric Value
wmc 2
c 3
b 1
f 0
lcom 0
cbo 4
dl 0
loc 31
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B createService() 0 24 2
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @copyright (c) 2013-2015 Cross Solution (http://cross-solution.de)
7
 * @license   MIT
8
 */
9
10
/** MailServiceFactory.php */
11
namespace Core\Mail;
12
13
use Zend\ServiceManager\FactoryInterface;
14
use Zend\ServiceManager\ServiceLocatorInterface;
15
16
class MailServiceFactory implements FactoryInterface
17
{
18
     
19
    /* (non-PHPdoc)
20
     * @see \Zend\ServiceManager\FactoryInterface::createService()
21
     */
22
    public function createService(ServiceLocatorInterface $serviceLocator)
23
    {
24
25
        $config = $serviceLocator->get('Config');
26
        $mails = isset($config['mails']) ? $config['mails'] : [];
27
28
        /* @var \Auth\Options\ModuleOptions $authOptions */
29
        $authOptions = $serviceLocator->get('Auth\Options');
30
        $configArray=[
31
                'from' => [
32
                    'name' => $authOptions->getFromName(),
33
                    'email' => $authOptions->getFromEmail()
34
                ],
35
        ];
36
37
        $configArray += $mails;
38
39
        $config      = new MailServiceConfig($configArray);
40
41
        $service   = new MailService($config);
42
43
        return $service;
44
45
    }
46
}
47