|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Acquia\LiftClient\Entity; |
|
4
|
|
|
|
|
5
|
|
|
use Acquia\LiftClient\Exception\LiftSdkException; |
|
6
|
|
|
use Acquia\LiftClient\Utility\Utility; |
|
7
|
|
|
|
|
8
|
|
|
class Decide extends Entity |
|
9
|
|
|
{ |
|
10
|
|
|
/** |
|
11
|
|
|
* Sets the 'slots' parameter. |
|
12
|
|
|
* |
|
13
|
|
|
* @param array $slotIds list of slot identifiers we want a decision for |
|
14
|
|
|
* |
|
15
|
|
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
|
16
|
|
|
* |
|
17
|
|
|
* @return \Acquia\LiftClient\Entity\Decide |
|
18
|
|
|
*/ |
|
19
|
|
|
public function setSlots(array $slotIds) |
|
20
|
|
|
{ |
|
21
|
|
|
if (Utility::arrayDepth($slotIds) > 1) { |
|
22
|
|
|
throw new LiftSdkException('Slot Ids argument is more than 1 level deep.'); |
|
23
|
|
|
} |
|
24
|
|
|
$this['slots'] = $slotIds; |
|
25
|
|
|
|
|
26
|
|
|
return $this; |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Sets the 'do_not_track' parameter. |
|
31
|
|
|
* |
|
32
|
|
|
* @param bool $doNotTrack Flag to indicate whether the person should not be tracked |
|
33
|
|
|
* |
|
34
|
|
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
|
35
|
|
|
* |
|
36
|
|
|
* @return \Acquia\LiftClient\Entity\Decide |
|
37
|
|
|
*/ |
|
38
|
|
View Code Duplication |
public function setDoNotTrack($doNotTrack) |
|
39
|
|
|
{ |
|
40
|
|
|
if (!is_bool($doNotTrack)) { |
|
41
|
|
|
throw new LiftSdkException('Argument must be an instance of boolean.'); |
|
42
|
|
|
} |
|
43
|
|
|
$this['do_not_track'] = $doNotTrack; |
|
44
|
|
|
|
|
45
|
|
|
return $this; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* Sets the 'url' parameter. |
|
50
|
|
|
* |
|
51
|
|
|
* @param string $url The url where we want to get decisions for |
|
52
|
|
|
* |
|
53
|
|
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
|
54
|
|
|
* |
|
55
|
|
|
* @return \Acquia\LiftClient\Entity\Decide |
|
56
|
|
|
*/ |
|
57
|
|
|
public function setUrl($url) |
|
58
|
|
|
{ |
|
59
|
|
|
if (!is_string($url)) { |
|
60
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
|
61
|
|
|
} |
|
62
|
|
|
$this['url'] = $url; |
|
63
|
|
|
|
|
64
|
|
|
return $this; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* Sets the 'touch_identifier' parameter. |
|
69
|
|
|
* |
|
70
|
|
|
* @param string $touchIdentifier Internal identifier for the touch, if this field is left empty, lift will |
|
71
|
|
|
* generate a touch identifier and include it in the response |
|
72
|
|
|
* |
|
73
|
|
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
|
74
|
|
|
* |
|
75
|
|
|
* @return \Acquia\LiftClient\Entity\Decide |
|
76
|
|
|
*/ |
|
77
|
|
View Code Duplication |
public function setTouchIdentifier($touchIdentifier) |
|
78
|
|
|
{ |
|
79
|
|
|
if (!is_string($touchIdentifier)) { |
|
80
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
|
81
|
|
|
} |
|
82
|
|
|
$this['touch_identifier'] = $touchIdentifier; |
|
83
|
|
|
|
|
84
|
|
|
return $this; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* Sets the 'identity' parameter. |
|
89
|
|
|
* |
|
90
|
|
|
* @param string $identity Visitor's primary identity information |
|
91
|
|
|
* |
|
92
|
|
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
|
93
|
|
|
* |
|
94
|
|
|
* @return \Acquia\LiftClient\Entity\Decide |
|
95
|
|
|
*/ |
|
96
|
|
|
public function setIdentity($identity) |
|
97
|
|
|
{ |
|
98
|
|
|
if (!is_string($identity)) { |
|
99
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
|
100
|
|
|
} |
|
101
|
|
|
$this['identity'] = $identity; |
|
102
|
|
|
|
|
103
|
|
|
return $this; |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
/** |
|
107
|
|
|
* Sets the 'identity_source' parameter. |
|
108
|
|
|
* |
|
109
|
|
|
* @param string $identitySource Type of visitor's primary identity information. Specific string (account, email, |
|
110
|
|
|
* facebook, twitter, tracking, name) or custom identifier type |
|
111
|
|
|
* |
|
112
|
|
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
|
113
|
|
|
* |
|
114
|
|
|
* @return \Acquia\LiftClient\Entity\Decide |
|
115
|
|
|
*/ |
|
116
|
|
View Code Duplication |
public function setIdentitySource($identitySource) |
|
117
|
|
|
{ |
|
118
|
|
|
if (!is_string($identitySource)) { |
|
119
|
|
|
throw new LiftSdkException('Argument must be an instance of string.'); |
|
120
|
|
|
} |
|
121
|
|
|
$this['identity_source'] = $identitySource; |
|
122
|
|
|
|
|
123
|
|
|
return $this; |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
/** |
|
127
|
|
|
* Sets the 'captures' parameter. |
|
128
|
|
|
* |
|
129
|
|
|
* @param Capture[] $captures List of captures |
|
130
|
|
|
* |
|
131
|
|
|
* @throws \Acquia\LiftClient\Exception\LiftSdkException |
|
132
|
|
|
* |
|
133
|
|
|
* @return \Acquia\LiftClient\Entity\Captures |
|
134
|
|
|
*/ |
|
135
|
|
View Code Duplication |
public function setCaptures($captures) |
|
136
|
|
|
{ |
|
137
|
|
|
$this['captures'] = []; |
|
138
|
|
|
foreach ($captures as $capture) { |
|
139
|
|
|
$this['captures'][] = $capture->getArrayCopy(); |
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
return $this; |
|
143
|
|
|
} |
|
144
|
|
|
} |
|
145
|
|
|
|