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