Passed
Push — develop ( 918c75...3b30cc )
by Daniel
01:42
created

MailMessageFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 7
dl 0
loc 22
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A createService() 0 14 2
1
<?php
2
/**
3
 * ZfMailer
4
 *
5
 * @author     Daniel Wolkenhauer <[email protected]>
6
 * @copyright  Copyright (c) 1997-2019 Daniel Wolkenhauer
7
 * @link       http://dw-labs.de/zfmailer
8
 * @version    0.1.0
9
 */
10
11
namespace ZfMailer\Service;
12
13
use Traversable;
14
use Zend\Mail\Message;
15
use Zend\ServiceManager\FactoryInterface;
16
use Zend\ServiceManager\ServiceLocatorInterface;
17
use Zend\Stdlib\ArrayUtils;
18
19
/**
20
* Message Factory
21
* Erstellt ein Mail-Objekt
22
* 
23
* @package ZfMailer
24
* @subpackage Service
25
*/
26
class MailMessageFactory implements FactoryInterface
27
{
28
29
  /**
30
   * Create Service Factory
31
   *
32
   * @param ServiceLocatorInterface $serviceLocator
33
   */
34 1
  public function createService(ServiceLocatorInterface $serviceLocator)
35
  {
36
37
    
38 1
    $options = $serviceLocator->get('ZfMailerOptions');
39 1
    $defaultEncoding = $options->getEncoding();
40
41 1
    $mailMessage = new Message();
42
43 1
    if (isset($defaultEncoding)) {
44 1
      $mailMessage->setEncoding($defaultEncoding);
45
    }
46
    
47 1
    return $mailMessage;
48
49
  }
50
51
}
52