1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Eloquentcoder\Slack; |
4
|
|
|
|
5
|
|
|
class ActionConfirmation |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* The required title for the pop up window. |
9
|
|
|
* |
10
|
|
|
* @var string |
11
|
|
|
*/ |
12
|
|
|
protected $title; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* The required description. |
16
|
|
|
* |
17
|
|
|
* @var string |
18
|
|
|
*/ |
19
|
|
|
protected $text; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* The text label for the OK button. |
23
|
|
|
* |
24
|
|
|
* @var string |
25
|
|
|
*/ |
26
|
|
|
protected $okText; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* The text label for the Cancel button. |
30
|
|
|
* |
31
|
|
|
* @var string |
32
|
|
|
*/ |
33
|
|
|
protected $dismissText; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Instantiate a new ActionConfirmation. |
37
|
|
|
* |
38
|
|
|
* @param array $attributes |
39
|
|
|
* |
40
|
|
|
* @return void |
41
|
|
|
*/ |
42
|
|
|
public function __construct(array $attributes) |
43
|
|
|
{ |
44
|
|
|
if (isset($attributes['title'])) { |
45
|
|
|
$this->setTitle($attributes['title']); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
if (isset($attributes['text'])) { |
49
|
|
|
$this->setText($attributes['text']); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
if (isset($attributes['ok_text'])) { |
53
|
|
|
$this->setOkText($attributes['ok_text']); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
if (isset($attributes['dismiss_text'])) { |
57
|
|
|
$this->setDismissText($attributes['dismiss_text']); |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @return string |
63
|
|
|
*/ |
64
|
|
|
public function getTitle() |
65
|
|
|
{ |
66
|
|
|
return $this->title; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @param string $title |
71
|
|
|
* |
72
|
|
|
* @return ActionConfirmation |
73
|
|
|
*/ |
74
|
|
|
public function setTitle($title) |
75
|
|
|
{ |
76
|
|
|
$this->title = $title; |
77
|
|
|
|
78
|
|
|
return $this; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @return string |
83
|
|
|
*/ |
84
|
|
|
public function getText() |
85
|
|
|
{ |
86
|
|
|
return $this->text; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @param string $text |
91
|
|
|
* |
92
|
|
|
* @return ActionConfirmation |
93
|
|
|
*/ |
94
|
|
|
public function setText($text) |
95
|
|
|
{ |
96
|
|
|
$this->text = $text; |
97
|
|
|
|
98
|
|
|
return $this; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* @return string |
103
|
|
|
*/ |
104
|
|
|
public function getOkText() |
105
|
|
|
{ |
106
|
|
|
return $this->okText; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @param string $okText |
111
|
|
|
* |
112
|
|
|
* @return ActionConfirmation |
113
|
|
|
*/ |
114
|
|
|
public function setOkText($okText) |
115
|
|
|
{ |
116
|
|
|
$this->okText = $okText; |
117
|
|
|
|
118
|
|
|
return $this; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @return string |
123
|
|
|
*/ |
124
|
|
|
public function getDismissText() |
125
|
|
|
{ |
126
|
|
|
return $this->dismissText; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* @param string $dismissText |
131
|
|
|
* |
132
|
|
|
* @return ActionConfirmation |
133
|
|
|
*/ |
134
|
|
|
public function setDismissText($dismissText) |
135
|
|
|
{ |
136
|
|
|
$this->dismissText = $dismissText; |
137
|
|
|
|
138
|
|
|
return $this; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* Get the array representation of this action confirmation. |
143
|
|
|
* |
144
|
|
|
* @return array |
145
|
|
|
*/ |
146
|
|
|
public function toArray() |
147
|
|
|
{ |
148
|
|
|
return [ |
149
|
|
|
'title' => $this->getTitle(), |
150
|
|
|
'text' => $this->getText(), |
151
|
|
|
'ok_text' => $this->getOkText(), |
152
|
|
|
'dismiss_text' => $this->getDismissText(), |
153
|
|
|
]; |
154
|
|
|
} |
155
|
|
|
} |
156
|
|
|
|