Completed
Push — master ( dd23a3...589bb6 )
by Nick
05:48 queued 02:41
created

Capture   F

Complexity

Total Complexity 99

Size/Duplication

Total Lines 922
Duplicated Lines 7.81 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 99
lcom 0
cbo 3
dl 72
loc 922
rs 1.0434
c 0
b 0
f 0

46 Methods

Rating   Name   Duplication   Size   Complexity  
B setPersonUdf() 15 15 5
B setEventUdf() 15 15 5
B setTouchUdf() 15 15 5
A setEventName() 0 9 2
A setEventSource() 0 9 2
A setEventDate() 0 6 1
A setIdentities() 0 9 2
A setUrl() 9 9 2
A setSiteId() 9 9 2
A setReferralUrl() 0 9 2
A setContentTitle() 0 9 2
A setUserAgent() 0 9 2
A setPlatform() 0 9 2
A setIpAddress() 0 9 2
A setPersona() 0 9 2
A setEngagementScore() 0 9 2
A setPersonalizationName() 0 9 2
A setPersonalizationMachineName() 0 9 2
A setPersonalizationChosenVariation() 0 9 2
A setPersonalizationAudienceName() 0 9 2
A setPersonalizationDecisionPolicy() 0 9 2
A setPersonalizationGoalName() 0 9 2
A setPersonalizationGoalValue() 0 9 2
A setDecisionSlotId() 0 9 2
A setDecisionSlotName() 0 9 2
A setDecisionRuleId() 0 9 2
A setDecisionRuleName() 0 9 2
A setDecisionContentId() 0 9 2
A setDecisionContentName() 0 9 2
A setDecisionGoalId() 0 9 2
A setDecisionGoalName() 0 9 2
A setDecisionGoalValue() 0 9 2
A setDecisionViewMode() 0 9 2
A setDecisionPolicy() 0 9 2
A setCaptureIdentifier() 0 9 2
A setClientTimezone() 0 9 2
A setJavascriptVersion() 0 9 2
A setPostId() 0 9 2
A setContentId() 9 9 2
A setContentType() 0 9 2
A setContentSection() 0 9 2
A setContentKeywords() 0 9 2
A setAuthor() 0 9 2
A setPageType() 0 9 2
A setThumbnailUrl() 0 9 2
A setPublishedDate() 0 6 1

How to fix   Duplicated Code    Complexity   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

Complex Class

 Tip:   Before tackling complexity, make sure that you eliminate any duplication first. This often can reduce the size of classes significantly.

Complex classes like Capture often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use Capture, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
namespace Acquia\LiftClient\Entity;
4
5
use Acquia\LiftClient\Exception\LiftSdkException;
6
use Acquia\LiftClient\Utility\Utility;
7
use DateTime;
8
9
class Capture extends Entity
10
{
11
    const PERSON_UDF_COUNT = 50;
12
    const EVENT_UDF_COUNT = 50;
13
    const TOUCH_UDF_COUNT = 20;
14
15
    /**
16
     * Set the 'person_udf#' field.
17
     *
18
     * @param int    $num   Which field to fetch. Can be from 1 till 50
19
     * @param string $value Custom fields for the Acquia Lift Person Capture Phase
20
     *
21
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
22
     *
23
     * @return \Acquia\LiftClient\Entity\Capture
24
     */
25 View Code Duplication
    public function setPersonUdf($num, $value)
26
    {
27
        if (!is_int($num)) {
28
            throw new LiftSdkException('Argument must be an instance of integer.');
29
        }
30
        if ($num < 1 || $num > self::PERSON_UDF_COUNT) {
31
            throw new LiftSdkException('Argument must be greater than 0 and smaller or equal to 50.');
32
        }
33
        if (!is_string($value)) {
34
            throw new LiftSdkException('Argument must be an instance of string.');
35
        }
36
        $this['person_udf'.$num] = $value;
37
38
        return $this;
39
    }
40
41
    /**
42
     * Set the 'event_udf#' field.
43
     *
44
     * @param int    $num   Which field to fetch. Can be from 1 till 50
45
     * @param string $value Custom fields for the Acquia Lift Event Capture Phase
46
     *
47
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
48
     *
49
     * @return \Acquia\LiftClient\Entity\Capture
50
     */
51 View Code Duplication
    public function setEventUdf($num, $value)
52
    {
53
        if (!is_int($num)) {
54
            throw new LiftSdkException('Argument must be an instance of integer.');
55
        }
56
        if ($num < 1 || $num > self::EVENT_UDF_COUNT) {
57
            throw new LiftSdkException('Argument must be greater than 0 and smaller or equal to 50.');
58
        }
59
        if (!is_string($value)) {
60
            throw new LiftSdkException('Argument must be an instance of string.');
61
        }
62
        $this['event_udf'.$num] = $value;
63
64
        return $this;
65
    }
66
67
    /**
68
     * Set the 'touch_udf#' field.
69
     *
70
     * @param int    $num   Which field to fetch. Can be from 1 till 20
71
     * @param string $value Custom fields for the Acquia Lift Touch Capture Phase
72
     *
73
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
74
     *
75
     * @return \Acquia\LiftClient\Entity\Capture
76
     */
77 View Code Duplication
    public function setTouchUdf($num, $value)
78
    {
79
        if (!is_int($num)) {
80
            throw new LiftSdkException('Argument must be an instance of integer.');
81
        }
82
        if ($num < 1 || $num > self::TOUCH_UDF_COUNT) {
83
            throw new LiftSdkException('Argument must be greater than 0 and smaller or equal to 50.');
84
        }
85
        if (!is_string($value)) {
86
            throw new LiftSdkException('Argument must be an instance of string.');
87
        }
88
        $this['event_udf'.$num] = $value;
89
90
        return $this;
91
    }
92
93
    /**
94
     * Sets the 'event_name' parameter.
95
     *
96
     * @param string $eventName Event name corresponding to the captured information - the event type matching this
97
     *                          event name must match the master list of events created in Acquia Lift Web
98
     *
99
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
100
     *
101
     * @return \Acquia\LiftClient\Entity\Capture
102
     */
103
    public function setEventName($eventName)
104
    {
105
        if (!is_string($eventName)) {
106
            throw new LiftSdkException('Argument must be an instance of string.');
107
        }
108
        $this['event_name'] = $eventName;
109
110
        return $this;
111
    }
112
113
    /**
114
     * Sets the 'event_source' parameter.
115
     *
116
     * @param string $eventSource Source of the event - can be used to pass event data from tools you have set up to
117
     *                            send data to Acquia Lift Web (the default Acquia Lift Web value is web; depending on
118
     *                            your website's configuration, examples may include csrtool1 and promo1)
119
     *
120
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
121
     *
122
     * @return \Acquia\LiftClient\Entity\Capture
123
     */
124
    public function setEventSource($eventSource)
125
    {
126
        if (!is_string($eventSource)) {
127
            throw new LiftSdkException('Argument must be an instance of string.');
128
        }
129
        $this['event_source'] = $eventSource;
130
131
        return $this;
132
    }
133
134
    /**
135
     * Sets the 'event_date' parameter.
136
     *
137
     * @param DateTime $eventDate
138
     *
139
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
140
     *
141
     * @return \Acquia\LiftClient\Entity\Capture
142
     */
143
    public function setEventDate(DateTime $eventDate)
144
    {
145
        $this['event_date'] = $eventDate->format('Y-m-d H:i:s.u');
146
147
        return $this;
148
    }
149
150
    /**
151
     * Sets the 'identities' parameter.
152
     *
153
     * @param array $identities Additional identity information
154
     *
155
     * Example of how to structure the $identities parameter:
156
     * <code>
157
     * $options = [
158
     *     '[email protected]'  => 'email',
159
     *     'John Smith' => 'name',
160
     * ];
161
     * </code>
162
     *
163
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
164
     *
165
     * @return \Acquia\LiftClient\Entity\Capture
166
     */
167
    public function setIdentities(array $identities)
168
    {
169
        if (Utility::arrayDepth($identities) > 1) {
170
            throw new LiftSdkException('Identities argument is more than 1 level deep.');
171
        }
172
        $this['identities'] = $identities;
173
174
        return $this;
175
    }
176
177
    /**
178
     * Sets the 'url' parameter.
179
     *
180
     * @param string $url Event's URL
181
     *
182
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
183
     *
184
     * @return \Acquia\LiftClient\Entity\Capture
185
     */
186 View Code Duplication
    public function setUrl($url)
187
    {
188
        if (!is_string($url)) {
189
            throw new LiftSdkException('Argument must be an instance of string.');
190
        }
191
        $this['url'] = $url;
192
193
        return $this;
194
    }
195
196
    /**
197
     * Sets the 'site_id' parameter.
198
     *
199
     * @param string $siteId The customer site matching external_site_id in the configuration database
200
     *
201
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
202
     *
203
     * @return \Acquia\LiftClient\Entity\Capture
204
     */
205 View Code Duplication
    public function setSiteId($siteId)
206
    {
207
        if (!is_string($siteId)) {
208
            throw new LiftSdkException('Argument must be an instance of string.');
209
        }
210
        $this['site_id'] = $siteId;
211
212
        return $this;
213
    }
214
215
    /**
216
     * Sets the 'referral_url' parameter.
217
     *
218
     * @param string $referralUrl Referrer's URL
219
     *
220
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
221
     *
222
     * @return \Acquia\LiftClient\Entity\Capture
223
     */
224
    public function setReferralUrl($referralUrl)
225
    {
226
        if (!is_string($referralUrl)) {
227
            throw new LiftSdkException('Argument must be an instance of string.');
228
        }
229
        $this['referral_url'] = $referralUrl;
230
231
        return $this;
232
    }
233
234
    /**
235
     * Sets the 'content_title' parameter.
236
     *
237
     * @param string $contentTitle Page title
238
     *
239
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
240
     *
241
     * @return \Acquia\LiftClient\Entity\Capture
242
     */
243
    public function setContentTitle($contentTitle)
244
    {
245
        if (!is_string($contentTitle)) {
246
            throw new LiftSdkException('Argument must be an instance of string.');
247
        }
248
        $this['content_title'] = $contentTitle;
249
250
        return $this;
251
    }
252
253
    /**
254
     * Sets the 'user_agent' parameter.
255
     *
256
     * @param string $userAgent Visitor's user agent
257
     *
258
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
259
     *
260
     * @return \Acquia\LiftClient\Entity\Capture
261
     */
262
    public function setUserAgent($userAgent)
263
    {
264
        if (!is_string($userAgent)) {
265
            throw new LiftSdkException('Argument must be an instance of string.');
266
        }
267
        $this['user_agent'] = $userAgent;
268
269
        return $this;
270
    }
271
272
    /**
273
     * Sets the 'platform' parameter.
274
     *
275
     * @param string $platform Visitor's platform
276
     *
277
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
278
     *
279
     * @return \Acquia\LiftClient\Entity\Capture
280
     */
281
    public function setPlatform($platform)
282
    {
283
        if (!is_string($platform)) {
284
            throw new LiftSdkException('Argument must be an instance of string.');
285
        }
286
        $this['platform'] = $platform;
287
288
        return $this;
289
    }
290
291
    /**
292
     * Sets the 'ip_address' parameter.
293
     *
294
     * @param string $ipAddress Visitor's IP address (supports both IPv4 and IPv6 addresses)
295
     *
296
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
297
     *
298
     * @return \Acquia\LiftClient\Entity\Capture
299
     */
300
    public function setIpAddress($ipAddress)
301
    {
302
        if (!is_string($ipAddress)) {
303
            throw new LiftSdkException('Argument must be an instance of string.');
304
        }
305
        $this['ip_address'] = $ipAddress;
306
307
        return $this;
308
    }
309
310
    /**
311
     * Sets the 'persona' parameter.
312
     *
313
     * @param string $persona User-defined category into which a visitor fits, based on their viewing of particular
314
     *                        content
315
     *
316
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
317
     *
318
     * @return \Acquia\LiftClient\Entity\Capture
319
     */
320
    public function setPersona($persona)
321
    {
322
        if (!is_string($persona)) {
323
            throw new LiftSdkException('Argument must be an instance of string.');
324
        }
325
        $this['persona'] = $persona;
326
327
        return $this;
328
    }
329
330
    /**
331
     * Sets the 'engagement_score' parameter.
332
     *
333
     * @param int $engagementScore The number that you have chosen to signify the importance of a visitor's interest in
334
     *                             an event
335
     *
336
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
337
     *
338
     * @return \Acquia\LiftClient\Entity\Capture
339
     */
340
    public function setEngagementScore($engagementScore)
341
    {
342
        if (!is_integer($engagementScore)) {
343
            throw new LiftSdkException('Argument must be an instance of integer.');
344
        }
345
        $this['engagement_score'] = $engagementScore;
346
347
        return $this;
348
    }
349
350
    /**
351
     * Sets the 'personalization_name' parameter.
352
     *
353
     * @param string $personalizationName Name of personalization associated with an event
354
     *
355
     * @deprecated Only used in Lift 2. For Lift 3, please use fields with prefix decision
356
     *
357
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
358
     *
359
     * @return \Acquia\LiftClient\Entity\Capture
360
     */
361
    public function setPersonalizationName($personalizationName)
362
    {
363
        if (!is_string($personalizationName)) {
364
            throw new LiftSdkException('Argument must be an instance of string.');
365
        }
366
        $this['personalization_name'] = $personalizationName;
367
368
        return $this;
369
    }
370
371
    /**
372
     * Sets the 'personalization_machine_name' parameter.
373
     *
374
     * @param string $personalizationMachineName Machine name of personalization associated with an event
375
     *
376
     * @deprecated Only used in Lift 2. For Lift 3, please use fields with prefix decision
377
     *
378
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
379
     *
380
     * @return \Acquia\LiftClient\Entity\Capture
381
     */
382
    public function setPersonalizationMachineName($personalizationMachineName)
383
    {
384
        if (!is_string($personalizationMachineName)) {
385
            throw new LiftSdkException('Argument must be an instance of string.');
386
        }
387
        $this['personalization_machine_name'] = $personalizationMachineName;
388
389
        return $this;
390
    }
391
392
    /**
393
     * Sets the 'personalization_chosen_variation' parameter.
394
     *
395
     * @param string $personalizationChosenVariation The variation (decision) chosen for an event
396
     *
397
     * @deprecated Only used in Lift 2. For Lift 3, please use fields with prefix decision
398
     *
399
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
400
     *
401
     * @return \Acquia\LiftClient\Entity\Capture
402
     */
403
    public function setPersonalizationChosenVariation($personalizationChosenVariation)
404
    {
405
        if (!is_string($personalizationChosenVariation)) {
406
            throw new LiftSdkException('Argument must be an instance of string.');
407
        }
408
        $this['personalization_chosen_variation'] = $personalizationChosenVariation;
409
410
        return $this;
411
    }
412
413
    /**
414
     * Sets the 'personalization_audience_name' parameter.
415
     *
416
     * @param string $personalizationAudienceName The name of the audience
417
     *
418
     * @deprecated Only used in Lift 2. For Lift 3, please use fields with prefix decision
419
     *
420
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
421
     *
422
     * @return \Acquia\LiftClient\Entity\Capture
423
     */
424
    public function setPersonalizationAudienceName($personalizationAudienceName)
425
    {
426
        if (!is_string($personalizationAudienceName)) {
427
            throw new LiftSdkException('Argument must be an instance of string.');
428
        }
429
        $this['personalization_audience_name'] = $personalizationAudienceName;
430
431
        return $this;
432
    }
433
434
    /**
435
     * Sets the 'personalization_decision_policy' parameter.
436
     *
437
     * @param string $personalizationDecisionPolicy The decision policy used - for example, explore or target
438
     *
439
     * @deprecated Only used in Lift 2. For Lift 3, please use fields with prefix decision
440
     *
441
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
442
     *
443
     * @return \Acquia\LiftClient\Entity\Capture
444
     */
445
    public function setPersonalizationDecisionPolicy($personalizationDecisionPolicy)
446
    {
447
        if (!is_string($personalizationDecisionPolicy)) {
448
            throw new LiftSdkException('Argument must be an instance of string.');
449
        }
450
        $this['personalization_decision_policy'] = $personalizationDecisionPolicy;
451
452
        return $this;
453
    }
454
455
    /**
456
     * Sets the 'personalization_goal_name' parameter.
457
     *
458
     * @param string $personalizationGoalName The name of the goal reached
459
     *
460
     * @deprecated Only used in Lift 2. For Lift 3, please use fields with prefix decision
461
     *
462
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
463
     *
464
     * @return \Acquia\LiftClient\Entity\Capture
465
     */
466
    public function setPersonalizationGoalName($personalizationGoalName)
467
    {
468
        if (!is_string($personalizationGoalName)) {
469
            throw new LiftSdkException('Argument must be an instance of string.');
470
        }
471
        $this['personalization_goal_name'] = $personalizationGoalName;
472
473
        return $this;
474
    }
475
476
    /**
477
     * Sets the 'personalization_goal_value' parameter.
478
     *
479
     * @param string $personalizationGoalValue The value of the goal reached
480
     *
481
     * @deprecated Only used in Lift 2. For Lift 3, please use fields with prefix decision
482
     *
483
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
484
     *
485
     * @return \Acquia\LiftClient\Entity\Capture
486
     */
487
    public function setPersonalizationGoalValue($personalizationGoalValue)
488
    {
489
        if (!is_string($personalizationGoalValue)) {
490
            throw new LiftSdkException('Argument must be an instance of string.');
491
        }
492
        $this['personalization_goal_value'] = $personalizationGoalValue;
493
494
        return $this;
495
    }
496
497
    /**
498
     * Sets the 'decision_slot_id' parameter.
499
     *
500
     * @param string $decisionSlotId Decision Slot Id
501
     *
502
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
503
     *
504
     * @return \Acquia\LiftClient\Entity\Capture
505
     */
506
    public function setDecisionSlotId($decisionSlotId)
507
    {
508
        if (!is_string($decisionSlotId)) {
509
            throw new LiftSdkException('Argument must be an instance of string.');
510
        }
511
        $this['decision_slot_id'] = $decisionSlotId;
512
513
        return $this;
514
    }
515
516
    /**
517
     * Sets the 'decision_slot_name' parameter.
518
     *
519
     * @param string $decisionSlotName Decision Slot Name
520
     *
521
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
522
     *
523
     * @return \Acquia\LiftClient\Entity\Capture
524
     */
525
    public function setDecisionSlotName($decisionSlotName)
526
    {
527
        if (!is_string($decisionSlotName)) {
528
            throw new LiftSdkException('Argument must be an instance of string.');
529
        }
530
        $this['decision_slot_name'] = $decisionSlotName;
531
532
        return $this;
533
    }
534
535
    /**
536
     * Sets the 'decision_rule_id' parameter.
537
     *
538
     * @param string $decisionRuleId Decision Slot Name
539
     *
540
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
541
     *
542
     * @return \Acquia\LiftClient\Entity\Capture
543
     */
544
    public function setDecisionRuleId($decisionRuleId)
545
    {
546
        if (!is_string($decisionRuleId)) {
547
            throw new LiftSdkException('Argument must be an instance of string.');
548
        }
549
        $this['decision_rule_id'] = $decisionRuleId;
550
551
        return $this;
552
    }
553
554
    /**
555
     * Sets the 'decision_rule_name' parameter.
556
     *
557
     * @param string $decisionRuleName Decision Slot Name
558
     *
559
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
560
     *
561
     * @return \Acquia\LiftClient\Entity\Capture
562
     */
563
    public function setDecisionRuleName($decisionRuleName)
564
    {
565
        if (!is_string($decisionRuleName)) {
566
            throw new LiftSdkException('Argument must be an instance of string.');
567
        }
568
        $this['decision_rule_name'] = $decisionRuleName;
569
570
        return $this;
571
    }
572
573
    /**
574
     * Sets the 'decision_content_id' parameter.
575
     *
576
     * @param string $decisionContentId Decision Content Id
577
     *
578
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
579
     *
580
     * @return \Acquia\LiftClient\Entity\Capture
581
     */
582
    public function setDecisionContentId($decisionContentId)
583
    {
584
        if (!is_string($decisionContentId)) {
585
            throw new LiftSdkException('Argument must be an instance of string.');
586
        }
587
        $this['decision_content_id'] = $decisionContentId;
588
589
        return $this;
590
    }
591
592
    /**
593
     * Sets the 'decision_content_name' parameter.
594
     *
595
     * @param string $decisionContentName Decision Content Name
596
     *
597
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
598
     *
599
     * @return \Acquia\LiftClient\Entity\Capture
600
     */
601
    public function setDecisionContentName($decisionContentName)
602
    {
603
        if (!is_string($decisionContentName)) {
604
            throw new LiftSdkException('Argument must be an instance of string.');
605
        }
606
        $this['decision_content_name'] = $decisionContentName;
607
608
        return $this;
609
    }
610
611
    /**
612
     * Sets the 'decision_goal_id' parameter.
613
     *
614
     * @param string $decisionGoalId Decision Goal Id
615
     *
616
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
617
     *
618
     * @return \Acquia\LiftClient\Entity\Capture
619
     */
620
    public function setDecisionGoalId($decisionGoalId)
621
    {
622
        if (!is_string($decisionGoalId)) {
623
            throw new LiftSdkException('Argument must be an instance of string.');
624
        }
625
        $this['decision_goal_id'] = $decisionGoalId;
626
627
        return $this;
628
    }
629
630
    /**
631
     * Sets the 'decision_goal_name' parameter.
632
     *
633
     * @param string $decisionGoalName Decision Goal Name
634
     *
635
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
636
     *
637
     * @return \Acquia\LiftClient\Entity\Capture
638
     */
639
    public function setDecisionGoalName($decisionGoalName)
640
    {
641
        if (!is_string($decisionGoalName)) {
642
            throw new LiftSdkException('Argument must be an instance of string.');
643
        }
644
        $this['decision_goal_name'] = $decisionGoalName;
645
646
        return $this;
647
    }
648
649
    /**
650
     * Sets the 'decision_goal_value' parameter.
651
     *
652
     * @param string $decisionGoalValue Decision Goal Value
653
     *
654
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
655
     *
656
     * @return \Acquia\LiftClient\Entity\Capture
657
     */
658
    public function setDecisionGoalValue($decisionGoalValue)
659
    {
660
        if (!is_string($decisionGoalValue)) {
661
            throw new LiftSdkException('Argument must be an instance of string.');
662
        }
663
        $this['decision_goal_value'] = $decisionGoalValue;
664
665
        return $this;
666
    }
667
668
    /**
669
     * Sets the 'decision_view_mode' parameter.
670
     *
671
     * @param string $decisionViewMode Decision View Mode
672
     *
673
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
674
     *
675
     * @return \Acquia\LiftClient\Entity\Capture
676
     */
677
    public function setDecisionViewMode($decisionViewMode)
678
    {
679
        if (!is_string($decisionViewMode)) {
680
            throw new LiftSdkException('Argument must be an instance of string.');
681
        }
682
        $this['decision_view_mode'] = $decisionViewMode;
683
684
        return $this;
685
    }
686
687
    /**
688
     * Sets the 'decision_policy' parameter.
689
     *
690
     * @param string $decisionPolicy The decision policy used - for example, explore or target
691
     *
692
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
693
     *
694
     * @return \Acquia\LiftClient\Entity\Capture
695
     */
696
    public function setDecisionPolicy($decisionPolicy)
697
    {
698
        if (!is_string($decisionPolicy)) {
699
            throw new LiftSdkException('Argument must be an instance of string.');
700
        }
701
        $this['decision_policy'] = $decisionPolicy;
702
703
        return $this;
704
    }
705
706
    /**
707
     * Sets the 'capture_identifier' parameter.
708
     *
709
     * @param string $captureIdentifier Unique identifier for the capture
710
     *
711
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
712
     *
713
     * @return \Acquia\LiftClient\Entity\Capture
714
     */
715
    public function setCaptureIdentifier($captureIdentifier)
716
    {
717
        if (!is_string($captureIdentifier)) {
718
            throw new LiftSdkException('Argument must be an instance of string.');
719
        }
720
        $this['capture_identifier'] = $captureIdentifier;
721
722
        return $this;
723
    }
724
725
    /**
726
     * Sets the 'client_timezone' parameter.
727
     *
728
     * @param string $clientTimezone Client Timezone
729
     *
730
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
731
     *
732
     * @return \Acquia\LiftClient\Entity\Capture
733
     */
734
    public function setClientTimezone($clientTimezone)
735
    {
736
        if (!is_string($clientTimezone)) {
737
            throw new LiftSdkException('Argument must be an instance of string.');
738
        }
739
        $this['client_timezone'] = $clientTimezone;
740
741
        return $this;
742
    }
743
744
    /**
745
     * Sets the 'javascript_version' parameter.
746
     *
747
     * @param string $javascriptVersion version of the javascript that generated the capture
748
     *
749
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
750
     *
751
     * @return \Acquia\LiftClient\Entity\Capture
752
     */
753
    public function setJavascriptVersion($javascriptVersion)
754
    {
755
        if (!is_string($javascriptVersion)) {
756
            throw new LiftSdkException('Argument must be an instance of string.');
757
        }
758
        $this['javascript_version'] = $javascriptVersion;
759
760
        return $this;
761
    }
762
763
    /**
764
     * Sets the 'post_id' parameter.
765
     *
766
     * @param string $postId Post id of an article
767
     *
768
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
769
     *
770
     * @return \Acquia\LiftClient\Entity\Capture
771
     */
772
    public function setPostId($postId)
773
    {
774
        if (!is_string($postId)) {
775
            throw new LiftSdkException('Argument must be an instance of string.');
776
        }
777
        $this['post_id'] = $postId;
778
779
        return $this;
780
    }
781
782
    /**
783
     * Sets the 'content_id' parameter.
784
     *
785
     * @param string $contentId Content id of an article
786
     *
787
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
788
     *
789
     * @return \Acquia\LiftClient\Entity\Capture
790
     */
791 View Code Duplication
    public function setContentId($contentId)
792
    {
793
        if (!is_string($contentId)) {
794
            throw new LiftSdkException('Argument must be an instance of string.');
795
        }
796
        $this['content_id'] = $contentId;
797
798
        return $this;
799
    }
800
801
    /**
802
     * Sets the 'content_type' parameter.
803
     *
804
     * @param string $contentType Content-type to which a piece of visitor-viewed content belongs
805
     *
806
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
807
     *
808
     * @return \Acquia\LiftClient\Entity\Capture
809
     */
810
    public function setContentType($contentType)
811
    {
812
        if (!is_string($contentType)) {
813
            throw new LiftSdkException('Argument must be an instance of string.');
814
        }
815
        $this['content_type'] = $contentType;
816
817
        return $this;
818
    }
819
820
    /**
821
     * Sets the 'content_section' parameter.
822
     *
823
     * @param string $contentSection Content section of an article
824
     *
825
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
826
     *
827
     * @return \Acquia\LiftClient\Entity\Capture
828
     */
829
    public function setContentSection($contentSection)
830
    {
831
        if (!is_string($contentSection)) {
832
            throw new LiftSdkException('Argument must be an instance of string.');
833
        }
834
        $this['content_section'] = $contentSection;
835
836
        return $this;
837
    }
838
839
    /**
840
     * Sets the 'content_keywords' parameter.
841
     *
842
     * @param string $contentKeywords Content keywords of an article
843
     *
844
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
845
     *
846
     * @return \Acquia\LiftClient\Entity\Capture
847
     */
848
    public function setContentKeywords($contentKeywords)
849
    {
850
        if (!is_string($contentKeywords)) {
851
            throw new LiftSdkException('Argument must be an instance of string.');
852
        }
853
        $this['content_keywords'] = $contentKeywords;
854
855
        return $this;
856
    }
857
858
    /**
859
     * Sets the 'author' parameter.
860
     *
861
     * @param string $author Author of an article
862
     *
863
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
864
     *
865
     * @return \Acquia\LiftClient\Entity\Capture
866
     */
867
    public function setAuthor($author)
868
    {
869
        if (!is_string($author)) {
870
            throw new LiftSdkException('Argument must be an instance of string.');
871
        }
872
        $this['author'] = $author;
873
874
        return $this;
875
    }
876
877
    /**
878
     * Sets the 'page_type' parameter.
879
     *
880
     * @param string $pageType Category of page the visitor viewed (examples include article page, tag page, and home page)
881
     *
882
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
883
     *
884
     * @return \Acquia\LiftClient\Entity\Capture
885
     */
886
    public function setPageType($pageType)
887
    {
888
        if (!is_string($pageType)) {
889
            throw new LiftSdkException('Argument must be an instance of string.');
890
        }
891
        $this['page_type'] = $pageType;
892
893
        return $this;
894
    }
895
896
    /**
897
     * Sets the 'thumbnail_url' parameter.
898
     *
899
     * @param string $thumbnailUrl Thumbnail URL of an article
900
     *
901
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
902
     *
903
     * @return \Acquia\LiftClient\Entity\Capture
904
     */
905
    public function setThumbnailUrl($thumbnailUrl)
906
    {
907
        if (!is_string($thumbnailUrl)) {
908
            throw new LiftSdkException('Argument must be an instance of string.');
909
        }
910
        $this['thumbnail_url'] = $thumbnailUrl;
911
912
        return $this;
913
    }
914
915
    /**
916
     * Sets the 'published_date' parameter.
917
     *
918
     * @param DateTime $publishedDate Publish date of an article
919
     *
920
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
921
     *
922
     * @return \Acquia\LiftClient\Entity\Capture
923
     */
924
    public function setPublishedDate(DateTime $publishedDate)
925
    {
926
        $this['published_date'] = $publishedDate->format('Y-m-d H:i:s.u');
927
928
        return $this;
929
    }
930
}
931