-
Notifications
You must be signed in to change notification settings - Fork 0
/
Recipient.php
40 lines (35 loc) · 848 Bytes
/
Recipient.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace sazik\mailer;
class Recipient {
public $email = false;
public $to = 0;
public $cc = 0;
public $bcc = 0;
public $reply_to = 0;
public function compose() {
$recipient = [
'to' => $this->to,
'cc' => $this->cc,
'bcc' => $this->bcc,
'reply_to' => $this->reply_to
];
$flag_setted = 0;
if ($this->cc === 1) {
$flag_setted++;
}
if ($this->bcc === 1) {
$flag_setted++;
}
if ($this->to === 1) {
$flag_setted++;
}
if ($this->reply_to === 1) {
$flag_setted++;
}
if ($this->email && $flag_setted === 1) {
$recipient['email'] = $this->email;
return $recipient;
}
return false;
}
}