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
Pull Request — master (#3)
by Sascha
05:24
created

Mail::getSubject()   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 Address
19
     */
20
    private $sender;
21
22
    /**
23
     * @var Address
24
     */
25
    private $from;
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 AddressContainer
59
     */
60
    private $replyTos;
61
62
    /**
63
     * Mail constructor.
64
     *
65
     */
66 8
    public function __construct()
67
    {
68 8
        $this->content     = new Content();
69 8
        $this->recipients  = new AddressContainer();
70 8
        $this->ccs         = new AddressContainer();
71 8
        $this->bccs        = new AddressContainer();
72 8
        $this->replyTos    = new AddressContainer();
73 8
        $this->attachments = new AttachmentContainer();
74 8
    }
75
76
    /**
77
     * @param Address $sender
78
     */
79 1
    public function setSender(Address $sender)
80
    {
81 1
        $this->sender = $sender;
82 1
    }
83
84
    /**
85
     * @param Address $from
86
     *
87
     */
88 1
    public function setFrom(Address $from)
89
    {
90 1
        $this->from = $from;
91 1
    }
92
93
    /**
94
     * @return Address
95
     * @throws Exception
96
     */
97 1
    public function getFrom(): Address
98
    {
99 1
        if (!$this->hasFrom()) {
100
            throw new Exception('There is no from given');
101
        }
102
103 1
        return $this->from;
104
    }
105
106
    /**
107
     * @return Address
108
     * @throws Exception
109
     */
110 1
    public function sender(): Address
111
    {
112 1
        if (!$this->hasSender()) {
113
            throw new Exception('There is no sender given');
114
        }
115
116 1
        return $this->sender;
117
    }
118
119
    /**
120
     * @return bool
121
     */
122 1
    public function hasSender(): bool
123
    {
124 1
        return $this->sender !== null;
125
    }
126
127
    /**
128
     * @return bool
129
     */
130 1
    public function hasFrom(): bool
131
    {
132 1
        return $this->from !== null;
133
    }
134
135
    /**
136
     * @return Content
137
     */
138 1
    public function content(): Content
139
    {
140 1
        return $this->content;
141
    }
142
143
    /**
144
     * @return AddressContainer
145
     */
146 1
    public function recipients(): AddressContainer
147
    {
148 1
        return $this->recipients;
149
    }
150
151
    /**
152
     * @return AddressContainer
153
     */
154 1
    public function ccs(): AddressContainer
155
    {
156 1
        return $this->ccs;
157
    }
158
159
    /**
160
     * @return AddressContainer
161
     */
162 1
    public function bccs(): AddressContainer
163
    {
164 1
        return $this->bccs;
165
    }
166
167
    /**
168
     * @return AttachmentContainer
169
     */
170 1
    public function attachments(): AttachmentContainer
171
    {
172 1
        return $this->attachments;
173
    }
174
175
    /**
176
     * @return string
177
     */
178 1
    public function getSubject(): string
179
    {
180 1
        return $this->subject;
181
    }
182
183
    /**
184
     * @param string $subject
185
     */
186 1
    public function setSubject(string $subject)
187
    {
188 1
        $this->subject = $subject;
189 1
    }
190
191
    /**
192
     * @return AddressContainer
193
     */
194
    public function replyTos(): AddressContainer
195
    {
196
        return $this->replyTos;
197
    }
198
}