1
|
|
|
<?php |
2
|
|
|
namespace Datatrics\API; |
3
|
|
|
|
4
|
|
|
class Client |
5
|
|
|
{ |
6
|
|
|
/** |
7
|
|
|
* Version of our client. |
8
|
|
|
*/ |
9
|
|
|
const CLIENT_VERSION = '2.0.0'; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Version of the remote API. |
13
|
|
|
*/ |
14
|
|
|
protected $api_version = '2.0'; |
15
|
|
|
/** |
16
|
|
|
* @var string |
17
|
|
|
*/ |
18
|
|
|
protected $api_key; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @var string |
22
|
|
|
*/ |
23
|
|
|
private $projectId; |
24
|
|
|
|
25
|
|
|
const HTTP_GET = 'GET'; |
26
|
|
|
const HTTP_POST = 'POST'; |
27
|
|
|
const HTTP_PUT = 'PUT'; |
28
|
|
|
const HTTP_DELETE = 'DELETE'; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var \Datatrics\API\Modules\Apikey |
32
|
|
|
*/ |
33
|
|
|
public $Apikey; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @var \Datatrics\API\Modules\Behavior |
37
|
|
|
*/ |
38
|
|
|
public $Behavior; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var \Datatrics\API\Modules\Box |
42
|
|
|
*/ |
43
|
|
|
public $Box; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @var \Datatrics\API\Modules\Bucket |
47
|
|
|
*/ |
48
|
|
|
public $Bucket; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @var \Datatrics\API\Modules\Campaign |
52
|
|
|
*/ |
53
|
|
|
public $Campaign; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @var \Datatrics\API\Modules\Card |
57
|
|
|
*/ |
58
|
|
|
public $Card; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @var \Datatrics\API\Modules\Channel |
62
|
|
|
*/ |
63
|
|
|
public $Channel; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @var \Datatrics\API\Modules\Content |
67
|
|
|
*/ |
68
|
|
|
public $Content; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @var \Datatrics\API\Modules\Geo |
72
|
|
|
*/ |
73
|
|
|
public $Geo; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @var \Datatrics\API\Modules\Goal |
77
|
|
|
*/ |
78
|
|
|
public $Goal; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @var \Datatrics\API\Modules\Interaction |
82
|
|
|
*/ |
83
|
|
|
public $Interaction; |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @var \Datatrics\API\Modules\Journey |
87
|
|
|
*/ |
88
|
|
|
public $Journey; |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @var \Datatrics\API\Modules\Link |
92
|
|
|
*/ |
93
|
|
|
public $Link; |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @var \Datatrics\API\Modules\NextBestAction |
97
|
|
|
*/ |
98
|
|
|
public $NextBestAction; |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @var \Datatrics\API\Modules\Profile |
102
|
|
|
*/ |
103
|
|
|
public $Profile; |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @var \Datatrics\API\Modules\Project |
107
|
|
|
*/ |
108
|
|
|
public $Project; |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @var \Datatrics\API\Modules\Sale |
112
|
|
|
*/ |
113
|
|
|
public $Sale; |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @var \Datatrics\API\Modules\Scorecard |
117
|
|
|
*/ |
118
|
|
|
public $Scorecard; |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @var \Datatrics\API\Modules\Segment |
122
|
|
|
*/ |
123
|
|
|
public $Segment; |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* @var \Datatrics\API\Modules\Template |
127
|
|
|
*/ |
128
|
|
|
public $Template; |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @var \Datatrics\API\Modules\Theme |
132
|
|
|
*/ |
133
|
|
|
public $Theme; |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* @var \Datatrics\API\Modules\Touchpoint |
137
|
|
|
*/ |
138
|
|
|
public $Touchpoint; |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @var \Datatrics\API\Modules\Tracker |
142
|
|
|
*/ |
143
|
|
|
public $Tracker; |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* @var \Datatrics\API\Modules\Tric |
147
|
|
|
*/ |
148
|
|
|
public $Tric; |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* @var \Datatrics\API\Modules\Trigger |
152
|
|
|
*/ |
153
|
|
|
public $Trigger; |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @var \Datatrics\API\Modules\User |
157
|
|
|
*/ |
158
|
|
|
public $User; |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* @var \Datatrics\API\Modules\Webook |
162
|
|
|
*/ |
163
|
|
|
public $Webhook; |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* Create a new API instance |
167
|
|
|
* @param string $apiKey |
168
|
|
|
* @param string $projectId |
169
|
|
|
*/ |
170
|
|
|
public function __construct($apiKey, $projectId) |
171
|
|
|
{ |
172
|
|
|
$this->SetApiKey($apiKey); |
173
|
|
|
$this->SetProjectId($projectId); |
174
|
|
|
|
175
|
|
|
$this->registerModules(); |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* @return string $api_version |
180
|
|
|
*/ |
181
|
|
|
public function GetApiVersion() |
182
|
|
|
{ |
183
|
|
|
return $this->api_version; |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* @param string $api_key |
|
|
|
|
188
|
|
|
*/ |
189
|
|
|
public function GetApiKey() |
190
|
|
|
{ |
191
|
|
|
return $this->api_key; |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
/** |
195
|
|
|
* @param string $api_key |
196
|
|
|
*/ |
197
|
|
|
public function SetApiKey($api_key) |
198
|
|
|
{ |
199
|
|
|
$this->api_key = $api_key; |
200
|
|
|
|
201
|
|
|
$this->registerModules(); |
202
|
|
|
} |
203
|
|
|
|
204
|
|
|
/** |
205
|
|
|
* @return string $projectId |
206
|
|
|
*/ |
207
|
|
|
public function GetProjectId() |
208
|
|
|
{ |
209
|
|
|
return $this->projectId; |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* @param string $projectId |
214
|
|
|
*/ |
215
|
|
|
public function SetProjectId($projectId) |
216
|
|
|
{ |
217
|
|
|
$this->projectId = $projectId; |
218
|
|
|
|
219
|
|
|
$this->registerModules(); |
220
|
|
|
} |
221
|
|
|
|
222
|
|
|
/** |
223
|
|
|
* Register modules |
224
|
|
|
*/ |
225
|
|
|
private function registerModules() |
226
|
|
|
{ |
227
|
|
|
$this->Apikey = new \Datatrics\API\Modules\Apikey($this->api_key); |
228
|
|
|
$this->Behavior = new \Datatrics\API\Modules\Behavior($this->api_key, $this->projectId); |
229
|
|
|
$this->Box = new \Datatrics\API\Modules\Box($this->api_key, $this->projectId); |
230
|
|
|
$this->Bucket = new \Datatrics\API\Modules\Bucket($this->api_key, $this->projectId); |
231
|
|
|
$this->Campaign = new \Datatrics\API\Modules\Campaign($this->api_key, $this->projectId); |
232
|
|
|
$this->Card = new \Datatrics\API\Modules\Card($this->api_key, $this->projectId); |
233
|
|
|
$this->Channel = new \Datatrics\API\Modules\Channel($this->api_key, $this->projectId); |
234
|
|
|
$this->Content = new \Datatrics\API\Modules\Content($this->api_key, $this->projectId); |
235
|
|
|
$this->Geo = new \Datatrics\API\Modules\Geo($this->api_key); |
236
|
|
|
$this->Goal = new \Datatrics\API\Modules\Goal($this->api_key, $this->projectId); |
237
|
|
|
$this->Interaction = new \Datatrics\API\Modules\Interaction($this->api_key, $this->projectId); |
238
|
|
|
$this->Journey = new \Datatrics\API\Modules\Journey($this->api_key, $this->projectId); |
239
|
|
|
$this->Link = new \Datatrics\API\Modules\Link($this->api_key, $this->projectId); |
240
|
|
|
$this->NextBestAction = new \Datatrics\API\Modules\NextBestAction($this->api_key, $this->projectId); |
241
|
|
|
$this->Profile = new \Datatrics\API\Modules\Profile($this->api_key, $this->projectId); |
242
|
|
|
$this->Project = new \Datatrics\API\Modules\Project($this->api_key); |
243
|
|
|
$this->Sale = new \Datatrics\API\Modules\Sale($this->api_key, $this->projectId); |
244
|
|
|
$this->Scorecard = new \Datatrics\API\Modules\Scorecard($this->api_key, $this->projectId); |
245
|
|
|
$this->Segment = new \Datatrics\API\Modules\Segment($this->api_key, $this->projectId); |
246
|
|
|
$this->Template = new \Datatrics\API\Modules\Template($this->api_key, $this->projectId); |
247
|
|
|
$this->Theme = new \Datatrics\API\Modules\Theme($this->api_key, $this->projectId); |
248
|
|
|
$this->Touchpoint = new \Datatrics\API\Modules\Touchpoint($this->api_key, $this->projectId); |
249
|
|
|
$this->Tracker = new \Datatrics\API\Modules\Tracker($this->api_key, $this->projectId); |
250
|
|
|
$this->Tric = new \Datatrics\API\Modules\Tric($this->api_key, $this->projectId); |
251
|
|
|
$this->Trigger = new \Datatrics\API\Modules\Trigger($this->api_key, $this->projectId); |
252
|
|
|
$this->User = new \Datatrics\API\Modules\User($this->api_key, $this->projectId); |
253
|
|
|
$this->Webhook = new \Datatrics\API\Modules\Webhook($this->api_key, $this->projectId); |
|
|
|
|
254
|
|
|
} |
255
|
|
|
} |
256
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.