Completed
Push — master ( 7ee0d9...1aff7f )
by Rafał
24:06 queued 15:30
created

ReportMailer::sendReportReadyEmailNotification()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Superdesk Web Publisher Core Bundle.
7
 *
8
 * Copyright 2020 Sourcefabric z.ú. and contributors.
9
 *
10
 * For the full copyright and license information, please see the
11
 * AUTHORS and LICENSE files distributed with this source code.
12
 *
13
 * @copyright 2020 Sourcefabric z.ú
14
 * @license http://www.superdesk.org/license
15
 */
16
17
namespace SWP\Bundle\CoreBundle\AnalyticsExport;
18
19
use Symfony\Component\Mailer\MailerInterface;
20
use Symfony\Component\Mime\Email;
21
22
final class ReportMailer
23
{
24
    /** @var MailerInterface */
25
    private $mailer;
26
27
    /** @var string */
28
    private $fromEmail;
29
30
    public function __construct(MailerInterface $mailer, string $fromEmail)
31
    {
32
        $this->mailer = $mailer;
33
        $this->fromEmail = $fromEmail;
34
    }
35
36
    public function sendReportReadyEmailNotification(string $email, string $reportUrl): void
37
    {
38
        $emailObject = (new Email())
39
            ->from($this->fromEmail)
40
            ->to($email)
41
            ->subject('Your report is ready!')
42
            ->text("You can download your report here $reportUrl");
43
44
        $this->mailer->send($emailObject);
45
    }
46
}
47