@@ -210,7 +210,7 @@ |
||
210 | 210 | { |
211 | 211 | sleep(5); |
212 | 212 | |
213 | - if (self::$created_guid !== null) { |
|
213 | + if (self::$created_guid!==null) { |
|
214 | 214 | $pod_workflows = new PodWorkflows(); |
215 | 215 | $pod_workflows->deletePodWorkflow(self::$created_guid); |
216 | 216 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | public function getPodWorkflow(string $workflow_guid) : ResponsePodWorkflow |
95 | 95 | { |
96 | 96 | return $this->toResponsePodWorkflow(Route4Me::makeRequst([ |
97 | - 'url' => Endpoint::POD_WORKFLOW . '/' . $workflow_guid, |
|
97 | + 'url' => Endpoint::POD_WORKFLOW.'/'.$workflow_guid, |
|
98 | 98 | 'method' => 'GET' |
99 | 99 | ])); |
100 | 100 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | 'title', 'done_actions', 'failed_actions']; |
117 | 117 | |
118 | 118 | return $this->toResponsePodWorkflow(Route4Me::makeRequst([ |
119 | - 'url' => Endpoint::POD_WORKFLOW . '/' . $workflow_guid, |
|
119 | + 'url' => Endpoint::POD_WORKFLOW.'/'.$workflow_guid, |
|
120 | 120 | 'method' => 'PUT', |
121 | 121 | 'HTTPHEADER' => 'Content-Type: application/json', |
122 | 122 | 'body' => Route4Me::generateRequestParameters($allBodyFields, $params) |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | public function deletePodWorkflow(string $workflow_guid) : bool |
136 | 136 | { |
137 | 137 | $res = Route4Me::makeRequst([ |
138 | - 'url' => Endpoint::POD_WORKFLOW . '/' . $workflow_guid, |
|
138 | + 'url' => Endpoint::POD_WORKFLOW.'/'.$workflow_guid, |
|
139 | 139 | 'method' => 'DELETE' |
140 | 140 | ]); |
141 | 141 | return isset($res); |
@@ -31,10 +31,10 @@ |
||
31 | 31 | |
32 | 32 | public function __construct(?array $params = null) |
33 | 33 | { |
34 | - if ($params !== null) { |
|
34 | + if ($params!==null) { |
|
35 | 35 | foreach ($this as $key => $value) { |
36 | 36 | if (isset($params[$key])) { |
37 | - if ($key === 'data') { |
|
37 | + if ($key==='data') { |
|
38 | 38 | $this->{$key} = array(); |
39 | 39 | foreach ($params[$key] as $pod_wf => $value) { |
40 | 40 | array_push($this->{$key}, new ResponsePodWorkflow($value)); |
@@ -61,10 +61,10 @@ |
||
61 | 61 | |
62 | 62 | public function __construct(?array $params = null) |
63 | 63 | { |
64 | - if ($params !== null) { |
|
64 | + if ($params!==null) { |
|
65 | 65 | foreach ($this as $key => $value) { |
66 | 66 | if (isset($params[$key])) { |
67 | - if ($key === 'done_actions' || $key === 'failed_actions') { |
|
67 | + if ($key==='done_actions' || $key==='failed_actions') { |
|
68 | 68 | $this->{$key} = array(); |
69 | 69 | foreach ($params[$key] as $action => $value) { |
70 | 70 | array_push($this->{$key}, new Action($value)); |
@@ -35,7 +35,7 @@ |
||
35 | 35 | |
36 | 36 | public function __construct(?array $params = null) |
37 | 37 | { |
38 | - if ($params !== null) { |
|
38 | + if ($params!==null) { |
|
39 | 39 | $this->fillFromArray($params); |
40 | 40 | } |
41 | 41 | } |
@@ -36,10 +36,10 @@ |
||
36 | 36 | |
37 | 37 | public function __construct(?array $params = null) |
38 | 38 | { |
39 | - if ($params !== null) { |
|
39 | + if ($params!==null) { |
|
40 | 40 | foreach ($this as $key => $value) { |
41 | 41 | if (isset($params[$key])) { |
42 | - if ($key === 'options') { |
|
42 | + if ($key==='options') { |
|
43 | 43 | $this->{$key} = array(); |
44 | 44 | foreach ($params[$key] as $option => $value) { |
45 | 45 | array_push($this->{$key}, new Option($value)); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | $method = isset($options['method']) ? $options['method'] : 'GET'; |
56 | 56 | $query = isset($options['query']) |
57 | - ? array_filter($options['query'], function ($x) { |
|
57 | + ? array_filter($options['query'], function($x) { |
|
58 | 58 | return !is_null($x); |
59 | 59 | }) : []; |
60 | 60 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $ch = curl_init(); |
80 | 80 | |
81 | 81 | $url = isset($options['url']) |
82 | - ? $options['url'] . '?' . http_build_query(array_merge( |
|
82 | + ? $options['url'].'?'.http_build_query(array_merge( |
|
83 | 83 | $query, |
84 | 84 | ['api_key' => self::getApiKey()] |
85 | 85 | )) : ''; |
@@ -101,19 +101,19 @@ discard block |
||
101 | 101 | // read response headers if need |
102 | 102 | $response_headers = []; |
103 | 103 | if ($return_headers) { |
104 | - curl_setopt($ch, CURLOPT_HEADERFUNCTION, function ($curl, $header) use (&$response_headers) { |
|
104 | + curl_setopt($ch, CURLOPT_HEADERFUNCTION, function($curl, $header) use (&$response_headers) { |
|
105 | 105 | $len = strlen($header); |
106 | 106 | $header = explode(':', $header, 2); |
107 | - if (count($header) >= 2) { |
|
107 | + if (count($header)>=2) { |
|
108 | 108 | $response_headers[strtolower(trim($header[0]))] = trim($header[1]); |
109 | 109 | } |
110 | 110 | return $len; |
111 | 111 | }); |
112 | 112 | } |
113 | 113 | |
114 | - if (null != $file) { |
|
114 | + if (null!=$file) { |
|
115 | 115 | $cfile = new \CURLFile($file, '', ''); |
116 | - $body['strFilename']=$cfile; |
|
116 | + $body['strFilename'] = $cfile; |
|
117 | 117 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
118 | 118 | curl_setopt($ch, CURLOPT_POST, true); |
119 | 119 | curl_setopt($ch, CURLOPT_POSTFIELDS, $body); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | case 'POST': |
133 | 133 | if (isset($body)) { |
134 | 134 | if (isset($options['HTTPHEADER']) |
135 | - && strpos($options['HTTPHEADER'], 'multipart/form-data') > 0) { |
|
135 | + && strpos($options['HTTPHEADER'], 'multipart/form-data')>0) { |
|
136 | 136 | $bodyData = $body; |
137 | 137 | } else { |
138 | 138 | $bodyData = json_encode($body); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | if (isset($body)) { |
150 | 150 | $bodyData = json_encode($body); |
151 | 151 | if (isset($options['HTTPHEADER'])) { |
152 | - if (strpos($options['HTTPHEADER'], 'multipart/form-data') > 0) { |
|
152 | + if (strpos($options['HTTPHEADER'], 'multipart/form-data')>0) { |
|
153 | 153 | $bodyData = $body; |
154 | 154 | } |
155 | 155 | } |
@@ -171,18 +171,18 @@ discard block |
||
171 | 171 | curl_close($ch); |
172 | 172 | |
173 | 173 | $json = null; |
174 | - if (strpos($result, '<?xml') > -1) { |
|
174 | + if (strpos($result, '<?xml')>-1) { |
|
175 | 175 | $xml = simplexml_load_string($result); |
176 | 176 | $json = self::object2array($xml); |
177 | 177 | } else { |
178 | 178 | $json = json_decode($result, true); |
179 | 179 | } |
180 | - if (200 == $code || 201 == $code || 202 == $code || 204 == $code) { |
|
180 | + if (200==$code || 201==$code || 202==$code || 204==$code) { |
|
181 | 181 | if (isset($json['errors'])) { |
182 | 182 | throw new ApiError(implode(', ', $json['errors']), $code, $result); |
183 | 183 | } else { |
184 | 184 | // return response headers if they were asked for |
185 | - if (count($response_headers) !== 0) { |
|
185 | + if (count($response_headers)!==0) { |
|
186 | 186 | $res = [ |
187 | 187 | 'code' => $code, |
188 | 188 | 'data' => $json |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | } |
195 | 195 | return $res; |
196 | 196 | } |
197 | - if (204 == $code) { |
|
197 | + if (204==$code) { |
|
198 | 198 | return true; |
199 | 199 | } |
200 | 200 | return $json; |
@@ -205,10 +205,10 @@ discard block |
||
205 | 205 | if (isset($json['messages'])) { |
206 | 206 | $msg = ''; |
207 | 207 | foreach ($json['messages'] as $key => $value) { |
208 | - if ($msg !== '') { |
|
208 | + if ($msg!=='') { |
|
209 | 209 | $msg .= PHP_EOL; |
210 | 210 | } |
211 | - $msg .= $key . ': ' . (is_array($value) ? implode(', ', $value) : $value); |
|
211 | + $msg .= $key.': '.(is_array($value) ? implode(', ', $value) : $value); |
|
212 | 212 | } |
213 | 213 | throw new ApiError($msg, $code, $result); |
214 | 214 | } elseif (isset($json['error']) && !empty($json['error'])) { |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } elseif (isset($json['error'])) { |
217 | 217 | $msg = ''; |
218 | 218 | foreach ($json['errors'] as $key => $value) { |
219 | - if ($msg !== '') { |
|
219 | + if ($msg!=='') { |
|
220 | 220 | $msg .= PHP_EOL; |
221 | 221 | } |
222 | 222 | $msg .= $value; |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | if (is_object($result1)) { |
262 | 262 | if ($deepPrinting) { |
263 | 263 | echo "<br>$key1 ------><br>"; |
264 | - $oarray = (array) $result1; |
|
264 | + $oarray = (array)$result1; |
|
265 | 265 | self::simplePrint($oarray, true); |
266 | 266 | echo '------<br>'; |
267 | 267 | } else { |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | if (is_object($result)) { |
279 | 279 | if ($deepPrinting) { |
280 | 280 | echo "<br>$key ------><br>"; |
281 | - $oarray = (array) $result; |
|
281 | + $oarray = (array)$result; |
|
282 | 282 | self::simplePrint($oarray, true); |
283 | 283 | echo '------<br>'; |
284 | 284 | } else { |
@@ -44,34 +44,34 @@ |
||
44 | 44 | |
45 | 45 | if (isset($new_pod->workflow_guid)) { |
46 | 46 | $created_pod_guid = $new_pod->workflow_guid; |
47 | - echo 'Created PodWorkflow with GUID: ' . $created_pod_guid . PHP_EOL; |
|
47 | + echo 'Created PodWorkflow with GUID: '.$created_pod_guid.PHP_EOL; |
|
48 | 48 | |
49 | 49 | // read |
50 | 50 | $read_pod = $pws->getPodWorkflow($created_pod_guid); |
51 | - echo 'Read PodWorkflow with GUID: ' . $read_pod->workflow_guid . PHP_EOL; |
|
51 | + echo 'Read PodWorkflow with GUID: '.$read_pod->workflow_guid.PHP_EOL; |
|
52 | 52 | |
53 | 53 | // update |
54 | 54 | $params['title'] = 'A new Super title from 15'; |
55 | 55 | $updated_pod = $pws->updatePodWorkflow($created_pod_guid, $params); |
56 | - echo 'Updated PodWorkflow with GUID: ' . $updated_pod->workflow_guid |
|
57 | - . ', new title is "'. $updated_pod->title . '"' . PHP_EOL; |
|
56 | + echo 'Updated PodWorkflow with GUID: '.$updated_pod->workflow_guid |
|
57 | + . ', new title is "'.$updated_pod->title.'"'.PHP_EOL; |
|
58 | 58 | |
59 | 59 | //delete |
60 | 60 | $res = $pws->deletePodWorkflow($created_pod_guid); |
61 | - echo 'Deleted PodWorkflow with GUID: ' . $created_pod_guid . PHP_EOL; |
|
61 | + echo 'Deleted PodWorkflow with GUID: '.$created_pod_guid.PHP_EOL; |
|
62 | 62 | } else { |
63 | - echo 'Error creating PodWorkflow.' . PHP_EOL; |
|
63 | + echo 'Error creating PodWorkflow.'.PHP_EOL; |
|
64 | 64 | } |
65 | 65 | } catch (Exception | ApiError $e) { |
66 | - echo 'Error, Code: ' . $e->getCode() . PHP_EOL . 'Message: ' . $e->getMessage() . PHP_EOL; |
|
66 | + echo 'Error, Code: '.$e->getCode().PHP_EOL.'Message: '.$e->getMessage().PHP_EOL; |
|
67 | 67 | |
68 | 68 | if ($created_pod_guid) { |
69 | - echo 'Cleanup PodWorkflow with GUID: ' . $created_pod_guid . PHP_EOL; |
|
69 | + echo 'Cleanup PodWorkflow with GUID: '.$created_pod_guid.PHP_EOL; |
|
70 | 70 | try { |
71 | 71 | $pws->deletePodWorkflow($created_pod_guid); |
72 | 72 | } catch (Exception | ApiError $e) { |
73 | - echo 'Error: Cleanup.' . PHP_EOL; |
|
74 | - echo $e->getMessage() . PHP_EOL; |
|
73 | + echo 'Error: Cleanup.'.PHP_EOL; |
|
74 | + echo $e->getMessage().PHP_EOL; |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | public function testGetMustReturnResponseOrder() : void |
160 | 160 | { |
161 | - if (self::$created_uuid !== null) { |
|
161 | + if (self::$created_uuid!==null) { |
|
162 | 162 | $orders = new Orders(); |
163 | 163 | $order = $orders->get(self::$created_uuid); |
164 | 164 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | public function testUpdateMustReturnResponseOrder() : void |
172 | 172 | { |
173 | - if (self::$created_uuid !== null) { |
|
173 | + if (self::$created_uuid!==null) { |
|
174 | 174 | $orders = new Orders(); |
175 | 175 | $order = $orders->update(self::$created_uuid, ['first_name' => 'Jane']); |
176 | 176 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | public function testSearchMustReturnResponseSearchWithParams() : void |
193 | 193 | { |
194 | - if (self::$created_uuid !== null) { |
|
194 | + if (self::$created_uuid!==null) { |
|
195 | 195 | $orders = new Orders(); |
196 | 196 | $params = [ |
197 | 197 | "filters" => [ |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | |
317 | 317 | public function testUpdateOrderCustomFieldMustReturnCustomField() : void |
318 | 318 | { |
319 | - if (self::$created_field_uuid !== null) { |
|
319 | + if (self::$created_field_uuid!==null) { |
|
320 | 320 | $orders = new Orders(); |
321 | 321 | $field = $orders->updateOrderCustomField(self::$created_field_uuid, [ |
322 | 322 | 'order_custom_field_label' => 'Custom Field New', |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | |
335 | 335 | public function testDeleteOrderCustomFieldMustReturnCustomField() : void |
336 | 336 | { |
337 | - if (self::$created_field_uuid !== null) { |
|
337 | + if (self::$created_field_uuid!==null) { |
|
338 | 338 | $orders = new Orders(); |
339 | 339 | $field = $orders->deleteOrderCustomField(self::$created_field_uuid); |
340 | 340 | |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | |
346 | 346 | public function testDeleteMustReturnTrue() : void |
347 | 347 | { |
348 | - if (self::$created_uuid !== null) { |
|
348 | + if (self::$created_uuid!==null) { |
|
349 | 349 | $orders = new Orders(); |
350 | 350 | $result = $orders->delete(self::$created_uuid); |
351 | 351 | |
@@ -358,12 +358,12 @@ discard block |
||
358 | 358 | { |
359 | 359 | sleep(1); |
360 | 360 | |
361 | - if (self::$created_uuid !== null || self::$created_field_uuid !== null) { |
|
361 | + if (self::$created_uuid!==null || self::$created_field_uuid!==null) { |
|
362 | 362 | $orders = new Orders(); |
363 | - if (self::$created_uuid !== null) { |
|
363 | + if (self::$created_uuid!==null) { |
|
364 | 364 | $orders->delete(self::$created_uuid); |
365 | 365 | } |
366 | - if (self::$created_field_uuid !== null) { |
|
366 | + if (self::$created_field_uuid!==null) { |
|
367 | 367 | $orders->deleteOrderCustomField(self::$created_field_uuid); |
368 | 368 | } |
369 | 369 | } |