GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 3cb483...8395e3 )
by Alex
02:43
created

Mail::setId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Conversio\Mail;
4
5
use Conversio\Mail\Address\Address;
6
use Conversio\Mail\Address\AddressContainer;
7
use Conversio\Mail\Attachment\AttachmentContainer;
8
use DateTime;
9
use Exception;
10
11
/**
12
 * Class Mail
13
 * @package Conversio\Mail
14
 */
15
class Mail
16
{
17
    /**
18
     * @var string $id
19
     */
20
    private $id = '';
21
22
    /**
23
     * @var Address
24
     */
25
    private $sender;
26
27
    /**
28
     * @var string
29
     */
30
    private $subject = '';
31
32
    /**
33
     * @var Content
34
     */
35
    private $content;
36
37
    /**
38
     * @var AddressContainer
39
     */
40
    private $recipients;
41
42
    /**
43
     * @var AddressContainer
44
     */
45
    private $ccs;
46
47
    /**
48
     * @var AddressContainer
49
     */
50
    private $bccs;
51
52
    /**
53
     * @var AttachmentContainer
54
     */
55
    private $attachments;
56
57
    /**
58
     * @var DateTime
59
     */
60
    private $createdAt;
61
62
    /**
63
     * @var AddressContainer
64
     */
65
    private $replyTos;
66
67
    /**
68
     * Mail constructor.
69
     *
70
     * @param DateTime|null $createdAt
71
     */
72 20
    public function __construct(DateTime $createdAt = null)
73
    {
74 20
        $this->content     = new Content();
75 20
        $this->recipients  = new AddressContainer();
76 20
        $this->ccs         = new AddressContainer();
77 20
        $this->bccs        = new AddressContainer();
78 20
        $this->replyTos    = new AddressContainer();
79 20
        $this->attachments = new AttachmentContainer();
80 20
        $this->createdAt   = $createdAt !== null ? $createdAt : new DateTime();
81 20
    }
82
83
    /**
84
     * @param Address $sender
85
     */
86 2
    public function setSender(Address $sender)
87
    {
88 2
        $this->sender = $sender;
89 2
    }
90
91
    /**
92
     * @return Address
93
     * @throws Exception
94
     */
95 2
    public function sender(): Address
96
    {
97 2
        if (!$this->isSenderSet()) {
98
            throw new Exception('There is no sender given');
99
        }
100
101 2
        return $this->sender;
102
    }
103
104
    /**
105
     * @return bool
106
     */
107 2
    public function isSenderSet(): bool
108
    {
109 2
        return $this->sender !== null;
110
    }
111
112
    /**
113
     * @return Content
114
     */
115 3
    public function content(): Content
116
    {
117 3
        return $this->content;
118
    }
119
120
    /**
121
     * @return AddressContainer
122
     */
123 1
    public function recipients(): AddressContainer
124
    {
125 1
        return $this->recipients;
126
    }
127
128
    /**
129
     * @return AddressContainer
130
     */
131 2
    public function ccs(): AddressContainer
132
    {
133 2
        return $this->ccs;
134
    }
135
136
    /**
137
     * @return AddressContainer
138
     */
139 2
    public function bccs(): AddressContainer
140
    {
141 2
        return $this->bccs;
142
    }
143
144
    /**
145
     * @return AttachmentContainer
146
     */
147 1
    public function attachments(): AttachmentContainer
148
    {
149 1
        return $this->attachments;
150
    }
151
152
    /**
153
     * @return string
154
     */
155 1
    public function getId(): string
156
    {
157 1
        return $this->id;
158
    }
159
160
    /**
161
     * @param string $id
162
     */
163 1
    public function setId(string $id)
164
    {
165 1
        $this->id = $id;
166 1
    }
167
168
    /**
169
     * @return DateTime
170
     */
171 1
    public function getCreatedAt(): DateTime
172
    {
173 1
        return $this->createdAt;
174
    }
175
176
    /**
177
     * @return string
178
     */
179 2
    public function getSubject(): string
180
    {
181 2
        return $this->subject;
182
    }
183
184
    /**
185
     * @param string $subject
186
     */
187 2
    public function setSubject(string $subject)
188
    {
189 2
        $this->subject = $subject;
190 2
    }
191
192
    /**
193
     * @return AddressContainer
194
     */
195
    public function replyTos(): AddressContainer
196
    {
197
        return $this->replyTos;
198
    }
199
}