Total Complexity | 9 |
Total Lines | 70 |
Duplicated Lines | 0 % |
Coverage | 59.09% |
Changes | 0 |
1 | <?php |
||
20 | class MailerTransport implements \Swift_Transport |
||
21 | { |
||
22 | /** |
||
23 | * @var MailerInterface |
||
24 | */ |
||
25 | protected $mailer; |
||
26 | |||
27 | /** |
||
28 | * FileTransport constructor. |
||
29 | * @param MailerInterface $mailer |
||
30 | */ |
||
31 | 5 | public function __construct(MailerInterface $mailer) |
|
32 | { |
||
33 | 5 | $this->mailer = $mailer; |
|
34 | 5 | } |
|
35 | |||
36 | /** |
||
37 | * @inheritdoc |
||
38 | */ |
||
39 | 5 | public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) |
|
40 | { |
||
41 | 5 | if (!$message instanceof \Swift_Message) { |
|
42 | throw new InvalidParamException('The message should be an instance of "Swift_Message".'); |
||
43 | } |
||
44 | 5 | $failedRecipients = (array) $failedRecipients; |
|
45 | 5 | $importedMessage = new ImportedMessage($message); |
|
46 | |||
47 | 5 | if ($this->mailer->send($importedMessage)) { |
|
48 | 4 | return count($importedMessage->getTo()); |
|
49 | } else { |
||
50 | 1 | $failedRecipients = (array) $importedMessage->getTo(); |
|
51 | 1 | return 0; |
|
52 | } |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @inheritdoc |
||
57 | */ |
||
58 | 3 | public function isStarted() |
|
59 | { |
||
60 | 3 | return true; |
|
61 | } |
||
62 | |||
63 | /** |
||
64 | * @inheritdoc |
||
65 | */ |
||
66 | public function start() |
||
67 | { |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * @inheritdoc |
||
72 | */ |
||
73 | public function stop() |
||
74 | { |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * @inheritdoc |
||
79 | */ |
||
80 | public function registerPlugin(Swift_Events_EventListener $plugin) |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * @inheritdoc |
||
86 | */ |
||
87 | public function ping() |
||
90 | } |
||
91 | } |
||
92 |