Completed
Push — master ( f0673b...d8d853 )
by Hector
06:46
created

Campaign::getUpdatedAt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
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\Enumerations;
12
use Hborras\TwitterAdsSDK\TwitterAds\Fields\AnalyticsFields;
13
use Hborras\TwitterAdsSDK\TwitterAds\Fields\CampaignFields;
14
15
class Campaign extends Analytics
16
{
17
    const RESOURCE_COLLECTION = 'accounts/{account_id}/campaigns';
18
    const RESOURCE            = 'accounts/{account_id}/campaigns/{id}';
19
    const ENTITY              = 'CAMPAIGN';
20
21
    /** Read Only */
22
    protected $id;
23
    protected $reasons_not_servable;
24
    protected $servable;
25
    protected $created_at;
26
    protected $updated_at;
27
    protected $deleted;
28
    protected $currency;
29
    protected $entity_status;
30
31
    protected $properties = [
32
        CampaignFields::NAME,
33
        CampaignFields::FUNDING_INSTRUMENT_ID,
34
        CampaignFields::START_TIME,
35
        CampaignFields::END_TIME,
36
        CampaignFields::PAUSED,
37
        CampaignFields::STANDARD_DELIVERY,
38
        CampaignFields::DAILY_BUDGET_AMOUNT_LOCAL_MICRO,
39
        CampaignFields::TOTAL_BUDGET_AMOUNT_LOCAL_MICRO,
40
        CampaignFields::DURATION_IN_DAYS,
41
        CampaignFields::FREQUENCY_CAP,
42
    ];
43
44
    /** Writable */
45
    protected $name;
46
    protected $funding_instrument_id;
47
    protected $start_time;
48
    protected $end_time;
49
    protected $paused;
50
    protected $standard_delivery;
51
    protected $daily_budget_amount_local_micro;
52
    protected $total_budget_amount_local_micro;
53
    protected $duration_in_days;
54
    protected $frequency_cap;
55
56
    /**
57
     * @param array $params
58
     * @return \Hborras\TwitterAdsSDK\TwitterAds\Cursor|Resource
59
     */
60
    public function getLineItems($params = [])
61
    {
62
        $params[CampaignFields::CAMPAIGN_IDS] = $this->getId();
63
        $lineItemClass = new LineItem();
64
        return $lineItemClass->loadResource('', $params);
0 ignored issues
show
Documentation introduced by
'' is of type string, but the function expects a object<Hborras\TwitterAdsSDK\TwitterAds\Account>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
Documentation introduced by
$params is of type array<integer|string,*>, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
65
    }
66
67
    /**
68
     * @param $metricGroups
69
     * @param array $params
70
     * @param bool $async
71
     * @return mixed
72
     */
73
    public function stats($metricGroups, $params = [], $async = false)
74
    {
75
        $params[AnalyticsFields::ENTITY] = AnalyticsFields::CAMPAIGN;
76
        return parent::stats($metricGroups, $params, $async);
77
    }
78
79
    /**
80
     * @return mixed
81
     */
82
    public function getId()
83
    {
84
        return $this->id;
85
    }
86
87
    /**
88
     * @return mixed
89
     */
90
    public function getReasonsNotServable()
91
    {
92
        return $this->reasons_not_servable;
93
    }
94
95
    /**
96
     * @return mixed
97
     */
98
    public function getServable()
99
    {
100
        return $this->servable;
101
    }
102
103
    /**
104
     * @return \DateTime
105
     */
106
    public function getCreatedAt()
107
    {
108
        return $this->created_at;
109
    }
110
111
    /**
112
     * @return mixed
113
     */
114
    public function getUpdatedAt()
115
    {
116
        return $this->updated_at;
117
    }
118
119
    /**
120
     * @return mixed
121
     */
122
    public function getDeleted()
123
    {
124
        return $this->deleted;
125
    }
126
127
    /**
128
     * @return mixed
129
     */
130
    public function getName()
131
    {
132
        return $this->name;
133
    }
134
135
    /**
136
     * @param mixed $name
137
     */
138
    public function setName($name)
139
    {
140
        $this->name = $name;
141
    }
142
143
    /**
144
     * @return mixed
145
     */
146
    public function getFundingInstrumentId()
147
    {
148
        return $this->funding_instrument_id;
149
    }
150
151
    /**
152
     * @param mixed $funding_instrument_id
153
     */
154
    public function setFundingInstrumentId($funding_instrument_id)
155
    {
156
        $this->funding_instrument_id = $funding_instrument_id;
157
    }
158
159
    /**
160
     * @return mixed
161
     */
162
    public function getStartTime()
163
    {
164
        return $this->start_time;
165
    }
166
167
    /**
168
     * @param mixed $start_time
169
     */
170
    public function setStartTime($start_time)
171
    {
172
        $this->start_time = $start_time;
173
    }
174
175
    /**
176
     * @return mixed
177
     */
178
    public function getEndTime()
179
    {
180
        return $this->end_time;
181
    }
182
183
    /**
184
     * @param mixed $end_time
185
     */
186
    public function setEndTime($end_time)
187
    {
188
        $this->end_time = $end_time;
189
    }
190
191
    /**
192
     * @return mixed
193
     */
194
    public function getPaused()
195
    {
196
        return $this->paused;
197
    }
198
199
    /**
200
     * @param mixed $paused
201
     */
202
    public function setPaused($paused)
203
    {
204
        $this->paused = $paused;
205
    }
206
207
    /**
208
     * @return mixed
209
     */
210
    public function getCurrency()
211
    {
212
        return $this->currency;
213
    }
214
215
    /**
216
     * @param mixed $currency
217
     */
218
    public function setCurrency($currency)
219
    {
220
        $this->currency = $currency;
221
    }
222
223
    /**
224
     * @return mixed
225
     */
226
    public function getStandardDelivery()
227
    {
228
        return $this->standard_delivery;
229
    }
230
231
    /**
232
     * @param mixed $standard_delivery
233
     */
234
    public function setStandardDelivery($standard_delivery)
235
    {
236
        $this->standard_delivery = $standard_delivery;
237
    }
238
239
    /**
240
     * @return mixed
241
     */
242
    public function getDailyBudgetAmountLocalMicro()
243
    {
244
        return $this->daily_budget_amount_local_micro;
245
    }
246
247
    /**
248
     * @param mixed $daily_budget_amount_local_micro
249
     */
250
    public function setDailyBudgetAmountLocalMicro($daily_budget_amount_local_micro)
251
    {
252
        $this->daily_budget_amount_local_micro = $daily_budget_amount_local_micro;
253
    }
254
255
    /**
256
     * @return mixed
257
     */
258
    public function getTotalBudgetAmountLocalMicro()
259
    {
260
        return $this->total_budget_amount_local_micro;
261
    }
262
263
    /**
264
     * @param mixed $total_budget_amount_local_micro
265
     */
266
    public function setTotalBudgetAmountLocalMicro($total_budget_amount_local_micro)
267
    {
268
        $this->total_budget_amount_local_micro = $total_budget_amount_local_micro;
269
    }
270
271
    /**
272
     * @return array
273
     */
274
    public function getProperties()
275
    {
276
        return $this->properties;
277
    }
278
279
    /**
280
     * @param array $properties
281
     */
282
    public function setProperties($properties)
283
    {
284
        $this->properties = $properties;
285
    }
286
287
    /**
288
     * @return mixed
289
     */
290
    public function getDurationInDays()
291
    {
292
        return $this->duration_in_days;
293
    }
294
295
    /**
296
     * @param mixed $duration_in_days
297
     */
298
    public function setDurationInDays($duration_in_days)
299
    {
300
        $this->duration_in_days = $duration_in_days;
301
    }
302
303
    /**
304
     * @return mixed
305
     */
306
    public function getFrequencyCap()
307
    {
308
        return $this->frequency_cap;
309
    }
310
311
    /**
312
     * @param mixed $frequency_cap
313
     */
314
    public function setFrequencyCap($frequency_cap)
315
    {
316
        $this->frequency_cap = $frequency_cap;
317
    }
318
319
    /**
320
     * @return mixed
321
     */
322
    public function getEntityStatus()
323
    {
324
        return $this->entity_status;
325
    }
326
}
327