Test Failed
Branch master (354693)
by Valery
12:29
created

SwiftMailerAdapter::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Mailer\Sender\Adapter;
6
7
use Swift_Message;
8
9
final class SwiftMailerAdapter implements SenderAdapterInterface
10
{
11
    /**
12
     * @var \Swift_Mailer
13
     */
14
    private $mailer;
15
16
    public function __construct(\Swift_Mailer $mailer)
17
    {
18
        $this->mailer = $mailer;
19
    }
20
21
    public function send(string $fromName, string $fromEmail, string $toEmail, string $subject, string $body): void
22
    {
23
        // Create a message
24
        $message = (new Swift_Message($subject))
25
            ->setFrom([$fromEmail => $fromName])
26
            ->setTo([$toEmail])
27
            ->setReplyTo([$fromEmail])
28
            ->setBody($body);
29
30
        // Send the message
31
        $this->mailer->send($message);
32
    }
33
}
34