Passed
Push — master ( 6b1ba5...96756e )
by Derek Stephen
13:26
created

EmailMessage::setTo()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 2
dl 0
loc 4
ccs 0
cts 0
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Bone\Mail;
4
5
use Symfony\Component\Mime\Email;
6
7
class EmailMessage extends Email
8
{
9
    private array $viewData= [];
10
    private string $template = '';
11
12
    public function getViewData(): array
13
    {
14
        return $this->viewData;
15
    }
16
17
    public function setViewData(array $viewData): void
18 1
    {
19
        $this->viewData = $viewData;
20 1
    }
21
22
    public function getTemplate(): string
23
    {
24
        return $this->template;
25
    }
26 1
27
    public function setTemplate(string $template): void
28 1
    {
29
        $this->template = $template;
30
    }
31
32
    public function setFrom(string $email, ?string $name = null): void
33
    {
34 1
        $from = $name ? [$email => $name] : $email;
35
        $this->from($from);
0 ignored issues
show
Bug introduced by
It seems like $from can also be of type array<string,string>; however, parameter $addresses of Symfony\Component\Mime\Email::from() does only seem to accept Symfony\Component\Mime\Address|string, maybe add an additional type check? ( Ignorable by Annotation )

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

35
        $this->from(/** @scrutinizer ignore-type */ $from);
Loading history...
36 1
    }
37
38
    public function setTo(string $email, ?string $name = null): void
39
    {
40
        $to = $name ? [$email => $name] : $email;
41
        $this->to($to);
0 ignored issues
show
Bug introduced by
It seems like $to can also be of type array<string,string>; however, parameter $addresses of Symfony\Component\Mime\Email::to() does only seem to accept Symfony\Component\Mime\Address|string, maybe add an additional type check? ( Ignorable by Annotation )

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

41
        $this->to(/** @scrutinizer ignore-type */ $to);
Loading history...
42 1
    }
43
44 1
    public function setSubject(string $subject): void
45
    {
46
        $this->subject($subject);
47
    }
48
}
49