1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Created by PhpStorm. |
4
|
|
|
* User: hborras |
5
|
|
|
* Date: 3/04/16 |
6
|
|
|
* Time: 11:59. |
7
|
|
|
*/ |
8
|
|
|
namespace Hborras\TwitterAdsSDK\TwitterAds\Campaign; |
9
|
|
|
|
10
|
|
|
use Hborras\TwitterAdsSDK\TwitterAds\Analytics; |
11
|
|
|
use Hborras\TwitterAdsSDK\TwitterAds\Fields\CampaignFields; |
12
|
|
|
|
13
|
|
|
class Campaign extends Analytics |
14
|
|
|
{ |
15
|
|
|
const RESOURCE_COLLECTION = 'accounts/{account_id}/campaigns'; |
16
|
|
|
const RESOURCE = 'accounts/{account_id}/campaigns/{id}'; |
17
|
|
|
const ENTITY = 'CAMPAIGN'; |
18
|
|
|
|
19
|
|
|
/** Read Only */ |
20
|
|
|
protected $id; |
21
|
|
|
protected $reasons_not_servable; |
22
|
|
|
protected $servable; |
23
|
|
|
protected $created_at; |
24
|
|
|
protected $updated_at; |
25
|
|
|
protected $deleted; |
26
|
|
|
|
27
|
|
|
protected $properties = [ |
28
|
|
|
CampaignFields::NAME, |
29
|
|
|
CampaignFields::FUNDING_INSTRUMENT_ID, |
30
|
|
|
CampaignFields::START_TIME, |
31
|
|
|
CampaignFields::END_TIME, |
32
|
|
|
CampaignFields::PAUSED, |
33
|
|
|
CampaignFields::CURRENCY, |
34
|
|
|
CampaignFields::STANDARD_DELIVERY, |
35
|
|
|
CampaignFields::DAILY_BUDGET_AMOUNT_LOCAL_MICRO, |
36
|
|
|
CampaignFields::TOTAL_BUDGET_AMOUNT_LOCAL_MICRO, |
37
|
|
|
]; |
38
|
|
|
|
39
|
|
|
/** Writable */ |
40
|
|
|
protected $name; |
41
|
|
|
protected $funding_instrument_id; |
42
|
|
|
protected $start_time; |
43
|
|
|
protected $end_time; |
44
|
|
|
protected $paused; |
45
|
|
|
protected $currency; |
46
|
|
|
protected $standard_delivery; |
47
|
|
|
protected $daily_budget_amount_local_micro; |
48
|
|
|
protected $total_budget_amount_local_micro; |
49
|
|
|
|
50
|
|
|
public function getLineItems($params = []) |
51
|
|
|
{ |
52
|
|
|
$params[CampaignFields::CAMPAIGN_IDS] = $this->getId(); |
53
|
|
|
$lineItemClass = new LineItem(); |
54
|
|
|
return $lineItemClass->loadResource('', $params); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @return mixed |
59
|
|
|
*/ |
60
|
|
|
public function getId() |
61
|
|
|
{ |
62
|
|
|
return $this->id; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @return mixed |
67
|
|
|
*/ |
68
|
|
|
public function getReasonsNotServable() |
69
|
|
|
{ |
70
|
|
|
return $this->reasons_not_servable; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @return mixed |
75
|
|
|
*/ |
76
|
|
|
public function getServable() |
77
|
|
|
{ |
78
|
|
|
return $this->servable; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @return mixed |
83
|
|
|
*/ |
84
|
|
|
public function getCreatedAt() |
85
|
|
|
{ |
86
|
|
|
return $this->created_at; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @return mixed |
91
|
|
|
*/ |
92
|
|
|
public function getUpdatedAt() |
93
|
|
|
{ |
94
|
|
|
return $this->updated_at; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @return mixed |
99
|
|
|
*/ |
100
|
|
|
public function getDeleted() |
101
|
|
|
{ |
102
|
|
|
return $this->deleted; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @return mixed |
107
|
|
|
*/ |
108
|
|
|
public function getName() |
109
|
|
|
{ |
110
|
|
|
return $this->name; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* @param mixed $name |
115
|
|
|
*/ |
116
|
|
|
public function setName($name) |
117
|
|
|
{ |
118
|
|
|
$this->name = $name; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @return mixed |
123
|
|
|
*/ |
124
|
|
|
public function getFundingInstrumentId() |
125
|
|
|
{ |
126
|
|
|
return $this->funding_instrument_id; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* @param mixed $funding_instrument_id |
131
|
|
|
*/ |
132
|
|
|
public function setFundingInstrumentId($funding_instrument_id) |
133
|
|
|
{ |
134
|
|
|
$this->funding_instrument_id = $funding_instrument_id; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* @return mixed |
139
|
|
|
*/ |
140
|
|
|
public function getStartTime() |
141
|
|
|
{ |
142
|
|
|
return $this->start_time; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* @param mixed $start_time |
147
|
|
|
*/ |
148
|
|
|
public function setStartTime($start_time) |
149
|
|
|
{ |
150
|
|
|
$this->start_time = $start_time; |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* @return mixed |
155
|
|
|
*/ |
156
|
|
|
public function getEndTime() |
157
|
|
|
{ |
158
|
|
|
return $this->end_time; |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* @param mixed $end_time |
163
|
|
|
*/ |
164
|
|
|
public function setEndTime($end_time) |
165
|
|
|
{ |
166
|
|
|
$this->end_time = $end_time; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* @return mixed |
171
|
|
|
*/ |
172
|
|
|
public function getPaused() |
173
|
|
|
{ |
174
|
|
|
return $this->paused; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* @param mixed $paused |
179
|
|
|
*/ |
180
|
|
|
public function setPaused($paused) |
181
|
|
|
{ |
182
|
|
|
$this->paused = $paused; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* @return mixed |
187
|
|
|
*/ |
188
|
|
|
public function getCurrency() |
189
|
|
|
{ |
190
|
|
|
return $this->currency; |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
/** |
194
|
|
|
* @param mixed $currency |
195
|
|
|
*/ |
196
|
|
|
public function setCurrency($currency) |
197
|
|
|
{ |
198
|
|
|
$this->currency = $currency; |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
/** |
202
|
|
|
* @return mixed |
203
|
|
|
*/ |
204
|
|
|
public function getStandardDelivery() |
205
|
|
|
{ |
206
|
|
|
return $this->standard_delivery; |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
/** |
210
|
|
|
* @param mixed $standard_delivery |
211
|
|
|
*/ |
212
|
|
|
public function setStandardDelivery($standard_delivery) |
213
|
|
|
{ |
214
|
|
|
$this->standard_delivery = $standard_delivery; |
215
|
|
|
} |
216
|
|
|
|
217
|
|
|
/** |
218
|
|
|
* @return mixed |
219
|
|
|
*/ |
220
|
|
|
public function getDailyBudgetAmountLocalMicro() |
221
|
|
|
{ |
222
|
|
|
return $this->daily_budget_amount_local_micro; |
223
|
|
|
} |
224
|
|
|
|
225
|
|
|
/** |
226
|
|
|
* @param mixed $daily_budget_amount_local_micro |
227
|
|
|
*/ |
228
|
|
|
public function setDailyBudgetAmountLocalMicro($daily_budget_amount_local_micro) |
229
|
|
|
{ |
230
|
|
|
$this->daily_budget_amount_local_micro = $daily_budget_amount_local_micro; |
231
|
|
|
} |
232
|
|
|
|
233
|
|
|
/** |
234
|
|
|
* @return mixed |
235
|
|
|
*/ |
236
|
|
|
public function getTotalBudgetAmountLocalMicro() |
237
|
|
|
{ |
238
|
|
|
return $this->total_budget_amount_local_micro; |
239
|
|
|
} |
240
|
|
|
|
241
|
|
|
/** |
242
|
|
|
* @param mixed $total_budget_amount_local_micro |
243
|
|
|
*/ |
244
|
|
|
public function setTotalBudgetAmountLocalMicro($total_budget_amount_local_micro) |
245
|
|
|
{ |
246
|
|
|
$this->total_budget_amount_local_micro = $total_budget_amount_local_micro; |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
/** |
250
|
|
|
* @return array |
251
|
|
|
*/ |
252
|
|
|
public function getProperties() |
253
|
|
|
{ |
254
|
|
|
return $this->properties; |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
/** |
258
|
|
|
* @param array $properties |
259
|
|
|
*/ |
260
|
|
|
public function setProperties($properties) |
261
|
|
|
{ |
262
|
|
|
$this->properties = $properties; |
263
|
|
|
} |
264
|
|
|
} |
265
|
|
|
|