|
3 | 3 |
|
4 | 4 | use InvalidArgumentException; |
5 | 5 |
|
6 | | -class AttachmentAction |
| 6 | +class AttachmentAction extends Payload |
7 | 7 | { |
8 | 8 | const TYPE_BUTTON = 'button'; |
9 | 9 |
|
@@ -60,42 +60,31 @@ class AttachmentAction |
60 | 60 | */ |
61 | 61 | protected $confirm; |
62 | 62 |
|
| 63 | + /** |
| 64 | + * Internal attribute to property map. |
| 65 | + * |
| 66 | + * @var array |
| 67 | + */ |
| 68 | + protected static $availableAttributes = [ |
| 69 | + 'name' => 'name', |
| 70 | + 'text' => 'text', |
| 71 | + 'style' => 'style', |
| 72 | + 'type' => 'type', |
| 73 | + 'url' => 'url', |
| 74 | + 'value' => 'value', |
| 75 | + 'confirm' => 'confirm', |
| 76 | + ]; |
| 77 | + |
63 | 78 | /** |
64 | 79 | * Instantiate a new AttachmentAction. |
65 | 80 | * |
66 | 81 | * @param array $attributes |
67 | 82 | * |
68 | | - * @throws \InvalidArgumentException |
| 83 | + * @throws InvalidArgumentException |
69 | 84 | */ |
70 | 85 | public function __construct(array $attributes) |
71 | 86 | { |
72 | | - if (isset($attributes['name'])) { |
73 | | - $this->setName($attributes['name']); |
74 | | - } |
75 | | - |
76 | | - if (isset($attributes['text'])) { |
77 | | - $this->setText($attributes['text']); |
78 | | - } |
79 | | - |
80 | | - if (isset($attributes['style'])) { |
81 | | - $this->setStyle($attributes['style']); |
82 | | - } |
83 | | - |
84 | | - if (isset($attributes['type'])) { |
85 | | - $this->setType($attributes['type']); |
86 | | - } |
87 | | - |
88 | | - if (isset($attributes['url'])) { |
89 | | - $this->setUrl($attributes['url']); |
90 | | - } |
91 | | - |
92 | | - if (isset($attributes['value'])) { |
93 | | - $this->setValue($attributes['value']); |
94 | | - } |
95 | | - |
96 | | - if (isset($attributes['confirm'])) { |
97 | | - $this->setConfirm($attributes['confirm']); |
98 | | - } |
| 87 | + parent::__construct($attributes); |
99 | 88 | } |
100 | 89 |
|
101 | 90 | /** |
@@ -225,7 +214,7 @@ public function getConfirm() |
225 | 214 | * |
226 | 215 | * @return AttachmentAction |
227 | 216 | * |
228 | | - * @throws \InvalidArgumentException |
| 217 | + * @throws InvalidArgumentException |
229 | 218 | */ |
230 | 219 | public function setConfirm($confirm) |
231 | 220 | { |
|
0 commit comments