1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Hborras\TwitterAdsSDK\TwitterAds\Creative; |
4
|
|
|
|
5
|
|
|
use Hborras\TwitterAdsSDK\TwitterAds\Fields\PollCardFields; |
6
|
|
|
use Hborras\TwitterAdsSDK\TwitterAds\Resource; |
7
|
|
|
|
8
|
|
|
class PollCard extends Resource |
9
|
|
|
{ |
10
|
|
|
const RESOURCE_COLLECTION = 'accounts/{account_id}/cards/poll'; |
11
|
|
|
const RESOURCE = 'accounts/{account_id}/cards/poll/{id}'; |
12
|
|
|
|
13
|
|
|
/** Read Only */ |
14
|
|
|
protected $id; |
15
|
|
|
protected $preview_url; |
16
|
|
|
protected $created_at; |
17
|
|
|
protected $updated_at; |
18
|
|
|
protected $deleted; |
19
|
|
|
|
20
|
|
|
protected $properties = [ |
21
|
|
|
PollCardFields::NAME, |
22
|
|
|
PollCardFields::DURATION_IN_MINUTES, |
23
|
|
|
PollCardFields::FIRST_CHOICE, |
24
|
|
|
PollCardFields::SECOND_CHOICE, |
25
|
|
|
]; |
26
|
|
|
|
27
|
|
|
/** Writable */ |
28
|
|
|
protected $name; |
29
|
|
|
protected $duration_in_minutes; |
30
|
|
|
protected $first_choice; |
31
|
|
|
protected $second_choice; |
32
|
|
|
protected $third_choice; |
33
|
|
|
protected $fourth_choice; |
34
|
|
|
protected $media_key; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @return mixed |
38
|
|
|
*/ |
39
|
|
|
public function getId() |
40
|
|
|
{ |
41
|
|
|
return $this->id; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @return array |
46
|
|
|
*/ |
47
|
|
|
public function getProperties() |
48
|
|
|
{ |
49
|
|
|
return $this->properties; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @param array $properties |
54
|
|
|
*/ |
55
|
|
|
public function setProperties($properties) |
56
|
|
|
{ |
57
|
|
|
$this->properties = $properties; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return mixed |
62
|
|
|
*/ |
63
|
|
|
public function getName() |
64
|
|
|
{ |
65
|
|
|
return $this->name; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @param mixed $name |
70
|
|
|
*/ |
71
|
|
|
public function setName($name) |
72
|
|
|
{ |
73
|
|
|
$this->name = $name; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @return mixed |
78
|
|
|
*/ |
79
|
|
|
public function getDurationInMinutes() |
80
|
|
|
{ |
81
|
|
|
return $this->duration_in_minitues; |
|
|
|
|
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @param mixed $duration_in_minitues |
|
|
|
|
86
|
|
|
*/ |
87
|
|
|
public function setDurationInMinutes($duration_in_minutes) |
88
|
|
|
{ |
89
|
|
|
$this->duration_in_minutes = $duration_in_minutes; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @return mixed |
94
|
|
|
*/ |
95
|
|
|
public function getMediaKey() |
96
|
|
|
{ |
97
|
|
|
return $this->media_key; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @param mixed $media_key |
102
|
|
|
*/ |
103
|
|
|
public function setMediaKey($media_key) |
104
|
|
|
{ |
105
|
|
|
$this->media_key = $media_key; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @return mixed |
110
|
|
|
*/ |
111
|
|
|
public function getFirstChoice() |
112
|
|
|
{ |
113
|
|
|
return $this->first_choice; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @param mixed $first_choice |
118
|
|
|
*/ |
119
|
|
|
public function setFirstChoice($first_choice) |
120
|
|
|
{ |
121
|
|
|
$this->first_choice = $first_choice; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @return mixed |
126
|
|
|
*/ |
127
|
|
|
public function getSecondChoice() |
128
|
|
|
{ |
129
|
|
|
return $this->second_choice; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @param mixed $second_choice |
134
|
|
|
*/ |
135
|
|
|
public function setSecondChoice($second_choice) |
136
|
|
|
{ |
137
|
|
|
$this->second_choice = $second_choice; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @param array $choices |
142
|
|
|
*/ |
143
|
|
|
public function setChoices(array $choices) |
144
|
|
|
{ |
145
|
|
|
if (count($choices) == 0) { |
146
|
|
|
return; |
147
|
|
|
} |
148
|
|
|
$this->first_choice = $choices[0]; |
149
|
|
|
if (count($choices) == 1) { |
150
|
|
|
return; |
151
|
|
|
} |
152
|
|
|
$this->second_choice = $choices[1]; |
153
|
|
|
if (count($choices) == 2) { |
154
|
|
|
return; |
155
|
|
|
} |
156
|
|
|
$this->third_choice = $choices[2]; |
157
|
|
|
if (count($choices) == 3) { |
158
|
|
|
return; |
159
|
|
|
} |
160
|
|
|
$this->fourth_choice = $choices[3]; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @return mixed |
165
|
|
|
*/ |
166
|
|
|
public function getPreviewUrl() |
167
|
|
|
{ |
168
|
|
|
return $this->preview_url; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* @return mixed |
173
|
|
|
*/ |
174
|
|
|
public function getCreatedAt() |
175
|
|
|
{ |
176
|
|
|
return $this->created_at; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* @return mixed |
181
|
|
|
*/ |
182
|
|
|
public function getUpdatedAt() |
183
|
|
|
{ |
184
|
|
|
return $this->updated_at; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* @return mixed |
189
|
|
|
*/ |
190
|
|
|
public function getDeleted() |
191
|
|
|
{ |
192
|
|
|
return $this->deleted; |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
public function toParams() |
196
|
|
|
{ |
197
|
|
|
$params = parent::toParams(); |
198
|
|
|
if (isset($this->third_choice)) { |
199
|
|
|
$params[PollCardFields::THIRD_CHOICE] = $this->third_choice; |
200
|
|
|
} |
201
|
|
|
if (isset($this->fourth_choice)) { |
202
|
|
|
$params[PollCardFields::FOURTH_CHOICE] = $this->fourth_choice; |
203
|
|
|
} |
204
|
|
|
if (isset($this->media_key)) { |
205
|
|
|
$params[PollCardFields::MEDIA_KEY] = $this->media_key; |
206
|
|
|
} |
207
|
|
|
return $params; |
208
|
|
|
} |
209
|
|
|
} |
210
|
|
|
|
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.
If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.