1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the Nexylan packages. |
7
|
|
|
* |
8
|
|
|
* (c) Nexylan SAS <[email protected]> |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
11
|
|
|
* file that was distributed with this source code. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Nexy\Slack; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @author Sullivan Senechal <[email protected]> |
18
|
|
|
*/ |
19
|
|
|
final class ActionConfirmation |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* The required title for the pop up window. |
23
|
|
|
* |
24
|
|
|
* @var string |
25
|
|
|
*/ |
26
|
|
|
private $title; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* The required description. |
30
|
|
|
* |
31
|
|
|
* @var string |
32
|
|
|
*/ |
33
|
|
|
private $text; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* The text label for the OK button. |
37
|
|
|
* |
38
|
|
|
* @var string|null |
39
|
|
|
*/ |
40
|
|
|
private $okText; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* The text label for the Cancel button. |
44
|
|
|
* |
45
|
|
|
* @var string|null |
46
|
|
|
*/ |
47
|
|
|
private $dismissText; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @param string $title |
51
|
|
|
* @param string $text |
52
|
|
|
*/ |
53
|
|
|
public function __construct(string $title, string $text) |
54
|
|
|
{ |
55
|
|
|
$this->title = $title; |
56
|
|
|
$this->text = $text; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @return string |
61
|
|
|
*/ |
62
|
|
|
public function getTitle(): string |
63
|
|
|
{ |
64
|
|
|
return $this->title; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @return string |
69
|
|
|
*/ |
70
|
|
|
public function getText(): string |
71
|
|
|
{ |
72
|
|
|
return $this->text; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @return string|null |
77
|
|
|
*/ |
78
|
|
|
public function getOkText(): ?string |
79
|
|
|
{ |
80
|
|
|
return $this->okText; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @param string|null $okText |
85
|
|
|
* |
86
|
|
|
* @return ActionConfirmation |
87
|
|
|
*/ |
88
|
|
|
public function setOkText(?string $okText) |
89
|
|
|
{ |
90
|
|
|
$this->okText = $okText; |
91
|
|
|
|
92
|
|
|
return $this; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @return string|null |
97
|
|
|
*/ |
98
|
|
|
public function getDismissText(): ?string |
99
|
|
|
{ |
100
|
|
|
return $this->dismissText; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @param string|null $dismissText |
105
|
|
|
* |
106
|
|
|
* @return ActionConfirmation |
107
|
|
|
*/ |
108
|
|
|
public function setDismissText(?string $dismissText) |
109
|
|
|
{ |
110
|
|
|
$this->dismissText = $dismissText; |
111
|
|
|
|
112
|
|
|
return $this; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* Get the array representation of this action confirmation. |
117
|
|
|
* |
118
|
|
|
* @return array |
119
|
|
|
*/ |
120
|
|
|
public function toArray() |
121
|
|
|
{ |
122
|
|
|
return [ |
123
|
|
|
'title' => $this->title, |
124
|
|
|
'text' => $this->text, |
125
|
|
|
'ok_text' => $this->okText, |
126
|
|
|
'dismiss_text' => $this->dismissText, |
127
|
|
|
]; |
128
|
|
|
} |
129
|
|
|
} |
130
|
|
|
|