1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the Mediapart Selligent Client API |
5
|
|
|
* |
6
|
|
|
* CC BY-NC-SA <https://github.com/mediapart/selligent> |
7
|
|
|
* |
8
|
|
|
* For the full license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Mediapart\Selligent\Broadcast; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* |
16
|
|
|
*/ |
17
|
|
|
class Target |
18
|
|
|
{ |
19
|
|
|
const SORTING_ASC = 'ASC'; |
20
|
|
|
const SORTING_DESC = 'DESC'; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var The ID of the selected list as target for the journey map. |
24
|
|
|
*/ |
25
|
|
|
private $listId; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var string The field on which the pickup priority for broadcasting is based. |
29
|
|
|
*/ |
30
|
|
|
private $priorityField; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var string The sorting applied to the pickup priority field. |
34
|
|
|
*/ |
35
|
|
|
private $prioritySorting; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var integer If selected, the ID of the related segment to be used. |
39
|
|
|
*/ |
40
|
|
|
private $segmentId; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var string The constraint defined on the targets. |
44
|
|
|
*/ |
45
|
|
|
private $constraint; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var Array The profile extensions to include in the target. |
49
|
|
|
*/ |
50
|
|
|
private $scopes; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* |
54
|
|
|
*/ |
55
|
2 |
|
public function __construct() |
56
|
|
|
{ |
57
|
2 |
|
$this->scopes = []; |
58
|
2 |
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @param integer The ID of the selected list as target for the journey map. |
62
|
|
|
* @return self |
63
|
|
|
*/ |
64
|
1 |
|
public function setListId($listId) |
65
|
|
|
{ |
66
|
1 |
|
$this->listId = $listId; |
67
|
|
|
|
68
|
1 |
|
return $this; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @return integer The ID of the selected list as target for the journey map. |
73
|
|
|
*/ |
74
|
1 |
|
public function getListId() |
75
|
|
|
{ |
76
|
1 |
|
return $this->listId; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @param string The field on which the pickup priority for broadcasting is based. |
81
|
|
|
* @return self |
82
|
|
|
*/ |
83
|
1 |
|
public function setPriorityField($priorityField) |
84
|
|
|
{ |
85
|
1 |
|
$this->priorityField = $priorityField; |
86
|
|
|
|
87
|
1 |
|
return $this; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @return string The field on which the pickup priority for broadcasting is based. |
92
|
|
|
*/ |
93
|
1 |
|
public function getPriorityField() |
94
|
|
|
{ |
95
|
1 |
|
return $this->priorityField; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @param string The sorting applied to the pickup priority field. Possible values are ASC and DESC. |
100
|
|
|
* @throws \InvalidArgumentException |
101
|
|
|
* @return self |
102
|
|
|
*/ |
103
|
2 |
|
public function setPrioritySorting($prioritySorting) |
104
|
|
|
{ |
105
|
2 |
|
$possibles = [self::SORTING_ASC, self::SORTING_DESC]; |
106
|
|
|
|
107
|
2 |
|
if (in_array($prioritySorting, $possibles)) { |
108
|
1 |
|
$this->prioritySorting = $prioritySorting; |
109
|
1 |
|
} else { |
110
|
1 |
|
throw new \InvalidArgumentException(); |
111
|
|
|
} |
112
|
|
|
|
113
|
1 |
|
return $this; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @return string The sorting applied to the pickup priority field. |
118
|
|
|
*/ |
119
|
1 |
|
public function getPrioritySorting() |
120
|
|
|
{ |
121
|
1 |
|
return $this->prioritySorting; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @param integer $segmentId If selected, the ID of the related segment to be used. |
126
|
|
|
* @return self |
127
|
|
|
*/ |
128
|
1 |
|
public function setSegmentId($segmentId) |
129
|
|
|
{ |
130
|
1 |
|
$this->segmentId = $segmentId; |
131
|
|
|
|
132
|
1 |
|
return $this; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* @return integer If selected, the ID of the related segment to be used. |
137
|
|
|
*/ |
138
|
1 |
|
public function getSegmentId() |
139
|
|
|
{ |
140
|
1 |
|
return $this->segmentId; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* @param string The constraint defined on the targets. |
145
|
|
|
* @return self |
146
|
|
|
*/ |
147
|
1 |
|
public function setConstraint($constraint) |
148
|
|
|
{ |
149
|
1 |
|
$this->constraint = $constraint; |
150
|
|
|
|
151
|
1 |
|
return $this; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* @return string The constraint defined on the targets. |
156
|
|
|
*/ |
157
|
1 |
|
public function getConstraint() |
158
|
|
|
{ |
159
|
1 |
|
return $this->constraint; |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
/** |
163
|
|
|
* @param array The profile extensions to include in the target. |
164
|
|
|
* @return Array |
165
|
|
|
*/ |
166
|
1 |
|
public function setScopes($scopes = array()) |
167
|
|
|
{ |
168
|
1 |
|
$this->scopes = $scopes; |
169
|
|
|
|
170
|
1 |
|
return $this; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* @return string The profile extensions to include in the target. Multiple scopes are separated by a semi colon. |
175
|
|
|
*/ |
176
|
1 |
|
public function getScopes() |
177
|
|
|
{ |
178
|
1 |
|
$scopes = implode(';', $this->scopes); |
179
|
|
|
|
180
|
1 |
|
return $scopes; |
181
|
|
|
} |
182
|
|
|
} |
183
|
|
|
|