1 | <?php |
||
24 | class SlackMessage |
||
25 | { |
||
26 | /** @var string */ |
||
27 | private $username; |
||
28 | |||
29 | /** @var string */ |
||
30 | private $channel; |
||
31 | |||
32 | /** @var string */ |
||
33 | private $iconUrl; |
||
34 | |||
35 | /** @var string */ |
||
36 | private $iconEmoji; |
||
37 | |||
38 | /** @var bool */ |
||
39 | private $markdown; |
||
40 | |||
41 | /** @var string */ |
||
42 | private $text; |
||
43 | |||
44 | /** @var Attachment[] */ |
||
45 | private $attachments; |
||
46 | |||
47 | /** |
||
48 | * SlackMessage constructor. |
||
49 | * |
||
50 | * @param string $text |
||
51 | * @param string $username |
||
52 | * @param string $channel |
||
53 | * @param string $iconUrl |
||
54 | * @param string $iconEmoji |
||
55 | * @param bool $markdown |
||
56 | * @param array $attachments |
||
57 | */ |
||
58 | public function __construct( |
||
75 | |||
76 | /** |
||
77 | * Returns the user name on behalf of which the message will be sent. |
||
78 | * |
||
79 | * @return string |
||
80 | */ |
||
81 | public function getUsername(): string |
||
85 | |||
86 | 24 | /** |
|
87 | 24 | * Set the user name on behalf of which the message will be sent. |
|
88 | 24 | * |
|
89 | 24 | * @param string $username |
|
90 | 24 | * |
|
91 | 24 | * @return SlackMessage |
|
92 | 24 | */ |
|
93 | 24 | public function setUsername(string $username): SlackMessage |
|
99 | |||
100 | /** |
||
101 | * Returns the name of channel where the message will be sent. |
||
102 | * |
||
103 | * @return string |
||
104 | 1 | */ |
|
105 | public function getChannel(): string |
||
109 | |||
110 | /** |
||
111 | * Set the name of channel where the message will be sent. |
||
112 | * |
||
113 | * @param string $channel |
||
114 | * |
||
115 | * @return SlackMessage |
||
116 | */ |
||
117 | public function setChannel(string $channel): SlackMessage |
||
123 | |||
124 | /** |
||
125 | 24 | * Returns icon url of message. |
|
126 | * |
||
127 | * @return string |
||
128 | 24 | */ |
|
129 | public function getIconUrl(): string |
||
133 | 24 | ||
134 | 24 | /** |
|
135 | * Set the icon url for a message. |
||
136 | * |
||
137 | * @param string $iconUrl |
||
138 | * |
||
139 | * @return SlackMessage |
||
140 | 4 | */ |
|
141 | public function setIconUrl(string $iconUrl): SlackMessage |
||
147 | |||
148 | /** |
||
149 | 24 | * Returns icon Emoji of message. |
|
150 | * |
||
151 | 24 | * @return string |
|
152 | 24 | */ |
|
153 | public function getIconEmoji(): string |
||
157 | |||
158 | 3 | /** |
|
159 | * Set the icon Emoji for a message. |
||
160 | 3 | * |
|
161 | * @param string $iconEmoji |
||
162 | * |
||
163 | * @return SlackMessage |
||
164 | */ |
||
165 | public function setIconEmoji(string $iconEmoji): SlackMessage |
||
171 | |||
172 | /** |
||
173 | * Returns state of markdown support of message. |
||
174 | * |
||
175 | * @return bool |
||
176 | 3 | */ |
|
177 | public function isMarkdown(): bool |
||
181 | |||
182 | /** |
||
183 | * Set the state of markdown support of message. |
||
184 | * |
||
185 | 24 | * @param bool $markdown |
|
186 | * |
||
187 | 24 | * @return SlackMessage |
|
188 | 24 | */ |
|
189 | public function setMarkdown(bool $markdown): SlackMessage |
||
195 | |||
196 | 2 | /** |
|
197 | * Returns main text of message. |
||
198 | * |
||
199 | * @return string |
||
200 | */ |
||
201 | public function getText(): string |
||
205 | 24 | ||
206 | 24 | /** |
|
207 | * Set the main text of message. |
||
208 | * |
||
209 | * @param string $text |
||
210 | * |
||
211 | * @return SlackMessage |
||
212 | 2 | */ |
|
213 | public function setText(string $text): SlackMessage |
||
219 | |||
220 | /** |
||
221 | 24 | * Returns collection of Attachment DTOs. |
|
222 | * |
||
223 | 24 | * @return Attachment[] |
|
224 | 24 | */ |
|
225 | public function getAttachments(): array |
||
229 | |||
230 | 2 | /** |
|
231 | * Set collection of Attachment DTOs. |
||
232 | 2 | * |
|
233 | * @param Attachment[] $attachments |
||
234 | * |
||
235 | * @return SlackMessage |
||
236 | */ |
||
237 | public function setAttachments(array $attachments): SlackMessage |
||
243 | |||
244 | /** |
||
245 | * Appends Attachment DTO to collection. |
||
246 | * |
||
247 | * @param Attachment $attachment |
||
248 | 2 | * |
|
249 | * @return SlackMessage |
||
250 | 2 | */ |
|
251 | public function appendAttachment(Attachment $attachment): SlackMessage |
||
261 | } |
||
262 |