Completed
Push — master ( b579d6...72e21a )
by Hector
11:54
created

LineItem::getCurrency()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Hborras\TwitterAdsSDK\TwitterAds\Campaign;
4
5
use Hborras\TwitterAdsSDK\TwitterAds\Analytics;
6
use Hborras\TwitterAdsSDK\TwitterAds\Analytics\Job;
7
use Hborras\TwitterAdsSDK\TwitterAds\Creative\PromotedTweet;
8
use Hborras\TwitterAdsSDK\TwitterAds\Cursor;
9
use Hborras\TwitterAdsSDK\TwitterAds\Fields\AnalyticsFields;
10
use Hborras\TwitterAdsSDK\TwitterAds\Fields\LineItemFields;
11
use Hborras\TwitterAdsSDK\TwitterAdsException;
12
13
class LineItem extends Analytics
14
{
15
    const RESOURCE_COLLECTION = 'accounts/{account_id}/line_items';
16
    const RESOURCE            = 'accounts/{account_id}/line_items/{id}';
17
18
    const ENTITY = "LINE_ITEM";
19
20
    /** Read Only */
21
    protected $id;
22
    protected $created_at;
23
    protected $updated_at;
24
    protected $deleted;
25
    protected $target_cpa_local_micro;
26
    protected $currency;
27
28
    protected $properties = [
29
        LineItemFields::CAMPAIGN_ID,
30
        LineItemFields::BID_AMOUNT_LOCAL_MICRO,
31
        LineItemFields::NAME,
32
        LineItemFields::BID_TYPE,
33
        LineItemFields::AUTOMATICALLY_SELECT_BID,
34
        LineItemFields::PRODUCT_TYPE,
35
        LineItemFields::PLACEMENTS,
36
        LineItemFields::OBJECTIVE,
37
        LineItemFields::ENTITY_STATUS,
38
        LineItemFields::INCLUDE_SENTIMENT,
39
        LineItemFields::TOTAL_BUDGET_AMOUNT_LOCAL_MICRO,
40
        LineItemFields::START_TIME,
41
        LineItemFields::END_TIME,
42
        LineItemFields::PRIMARY_WEB_EVENT_TAG,
43
        LineItemFields::OPTIMIZATION,
44
        LineItemFields::BID_UNIT,
45
        LineItemFields::CHARGE_BY,
46
        LineItemFields::ADVERTISER_DOMAIN,
47
        LineItemFields::ADVERTISER_USER_ID,
48
        LineItemFields::CATEGORIES
49
    ];
50
51
    /** Writable */
52
    protected $campaign_id;
53
    protected $bid_amount_local_micro;
54
    protected $name;
55
    protected $bid_type;
56
    protected $automatically_select_bid;
57
    protected $product_type;
58
    protected $placements;
59
    protected $objective;
60
    protected $entity_status;
61
    protected $include_sentiment;
62
    protected $total_budget_amount_local_micro;
63
    protected $start_time;
64
    protected $end_time;
65
    protected $primary_web_event_tag;
66
    protected $optimization;
67
    protected $bid_unit;
68
    protected $charge_by;
69
    protected $advertiser_domain;
70
    protected $tracking_tags;
71
    protected $advertiser_user_id;
72
    protected $categories;
73
74
    public function getPromotedTweets($params = [])
75
    {
76
        $params[LineItemFields::LINE_ITEM_IDS] = $this->getId();
77
        $promotedTweetClass = new PromotedTweet();
78
        return $promotedTweetClass->loadResource('', $params);
79
    }
80
81
    /**
82
     * @param $metricGroups
83
     * @param array $params
84
     * @param bool $async
85
     * @return Job| mixed
86
     */
87
    public function stats($metricGroups, $params = [], $async = false)
88
    {
89
        $params[AnalyticsFields::ENTITY] = AnalyticsFields::LINE_ITEM;
90
        return parent::stats($metricGroups, $params, $async);
91
    }
92
93
    /**
94
     * Returns a collection of targeting criteria available to the
95
     * current line item.
96
     *
97
     * @param string $id
98
     * @param array $params
99
     *
100
     * @return Cursor | Resource
101
     *
102
     * @throws TwitterAdsException
103
     */
104
    public function getTargetingCriteria($id = '', $params = [])
105
    {
106
        $targetingCriteria = new TargetingCriteria();
107
108
        $this->validateLoaded();
109
        if ($id == '') {
110
            $cursor = $targetingCriteria->line_item_all($this->getId(), $params);
111
        } else {
112
            $cursor = $targetingCriteria->load($id, $params);
0 ignored issues
show
Bug Compatibility introduced by
The expression $targetingCriteria->load($id, $params); of type Hborras\TwitterAdsSDK\Tw...paign\TargetingCriteria adds the type Hborras\TwitterAdsSDK\Tw...paign\TargetingCriteria to the return on line 115 which is incompatible with the return type documented by Hborras\TwitterAdsSDK\Tw...m::getTargetingCriteria of type Hborras\TwitterAdsSDK\TwitterAds\Cursor.
Loading history...
113
        }
114
115
        return $cursor;
116
    }
117
118
    /**
119
     * @return mixed
120
     */
121
    public function getId()
122
    {
123
        return $this->id;
124
    }
125
126
    /**
127
     * @return mixed
128
     */
129
    public function getCreatedAt()
130
    {
131
        return $this->created_at;
132
    }
133
134
    /**
135
     * @return mixed
136
     */
137
    public function getUpdatedAt()
138
    {
139
        return $this->updated_at;
140
    }
141
142
    /**
143
     * @return mixed
144
     */
145
    public function getDeleted()
146
    {
147
        return $this->deleted;
148
    }
149
150
    /**
151
     * @return array
152
     */
153
    public function getProperties()
154
    {
155
        return $this->properties;
156
    }
157
158
    /**
159
     * @param array $properties
160
     */
161
    public function setProperties($properties)
162
    {
163
        $this->properties = $properties;
164
    }
165
166
    /**
167
     * @return mixed
168
     */
169
    public function getCampaignId()
170
    {
171
        return $this->campaign_id;
172
    }
173
174
    /**
175
     * @param mixed $campaign_id
176
     */
177
    public function setCampaignId($campaign_id)
178
    {
179
        $this->campaign_id = $campaign_id;
180
    }
181
182
    /**
183
     * @return mixed
184
     */
185
    public function getBidAmountLocalMicro()
186
    {
187
        return $this->bid_amount_local_micro;
188
    }
189
190
    /**
191
     * @param mixed $bid_amount_local_micro
192
     */
193
    public function setBidAmountLocalMicro($bid_amount_local_micro)
194
    {
195
        $this->bid_amount_local_micro = $bid_amount_local_micro;
196
    }
197
198
    /**
199
     * @return mixed
200
     */
201
    public function getName()
202
    {
203
        return $this->name;
204
    }
205
206
    /**
207
     * @param mixed $name
208
     */
209
    public function setName($name)
210
    {
211
        $this->name = $name;
212
    }
213
214
    /**
215
     * @return mixed
216
     */
217
    public function getBidType()
218
    {
219
        return $this->bid_type;
220
    }
221
222
    /**
223
     * @param mixed $bid_type
224
     */
225
    public function setBidType($bid_type)
226
    {
227
        $this->bid_type = $bid_type;
228
    }
229
230
    /**
231
     * @return mixed
232
     */
233
    public function getAutomaticallySelectdBid()
234
    {
235
        return $this->automatically_select_bid;
236
    }
237
238
    /**
239
     * @param mixed $automatically_select_bid
240
     */
241
    public function setAutomaticallySelectBid($automatically_select_bid)
242
    {
243
        $this->automatically_select_bid = $automatically_select_bid;
244
    }
245
246
    /**
247
     * @return mixed
248
     */
249
    public function getProductType()
250
    {
251
        return $this->product_type;
252
    }
253
254
    /**
255
     * @param mixed $product_type
256
     */
257
    public function setProductType($product_type)
258
    {
259
        $this->product_type = $product_type;
260
    }
261
262
    /**
263
     * @return mixed
264
     */
265
    public function getPlacements()
266
    {
267
        return $this->placements;
268
    }
269
270
    /**
271
     * @param mixed $placements
272
     */
273
    public function setPlacements($placements)
274
    {
275
        $this->placements = $placements;
276
    }
277
278
    /**
279
     * @return mixed
280
     */
281
    public function getObjective()
282
    {
283
        return $this->objective;
284
    }
285
286
    /**
287
     * @param mixed $objective
288
     */
289
    public function setObjective($objective)
290
    {
291
        $this->objective = $objective;
292
    }
293
294
    /**
295
     * @return mixed
296
     */
297
    public function getEntityStatus()
298
    {
299
        return $this->entity_status;
300
    }
301
302
    /**
303
     * @param mixed $entity_status
304
     */
305
    public function setEntityStatus($entity_status)
306
    {
307
        $this->entity_status = $entity_status;
308
    }
309
310
    /**
311
     * @return mixed
312
     */
313
    public function getIncludeSentiment()
314
    {
315
        return $this->include_sentiment;
316
    }
317
318
    /**
319
     * @param mixed $include_sentiment
320
     */
321
    public function setIncludeSentiment($include_sentiment)
322
    {
323
        $this->include_sentiment = $include_sentiment;
324
    }
325
326
    /**
327
     * @return mixed
328
     */
329
    public function getTotalBudgetAmountLocalMicro()
330
    {
331
        return $this->total_budget_amount_local_micro;
332
    }
333
334
    /**
335
     * @param mixed $total_budget_amount_local_micro
336
     */
337
    public function setTotalBudgetAmountLocalMicro($total_budget_amount_local_micro)
338
    {
339
        $this->total_budget_amount_local_micro = $total_budget_amount_local_micro;
340
    }
341
342
    /**
343
     * @return mixed
344
     */
345
    public function getStartTime()
346
    {
347
        return $this->start_time;
348
    }
349
350
    /**
351
     * @param mixed $start_time
352
     */
353
    public function setStartTime($start_time)
354
    {
355
        $this->start_time = $start_time;
356
    }
357
358
    /**
359
     * @return mixed
360
     */
361
    public function getEndTime()
362
    {
363
        return $this->end_time;
364
    }
365
366
    /**
367
     * @param mixed $end_time
368
     */
369
    public function setEndTime($end_time)
370
    {
371
        $this->end_time = $end_time;
372
    }
373
374
    /**
375
     * @return mixed
376
     */
377
    public function getPrimaryWebEventTag()
378
    {
379
        return $this->primary_web_event_tag;
380
    }
381
382
    /**
383
     * @param mixed $primary_web_event_tag
384
     */
385
    public function setPrimaryWebEventTag($primary_web_event_tag)
386
    {
387
        $this->primary_web_event_tag = $primary_web_event_tag;
388
    }
389
390
    /**
391
     * @return mixed
392
     */
393
    public function getOptimization()
394
    {
395
        return $this->optimization;
396
    }
397
398
    /**
399
     * @param mixed $optimization
400
     */
401
    public function setOptimization($optimization)
402
    {
403
        $this->optimization = $optimization;
404
    }
405
406
    /**
407
     * @return mixed
408
     */
409
    public function getBidUnit()
410
    {
411
        return $this->bid_unit;
412
    }
413
414
    /**
415
     * @param mixed $bid_unit
416
     */
417
    public function setBidUnit($bid_unit)
418
    {
419
        $this->bid_unit = $bid_unit;
420
    }
421
422
    /**
423
     * @return mixed
424
     */
425
    public function getChargeBy()
426
    {
427
        return $this->charge_by;
428
    }
429
430
    /**
431
     * @param mixed $charge_by
432
     */
433
    public function setChargeBy($charge_by)
434
    {
435
        $this->charge_by = $charge_by;
436
    }
437
438
    /**
439
     * @return mixed
440
     */
441
    public function getAdvertiserDomain()
442
    {
443
        return $this->advertiser_domain;
444
    }
445
446
    /**
447
     * @param mixed $advertiser_domain
448
     */
449
    public function setAdvertiserDomain($advertiser_domain)
450
    {
451
        $this->advertiser_domain = $advertiser_domain;
452
    }
453
454
    /**
455
     * @return mixed
456
     */
457
    public function getTrackingTags()
458
    {
459
        return $this->tracking_tags;
460
    }
461
462
    /**
463
     * @param mixed $tracking_tags
464
     */
465
    public function setTrackingTags($tracking_tags)
466
    {
467
        $this->tracking_tags = $tracking_tags;
468
    }
469
470
    /**
471
     * @return mixed
472
     */
473
    public function getAdvertiserUserId()
474
    {
475
        return $this->advertiser_user_id;
476
    }
477
478
    /**
479
     * @param mixed $advertiser_user_id
480
     */
481
    public function setAdvertiserUserId($advertiser_user_id)
482
    {
483
        $this->advertiser_user_id = $advertiser_user_id;
484
    }
485
486
    /**
487
     * @return mixed
488
     */
489
    public function getTargetCpaLocalMicro()
490
    {
491
        return $this->target_cpa_local_micro;
492
    }
493
494
    /**
495
     * @return mixed
496
     */
497
    public function getAutomaticallySelectBid()
498
    {
499
        return $this->automatically_select_bid;
500
    }
501
502
    /**
503
     * @return mixed
504
     */
505
    public function getCategories()
506
    {
507
        return $this->categories;
508
    }
509
510
    /**
511
     * @param mixed $categories
512
     */
513
    public function setCategories($categories)
514
    {
515
        $this->categories = $categories;
516
    }
517
518
    /**
519
     * @return mixed
520
     */
521
    public function getCurrency()
522
    {
523
        return $this->currency;
524
    }
525
}
526