@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | $subtype = gettype($value[0]); |
91 | - array_walk($value, function ($item) use ($subtype, $property) { |
|
91 | + array_walk($value, function($item) use ($subtype, $property) { |
|
92 | 92 | if (gettype($item) !== $subtype) { |
93 | - throw new \InvalidArgumentException('All array items have to be of the same type for metadata property '. $property); |
|
93 | + throw new \InvalidArgumentException('All array items have to be of the same type for metadata property '.$property); |
|
94 | 94 | } |
95 | 95 | }); |
96 | 96 | |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | } |
100 | 100 | $allowedSubtypes = ['boolean', 'number', 'string', 'object']; |
101 | 101 | if (!in_array($subtype, $allowedSubtypes)) { |
102 | - throw new \InvalidArgumentException('Unallowed type of '. $subtype .' for array item of metadata property '. $property); |
|
102 | + throw new \InvalidArgumentException('Unallowed type of '.$subtype.' for array item of metadata property '.$property); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | break; |
106 | 106 | |
107 | 107 | default: |
108 | - throw new \InvalidArgumentException('Unallowed type of '. $type .' for metadata property '. $property); |
|
108 | + throw new \InvalidArgumentException('Unallowed type of '.$type.' for metadata property '.$property); |
|
109 | 109 | break; |
110 | 110 | } |
111 | 111 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function update() |
133 | 133 | { |
134 | - $response = $this->client->put($this->endpoint .'/'. $this->id, [ |
|
134 | + $response = $this->client->put($this->endpoint.'/'.$this->id, [ |
|
135 | 135 | 'json' => $this->toArray() |
136 | 136 | ]); |
137 | 137 | |
@@ -146,14 +146,14 @@ discard block |
||
146 | 146 | public function delete() |
147 | 147 | { |
148 | 148 | try { |
149 | - $this->client->delete($this->endpoint .'/'. $this->id); |
|
149 | + $this->client->delete($this->endpoint.'/'.$this->id); |
|
150 | 150 | } catch (ClientException $e) { |
151 | 151 | $error = $e->getResponse()->json(); |
152 | 152 | $message = $error['message']['message']; |
153 | 153 | if (isset($error['message']['cause'])) { |
154 | - $message .= ' '. $error['message']['cause']; |
|
154 | + $message .= ' '.$error['message']['cause']; |
|
155 | 155 | } |
156 | - throw new \Exception('Unable to delete entity: '. $message); |
|
156 | + throw new \Exception('Unable to delete entity: '.$message); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | $this->id = null; |
@@ -11,57 +11,57 @@ |
||
11 | 11 | /** |
12 | 12 | * Task started by worker. Request includes: taskId, data.task |
13 | 13 | */ |
14 | - const TRIGGER_TASK_STARTED = 0; |
|
14 | + const TRIGGER_TASK_STARTED = 0; |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * Worker ETA less than or equal to notification threshold. Request includes: taskId, data.task |
18 | 18 | */ |
19 | - const TRIGGER_TASK_ETA = 1; |
|
19 | + const TRIGGER_TASK_ETA = 1; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Worker arriving, 150 meters away or closer. Request includes: taskId, data.task |
23 | 23 | */ |
24 | - const TRIGGER_TASK_ARRIVAL = 2; |
|
24 | + const TRIGGER_TASK_ARRIVAL = 2; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Task completed by worker. Request includes: taskId, data.task |
28 | 28 | */ |
29 | - const TRIGGER_TASK_COMPLETED = 3; |
|
29 | + const TRIGGER_TASK_COMPLETED = 3; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Task failed. Request includes: taskId, data.task |
33 | 33 | */ |
34 | - const TRIGGER_TASK_FAILED = 4; |
|
34 | + const TRIGGER_TASK_FAILED = 4; |
|
35 | 35 | |
36 | 36 | /** |
37 | 37 | * New task created. Request includes: taskId, data.task |
38 | 38 | */ |
39 | - const TRIGGER_TASK_CREATED = 6; |
|
39 | + const TRIGGER_TASK_CREATED = 6; |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * Task updated, including assignment changes. Request includes: taskId, data.task |
43 | 43 | */ |
44 | - const TRIGGER_TASK_UPDATED = 7; |
|
44 | + const TRIGGER_TASK_UPDATED = 7; |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Task deleted. Request includes: taskId |
48 | 48 | */ |
49 | - const TRIGGER_TASK_DELETED = 8; |
|
49 | + const TRIGGER_TASK_DELETED = 8; |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Task assigned to worker. Request includes: taskId, data.task |
53 | 53 | */ |
54 | - const TRIGGER_TASK_ASSIGNED = 9; |
|
54 | + const TRIGGER_TASK_ASSIGNED = 9; |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * Task unassigned from worker. Request includes: taskId, data.task |
58 | 58 | */ |
59 | - const TRIGGER_TASK_UNASSIGNED = 10; |
|
59 | + const TRIGGER_TASK_UNASSIGNED = 10; |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Worker status changed (0 for off-duty, 1 for on-duty). Request includes: workerId, status, data.worker |
63 | 63 | */ |
64 | - const TRIGGER_WORKER_DUTY = 5; |
|
64 | + const TRIGGER_WORKER_DUTY = 5; |
|
65 | 65 | |
66 | 66 | protected $url; |
67 | 67 | protected $trigger; |
@@ -433,7 +433,7 @@ |
||
433 | 433 | */ |
434 | 434 | public function complete($success = true, $notes = null) |
435 | 435 | { |
436 | - $this->client->post($this->endpoint .'/'. $this->id .'/complete', [ |
|
436 | + $this->client->post($this->endpoint.'/'.$this->id.'/complete', [ |
|
437 | 437 | 'json' => [ |
438 | 438 | 'completionDetails' => [ |
439 | 439 | 'success' => $success, |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
144 | - * @param mixed $merchant |
|
144 | + * @param string|null $merchant |
|
145 | 145 | */ |
146 | 146 | public function setMerchant($merchant) |
147 | 147 | { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
160 | - * @param mixed $executor |
|
160 | + * @param string|null $executor |
|
161 | 161 | */ |
162 | 162 | public function setExecutor($executor) |
163 | 163 | { |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | } |
366 | 366 | |
367 | 367 | /** |
368 | - * @param mixed $destination |
|
368 | + * @param string|null $destination |
|
369 | 369 | */ |
370 | 370 | public function setDestination($destination) |
371 | 371 | { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $request = $this->history->getLastRequest(); |
53 | 53 | $this->assertEquals('GET', $request->getMethod()); |
54 | 54 | |
55 | - $this->assertEquals($this->baseUrl . $path, $request->getUrl()); |
|
55 | + $this->assertEquals($this->baseUrl.$path, $request->getUrl()); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $this->assertEquals('POST', $request->getMethod()); |
68 | 68 | $this->assertEquals('application/json', $request->getHeader('Content-type')); |
69 | 69 | |
70 | - $this->assertEquals($this->baseUrl . $path, $request->getUrl()); |
|
70 | + $this->assertEquals($this->baseUrl.$path, $request->getUrl()); |
|
71 | 71 | |
72 | 72 | if (null !== $data) { |
73 | 73 | $payload = $request->getBody()->__toString(); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $this->assertEquals('PUT', $request->getMethod()); |
88 | 88 | $this->assertEquals('application/json', $request->getHeader('Content-type')); |
89 | 89 | |
90 | - $this->assertEquals($this->baseUrl . $path, $request->getUrl()); |
|
90 | + $this->assertEquals($this->baseUrl.$path, $request->getUrl()); |
|
91 | 91 | |
92 | 92 | if (null !== $data) { |
93 | 93 | $payload = $request->getBody()->__toString(); |
@@ -1,3 +1,3 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
3 | +require_once __DIR__.'/../vendor/autoload.php'; |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | $message = $error['message']['message']; |
50 | 50 | if (isset($error['message']['cause'])) { |
51 | 51 | if (is_array($error['message']['cause'])) { |
52 | - $message .= ' '. implode(', ', $error['message']['cause']); |
|
52 | + $message .= ' '.implode(', ', $error['message']['cause']); |
|
53 | 53 | } else { |
54 | - $message .= ' '. $error['message']['cause']; |
|
54 | + $message .= ' '.$error['message']['cause']; |
|
55 | 55 | } |
56 | 56 | } |
57 | - throw new \Exception('Error while calling post on '. $url .': '. $message); |
|
57 | + throw new \Exception('Error while calling post on '.$url.': '.$message); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function getOrganization($id): Organization |
94 | 94 | { |
95 | - $response = $this->get('organizations/'. $id); |
|
95 | + $response = $this->get('organizations/'.$id); |
|
96 | 96 | return Organization::fromJson($response->json(['object' => true]), $this); |
97 | 97 | } |
98 | 98 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | 'filter' => $filter, |
188 | 188 | 'analytics' => $analytics ? 'true' : 'false', |
189 | 189 | ]); |
190 | - $response = $this->get('workers/'. $id, compact('query')); |
|
190 | + $response = $this->get('workers/'.$id, compact('query')); |
|
191 | 191 | |
192 | 192 | return Worker::fromJson($response->json(['object' => true]), $this); |
193 | 193 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function getTeam($id): Team |
246 | 246 | { |
247 | - $response = $this->get('teams/'. $id); |
|
247 | + $response = $this->get('teams/'.$id); |
|
248 | 248 | return Team::fromJson($response->json(['object' => true]), $this); |
249 | 249 | } |
250 | 250 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | */ |
287 | 287 | public function getDestination($id): Destination |
288 | 288 | { |
289 | - $response = $this->get('destinations/'. $id); |
|
289 | + $response = $this->get('destinations/'.$id); |
|
290 | 290 | return Destination::fromJson($response->json(['object' => true]), $this); |
291 | 291 | } |
292 | 292 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | */ |
318 | 318 | public function getRecipient($id): Recipient |
319 | 319 | { |
320 | - $response = $this->get('recipients/'. $id); |
|
320 | + $response = $this->get('recipients/'.$id); |
|
321 | 321 | return Recipient::fromJson($response->json(['object' => true]), $this); |
322 | 322 | } |
323 | 323 | |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | public function getRecipientByName($name) |
329 | 329 | { |
330 | 330 | $name = str_replace('+', '%20', urlencode(strtolower($name))); |
331 | - $response = $this->get('recipients/name/'. $name); |
|
331 | + $response = $this->get('recipients/name/'.$name); |
|
332 | 332 | |
333 | 333 | if (null === $response) { |
334 | 334 | return null; |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | public function getRecipientByPhone($phone) |
345 | 345 | { |
346 | 346 | $phone = preg_replace('/[^\d]/', '', $phone); |
347 | - $response = $this->get('recipients/phone/'. $phone); |
|
347 | + $response = $this->get('recipients/phone/'.$phone); |
|
348 | 348 | |
349 | 349 | if (null === $response) { |
350 | 350 | return null; |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | */ |
406 | 406 | public function getTask($id): Task |
407 | 407 | { |
408 | - $response = $this->get('tasks/'. $id); |
|
408 | + $response = $this->get('tasks/'.$id); |
|
409 | 409 | return Task::fromJson($response->json(['object' => true]), $this); |
410 | 410 | } |
411 | 411 | |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | */ |
416 | 416 | public function getTaskByShortId($shortId): Task |
417 | 417 | { |
418 | - $response = $this->get('tasks/shortId/'. $shortId); |
|
418 | + $response = $this->get('tasks/shortId/'.$shortId); |
|
419 | 419 | return Task::fromJson($response->json(['object' => true]), $this); |
420 | 420 | } |
421 | 421 | |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | array_unshift($taskIds, $position); |
528 | 528 | } |
529 | 529 | |
530 | - $this->put('containers/'. $containerEndpoint .'/'. $targetId, [ |
|
530 | + $this->put('containers/'.$containerEndpoint.'/'.$targetId, [ |
|
531 | 531 | 'json' => [ |
532 | 532 | 'tasks' => $taskIds |
533 | 533 | ] |