Issues (5)

src/Service/MailMessageFactory.php (1 issue)

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    3.0.0
9
 */
10
11
namespace ZfMailer\Service;
12
13
use Traversable;
14
use Zend\Mail\Message;
15
use Interop\Container\ContainerInterface;
16
use Interop\Container\Exception\ContainerException;
17
use Zend\ServiceManager\Factory\FactoryInterface;
18
use Zend\ServiceManager\ServiceLocatorInterface;
19
use Zend\Stdlib\ArrayUtils;
20
21
/**
22
* Message Factory
23
* Erstellt ein Mail-Objekt
24
* 
25
* @package ZfMailer
26
* @subpackage Service
27
*/
28
class MailMessageFactory implements FactoryInterface
29
{
30
31
  public function __invoke(ContainerInterface $serviceManager, $requestedName, array $options = null)
32
  {
33
34
    $options = $serviceManager->get('ZfMailerOptions');
0 ignored issues
show
The assignment to $options is dead and can be removed.
Loading history...
35
    // $defaultEncoding = $options->getEncoding();
36
37
    $mailMessage = new Message();
38
39
    // TODO: prüfen, wie Encoding richtig gesetzt werden kann (Sonderzeichen im Header)
40
    // if (isset($defaultEncoding)) {
41
    //   $mailMessage->setEncoding($defaultEncoding);
42
    // }
43
    
44
    return $mailMessage;
45
46
  }
47
48
  /**
49
   * Create Service Factory
50
   *
51
   * @param ServiceLocatorInterface $serviceLocator
52
   */
53 1
  public function createService(ServiceLocatorInterface $serviceLocator)
54
  {
55
    
56
    // $options = $serviceLocator->get('ZfMailerOptions');
57
    // // $defaultEncoding = $options->getEncoding();
58
59
    // $mailMessage = new Message();
60
61
    // // TODO: prüfen, wie Encoding richtig gesetzt werden kann (Sonderzeichen im Header)
62
    // // if (isset($defaultEncoding)) {
63
    // //   $mailMessage->setEncoding($defaultEncoding);
64
    // // }
65
    
66
    // return $mailMessage;
67 1
    return $this->__invoke($serviceLocator, null);
68
69
  }
70
71
}
72