|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the WoW-Apps/Symfony-Slack-Bot bundle for Symfony. |
|
5
|
|
|
* https://github.com/wow-apps/symfony-slack-bot |
|
6
|
|
|
* |
|
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
8
|
|
|
* file that was distributed with this source code. |
|
9
|
|
|
* https://github.com/wow-apps/symfony-slack-bot/blob/master/LICENSE |
|
10
|
|
|
* |
|
11
|
|
|
* For technical documentation. |
|
12
|
|
|
* https://wow-apps.github.io/symfony-slack-bot/docs/ |
|
13
|
|
|
* |
|
14
|
|
|
* Author Alexey Samara <[email protected]> |
|
15
|
|
|
* |
|
16
|
|
|
* Copyright 2016 WoW-Apps. |
|
17
|
|
|
*/ |
|
18
|
|
|
|
|
19
|
|
|
namespace WowApps\SlackBundle\Entity; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Class AttachmentAction. |
|
23
|
|
|
* |
|
24
|
|
|
* @author Alexey Samara <[email protected]> |
|
25
|
|
|
*/ |
|
26
|
|
|
class AttachmentAction |
|
27
|
|
|
{ |
|
28
|
|
|
const STYLE_DEFAULT = 'default'; |
|
29
|
|
|
const STYLE_PRIMARY = 'primary'; |
|
30
|
|
|
const STYLE_DANGER = 'danger'; |
|
31
|
|
|
|
|
32
|
|
|
const TYPE_BUTTON = 'button'; |
|
33
|
|
|
const TYPE_SELECT = 'select'; |
|
34
|
|
|
|
|
35
|
|
|
/** @var string */ |
|
36
|
|
|
private $name; |
|
37
|
|
|
|
|
38
|
|
|
/** @var string */ |
|
39
|
|
|
private $text; |
|
40
|
|
|
|
|
41
|
|
|
/** @var string */ |
|
42
|
|
|
private $url; |
|
43
|
|
|
|
|
44
|
|
|
/** @var string */ |
|
45
|
|
|
private $style; |
|
46
|
|
|
|
|
47
|
|
|
/** @var string */ |
|
48
|
|
|
private $type; |
|
49
|
|
|
|
|
50
|
|
|
/** @var string */ |
|
51
|
|
|
private $value; |
|
52
|
|
|
|
|
53
|
|
|
/** @var AttachmentActionConfirm */ |
|
54
|
|
|
private $confirm; |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* AttachmentAction constructor. |
|
58
|
|
|
* |
|
59
|
|
|
* @param string $text |
|
60
|
|
|
* @param string $url |
|
61
|
|
|
* @param string $style |
|
62
|
|
|
* @param AttachmentActionConfirm $confirm |
|
63
|
|
|
*/ |
|
64
|
|
|
public function __construct( |
|
65
|
|
|
string $text = '', |
|
66
|
|
|
string $url = '', |
|
67
|
|
|
string $style = self::STYLE_DEFAULT, |
|
68
|
|
|
AttachmentActionConfirm $confirm = null |
|
69
|
|
|
) { |
|
70
|
|
|
$this->name = ''; |
|
71
|
|
|
$this->value = ''; |
|
72
|
|
|
$this->text = $text; |
|
73
|
|
|
$this->url = $url; |
|
74
|
|
|
$this->style = $style; |
|
75
|
|
|
$this->type = self::TYPE_BUTTON; |
|
76
|
|
|
$this->confirm = is_null($confirm) ? new AttachmentActionConfirm() : $confirm; |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* @return string |
|
81
|
|
|
*/ |
|
82
|
|
|
public function getName(): string |
|
83
|
|
|
{ |
|
84
|
|
|
return $this->name; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* @param string $name |
|
89
|
|
|
* |
|
90
|
|
|
* @return AttachmentAction |
|
91
|
|
|
*/ |
|
92
|
|
|
public function setName(string $name): AttachmentAction |
|
93
|
|
|
{ |
|
94
|
|
|
$this->name = $name; |
|
95
|
|
|
|
|
96
|
|
|
return $this; |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* @return string |
|
101
|
|
|
*/ |
|
102
|
|
|
public function getText(): string |
|
103
|
|
|
{ |
|
104
|
|
|
return $this->text; |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
/** |
|
108
|
|
|
* @param string $text |
|
109
|
|
|
* |
|
110
|
|
|
* @return AttachmentAction |
|
111
|
|
|
*/ |
|
112
|
|
|
public function setText(string $text): AttachmentAction |
|
113
|
|
|
{ |
|
114
|
|
|
$this->text = $text; |
|
115
|
|
|
|
|
116
|
|
|
return $this; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
/** |
|
120
|
|
|
* @return string |
|
121
|
|
|
*/ |
|
122
|
|
|
public function getUrl(): string |
|
123
|
|
|
{ |
|
124
|
|
|
return $this->url; |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* @param string $url |
|
129
|
|
|
* |
|
130
|
|
|
* @return AttachmentAction |
|
131
|
|
|
*/ |
|
132
|
|
|
public function setUrl(string $url): AttachmentAction |
|
133
|
|
|
{ |
|
134
|
|
|
$this->url = $url; |
|
135
|
|
|
|
|
136
|
|
|
return $this; |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
/** |
|
140
|
|
|
* @return string |
|
141
|
|
|
*/ |
|
142
|
|
|
public function getStyle(): string |
|
143
|
|
|
{ |
|
144
|
|
|
return $this->style; |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
/** |
|
148
|
|
|
* @param string $style |
|
149
|
|
|
* |
|
150
|
|
|
* @return AttachmentAction |
|
151
|
|
|
*/ |
|
152
|
|
|
public function setStyle(string $style): AttachmentAction |
|
153
|
|
|
{ |
|
154
|
|
|
$this->style = $style; |
|
155
|
|
|
|
|
156
|
|
|
return $this; |
|
157
|
|
|
} |
|
158
|
|
|
|
|
159
|
|
|
/** |
|
160
|
|
|
* @return string |
|
161
|
|
|
*/ |
|
162
|
|
|
public function getType(): string |
|
163
|
|
|
{ |
|
164
|
|
|
return $this->type; |
|
165
|
|
|
} |
|
166
|
|
|
|
|
167
|
|
|
/** |
|
168
|
|
|
* @param string $type |
|
169
|
|
|
* |
|
170
|
|
|
* @return AttachmentAction |
|
171
|
|
|
*/ |
|
172
|
|
|
public function setType(string $type): AttachmentAction |
|
173
|
|
|
{ |
|
174
|
|
|
$this->type = $type; |
|
175
|
|
|
|
|
176
|
|
|
return $this; |
|
177
|
|
|
} |
|
178
|
|
|
|
|
179
|
|
|
/** |
|
180
|
|
|
* @return AttachmentActionConfirm |
|
181
|
|
|
*/ |
|
182
|
|
|
public function getConfirm(): AttachmentActionConfirm |
|
183
|
|
|
{ |
|
184
|
|
|
return $this->confirm; |
|
185
|
|
|
} |
|
186
|
|
|
|
|
187
|
|
|
/** |
|
188
|
|
|
* @param AttachmentActionConfirm $confirm |
|
189
|
|
|
* |
|
190
|
|
|
* @return AttachmentAction |
|
191
|
|
|
*/ |
|
192
|
|
|
public function setConfirm(AttachmentActionConfirm $confirm): AttachmentAction |
|
193
|
|
|
{ |
|
194
|
|
|
$this->confirm = $confirm; |
|
195
|
|
|
|
|
196
|
|
|
return $this; |
|
197
|
|
|
} |
|
198
|
|
|
|
|
199
|
|
|
/** |
|
200
|
|
|
* @return string |
|
201
|
|
|
*/ |
|
202
|
|
|
public function getValue(): string |
|
203
|
|
|
{ |
|
204
|
|
|
return $this->value; |
|
205
|
|
|
} |
|
206
|
|
|
|
|
207
|
|
|
/** |
|
208
|
|
|
* @param string $value |
|
209
|
|
|
* |
|
210
|
|
|
* @return AttachmentAction |
|
211
|
|
|
*/ |
|
212
|
|
|
public function setValue(string $value): AttachmentAction |
|
213
|
|
|
{ |
|
214
|
|
|
$this->value = $value; |
|
215
|
|
|
|
|
216
|
|
|
return $this; |
|
217
|
|
|
} |
|
218
|
|
|
} |
|
219
|
|
|
|