Completed
Push — preview-1.19.0 ( c984f9...cb24ce )
by Guilherme
10:55
created

TwigSwiftMailer::sendAccountBlockedMessage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 1
dl 0
loc 9
ccs 0
cts 7
cp 0
crap 2
rs 9.6666
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of the login-cidadao project or it's bundles.
4
 *
5
 * (c) Guilherme Donato <guilhermednt on github>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace LoginCidadao\CoreBundle\Mailer;
12
13
use FOS\UserBundle\Mailer\TwigSwiftMailer as BaseMailer;
14
use FOS\UserBundle\Model\UserInterface;
15
use LoginCidadao\CoreBundle\Model\PersonInterface;
16
17
class TwigSwiftMailer extends BaseMailer
18
{
19
    protected $mailerSenderMail;
20
21
    public function setMailerSenderMail($var)
22
    {
23
        $this->mailerSenderMail = $var;
24
    }
25
26
    public function sendEmailChangedMessage(UserInterface $user, $oldEmail)
27
    {
28
        $template = $this->parameters['template']['email_changed'];
29
        $fromEmail = $this->parameters['from_email']['email_changed'];
30
        $fromName = $this->parameters['from_email']['email_sender_name'];
31
        $from = [$fromEmail => $fromName];
32
33
        $context = [
34
            'user' => $user,
35
            'oldEmail' => $oldEmail,
36
        ];
37
38
        $this->sendMessage($template, $context, $from, $oldEmail);
0 ignored issues
show
Bug introduced by
$from of type array is incompatible with the type string expected by parameter $fromEmail of FOS\UserBundle\Mailer\Tw...ftMailer::sendMessage(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

38
        $this->sendMessage($template, $context, /** @scrutinizer ignore-type */ $from, $oldEmail);
Loading history...
39
    }
40
41
    public function sendAccountBlockedMessage(PersonInterface $person)
42
    {
43
        $template = $this->parameters['template']['account_blocked'];
44
        $fromEmail = $this->parameters['from_email']['account_blocked'];
45
        $fromName = $this->parameters['from_email']['email_sender_name'];
46
        $from = [$fromEmail => $fromName];
47
48
        $context = ['email' => $person->getEmail()];
49
        $this->sendMessage($template, $context, $from, $person->getEmail());
0 ignored issues
show
Bug introduced by
$from of type array is incompatible with the type string expected by parameter $fromEmail of FOS\UserBundle\Mailer\Tw...ftMailer::sendMessage(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

49
        $this->sendMessage($template, $context, /** @scrutinizer ignore-type */ $from, $person->getEmail());
Loading history...
50
    }
51
}
52