Completed
Push — master ( 58c347...8562e2 )
by Yuan
02:01
created

Capture::setContentUuid()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

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