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 ( ed2944...746095 )
by Alex
03:36
created

Mail::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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
     * Mail constructor.
64
     *
65
     * @param DateTime|null $createdAt
66
     */
67 20
    public function __construct(DateTime $createdAt = null)
68
    {
69 20
        $this->content     = new Content();
70 20
        $this->recipients  = new AddressContainer();
71 20
        $this->ccs         = new AddressContainer();
72 20
        $this->bccs        = new AddressContainer();
73 20
        $this->attachments = new AttachmentContainer();
74 20
        $this->createdAt   = $createdAt !== null ? $createdAt : new DateTime();
75 20
    }
76
77
    /**
78
     * @param Address $sender
79
     */
80 2
    public function setSender(Address $sender)
81
    {
82 2
        $this->sender = $sender;
83 2
    }
84
85
    /**
86
     * @return Address
87
     * @throws Exception
88
     */
89 2
    public function sender(): Address
90
    {
91 2
        if (!$this->isSenderSet()) {
92
            throw new Exception('There is no sender given');
93
        }
94
95 2
        return $this->sender;
96
    }
97
98
    /**
99
     * @return bool
100
     */
101 2
    public function isSenderSet(): bool
102
    {
103 2
        return $this->sender !== null;
104
    }
105
106
    /**
107
     * @return Content
108
     */
109 3
    public function content(): Content
110
    {
111 3
        return $this->content;
112
    }
113
114
    /**
115
     * @return AddressContainer
116
     */
117 1
    public function recipients(): AddressContainer
118
    {
119 1
        return $this->recipients;
120
    }
121
122
    /**
123
     * @return AddressContainer
124
     */
125 2
    public function ccs(): AddressContainer
126
    {
127 2
        return $this->ccs;
128
    }
129
130
    /**
131
     * @return AddressContainer
132
     */
133 2
    public function bccs(): AddressContainer
134
    {
135 2
        return $this->bccs;
136
    }
137
138
    /**
139
     * @return AttachmentContainer
140
     */
141 1
    public function attachments(): AttachmentContainer
142
    {
143 1
        return $this->attachments;
144
    }
145
146
    /**
147
     * @return string
148
     */
149 1
    public function getId(): string
150
    {
151 1
        return $this->id;
152
    }
153
154
    /**
155
     * @param string $id
156
     */
157 1
    public function setId(string $id)
158
    {
159 1
        $this->id = $id;
160 1
    }
161
162
    /**
163
     * @return DateTime
164
     */
165 1
    public function getCreatedAt(): DateTime
166
    {
167 1
        return $this->createdAt;
168
    }
169
170
    /**
171
     * @return string
172
     */
173 2
    public function getSubject(): string
174
    {
175 2
        return $this->subject;
176
    }
177
178
    /**
179
     * @param string $subject
180
     */
181 2
    public function setSubject(string $subject)
182
    {
183 2
        $this->subject = $subject;
184
    }
185
}