Repository navigation
Expand file tree
/
Copy pathMessage.php
More file actions
142 lines (115 loc) · 2.19 KB
/
Copy pathMessage.php
File metadata and controls
142 lines (115 loc) · 2.19 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?php
declare(strict_types=1);
namespace Igloonet\MailkitApi\DataObjects;
use Igloonet\MailkitApi\Exceptions\Message\DuplicateAttachmentNameException;
class Message
{
/** @var User */
private $user = null;
/** @var string|null */
private $subject = null;
/** @var string|null */
private $body = null;
/** @var array<string, mixed> */
private $templateVars = [];
/** @var array|Attachment[] */
private $attachments = [];
public function __construct(User $sendToUser)
{
$this->user = $sendToUser;
}
/**
* @return User
*/
public function getUser(): User
{
return $this->user;
}
/**
* @param User $user
* @return $this
*/
public function setUser(User $user): self
{
$this->user = $user;
return $this;
}
/**
* @param string|null $subject
* @return $this
*/
public function setSubject(?string $subject): self
{
$this->subject = $subject;
return $this;
}
/**
* @return string|null
*/
public function getSubject(): ?string
{
return $this->subject;
}
/**
* @param string|null $body
* @return $this
*/
public function setBody(?string $body): self
{
$this->body = $body;
return $this;
}
/**
* @return string|null
*/
public function getBody(): ?string
{
return $this->body;
}
/**
* @param array<string, mixed> $templateVars
* @return $this
*/
public function setTemplateVars(array $templateVars): self
{
$this->templateVars = $templateVars;
return $this;
}
/**
* @param string $varName
* @param mixed $value
* @return $this
*/
public function setTemplateVar(string $varName, $value): self
{
$this->templateVars[$varName] = $value;
return $this;
}
/**
* @return array<string, mixed>
*/
public function getTemplateVars(): array
{
return $this->templateVars;
}
/**
* @param Attachment $attachment
* @return $this
*/
public function addAttachment(Attachment $attachment): self
{
$name = $attachment->getName();
if (isset($this->attachments[$name])) {
throw new DuplicateAttachmentNameException($name);
}
$this->attachments[$name] = $attachment;
return $this;
}
/**
* @return array|Attachment[]
*/
public function getAttachments(): array
{
return $this->attachments;
}
}