@@ -13,14 +13,14 @@ discard block |
||
13 | 13 | { |
14 | 14 | static public $apiUrl = '/api.v4/route.php'; |
15 | 15 | static public $apiUrlAddress = '/api.v4/address.php'; |
16 | - static public $apiUrlDuplicate='/actions/duplicate_route.php'; |
|
17 | - static public $apiUrlDelete='/actions/delete_routes.php'; |
|
18 | - static public $apiUrlReseq='/api.v3/route/reoptimize_2.php'; |
|
19 | - static public $apiUrlMerge='/actions/merge_routes.php'; |
|
20 | - static public $apiUrlShare='/actions/route/share_route.php'; |
|
21 | - static public $apiUrlNoteFile='/actions/addRouteNotes.php'; |
|
22 | - static public $apiUrlAsset='/api.v4/status.php'; |
|
23 | - static public $apiUrlDeviceLocation='/api/track/get_device_location.php'; |
|
16 | + static public $apiUrlDuplicate = '/actions/duplicate_route.php'; |
|
17 | + static public $apiUrlDelete = '/actions/delete_routes.php'; |
|
18 | + static public $apiUrlReseq = '/api.v3/route/reoptimize_2.php'; |
|
19 | + static public $apiUrlMerge = '/actions/merge_routes.php'; |
|
20 | + static public $apiUrlShare = '/actions/route/share_route.php'; |
|
21 | + static public $apiUrlNoteFile = '/actions/addRouteNotes.php'; |
|
22 | + static public $apiUrlAsset = '/api.v4/status.php'; |
|
23 | + static public $apiUrlDeviceLocation = '/api/track/get_device_location.php'; |
|
24 | 24 | //static public $apiUrlMove='/actions/route/move_route_destination.php'; |
25 | 25 | public $route_id; |
26 | 26 | public $route_destination_id; |
@@ -77,14 +77,14 @@ discard block |
||
77 | 77 | return $route; |
78 | 78 | } |
79 | 79 | |
80 | - public static function getRoutes($routeId=null, $params=null) |
|
80 | + public static function getRoutes($routeId = null, $params = null) |
|
81 | 81 | { |
82 | 82 | $query = array( |
83 | 83 | 'api_key' => Route4Me::getApiKey() |
84 | 84 | ); |
85 | 85 | |
86 | 86 | if ($routeId) { |
87 | - $query['route_id'] = implode(',', (array) $routeId); |
|
87 | + $query['route_id'] = implode(',', (array)$routeId); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | if ($params) { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | return Route::fromArray($json); die(""); |
119 | 119 | } else { |
120 | 120 | $routes = array(); |
121 | - foreach($json as $route) { |
|
121 | + foreach ($json as $route) { |
|
122 | 122 | $routes[] = Route::fromArray($route); |
123 | 123 | } |
124 | 124 | return $routes; |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | } |
228 | 228 | |
229 | 229 | // Getting random route_id from existing routes between $offset and $offset+$limit |
230 | - public function getRandomRouteId($offset,$limit) |
|
230 | + public function getRandomRouteId($offset, $limit) |
|
231 | 231 | { |
232 | 232 | $query['limit'] = isset($params['limit']) ? $params['limit'] : 30; |
233 | 233 | $query['offset'] = isset($params['offset']) ? $params['offset'] : 0; |
@@ -239,12 +239,12 @@ discard block |
||
239 | 239 | )); |
240 | 240 | |
241 | 241 | $routes = array(); |
242 | - foreach($json as $route) { |
|
242 | + foreach ($json as $route) { |
|
243 | 243 | $routes[] = Route::fromArray($route); |
244 | 244 | } |
245 | 245 | |
246 | - $num=rand(0,sizeof($routes)-1); |
|
247 | - $rRoute=(array)$routes[$num]; |
|
246 | + $num = rand(0, sizeof($routes) - 1); |
|
247 | + $rRoute = (array)$routes[$num]; |
|
248 | 248 | |
249 | 249 | if (is_array($rRoute)) |
250 | 250 | { |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | 'route_id' => isset($this->route_id) ? $this->route_id : null, |
263 | 263 | 'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null, |
264 | 264 | ), |
265 | - 'body' => array ( |
|
265 | + 'body' => array( |
|
266 | 266 | 'parameters' => $this->parameters, |
267 | 267 | ), |
268 | 268 | 'HTTPHEADER' => isset($this->httpheaders) ? $this->httpheaders : null, |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | $fname = isset($params['strFilename']) ? $params['strFilename'] : null; |
326 | 326 | $rpath = realpath($fname); |
327 | 327 | //echo $rpath;die(""); |
328 | - $result= Route4Me::makeRequst(array( |
|
328 | + $result = Route4Me::makeRequst(array( |
|
329 | 329 | 'url' => self::$apiUrlNoteFile, |
330 | 330 | 'method' => 'POST', |
331 | 331 | 'query' => array( |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | $result = Route4Me::makeRequst(array( |
358 | 358 | 'url' => self::$apiUrl, |
359 | 359 | 'method' => 'DELETE', |
360 | - 'query' => array( 'route_id' => $route_id ) |
|
360 | + 'query' => array('route_id' => $route_id) |
|
361 | 361 | )); |
362 | 362 | |
363 | 363 | // The code below doesn't work, altough this method is described as workable in REST API |
@@ -376,24 +376,24 @@ discard block |
||
376 | 376 | |
377 | 377 | public function GetAddressesFromRoute($route_id) |
378 | 378 | { |
379 | - $route1=Route::getRoutes($route_id,null); |
|
379 | + $route1 = Route::getRoutes($route_id, null); |
|
380 | 380 | if (isset($route1)) { |
381 | 381 | return $route1->addresses(); |
382 | - } else { return null;} |
|
382 | + } else { return null; } |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | public function GetRandomAddressFromRoute($route_id) |
386 | 386 | { |
387 | - $route1=Route::getRoutes($route_id,null); |
|
387 | + $route1 = Route::getRoutes($route_id, null); |
|
388 | 388 | |
389 | 389 | if (isset($route1)) { |
390 | - $addresses=$route1->addresses; |
|
390 | + $addresses = $route1->addresses; |
|
391 | 391 | |
392 | - $rnd=rand(0,sizeof($addresses)-1); |
|
392 | + $rnd = rand(0, sizeof($addresses) - 1); |
|
393 | 393 | |
394 | 394 | return $addresses[$rnd]; |
395 | 395 | |
396 | - } else { return null;} |
|
396 | + } else { return null; } |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | public function getRouteId() |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | |
4 | 4 | class Curl_HTTP_Client |
5 | 5 | { |
6 | - var $ch ; |
|
6 | + var $ch; |
|
7 | 7 | var $debug = false; |
8 | 8 | var $error_msg; |
9 | 9 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | //set error in case http return code bigger than 300 |
22 | 22 | curl_setopt($this->ch, CURLOPT_FAILONERROR, true); |
23 | 23 | // use gzip if possible |
24 | - curl_setopt($this->ch,CURLOPT_ENCODING , 'gzip, deflate'); |
|
24 | + curl_setopt($this->ch, CURLOPT_ENCODING, 'gzip, deflate'); |
|
25 | 25 | // do not veryfy ssl |
26 | 26 | // this is important for windows |
27 | 27 | // as well for being able to access pages with non valid cert |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param string pass |
34 | 34 | * @access public |
35 | 35 | */ |
36 | - function set_credentials($username,$password) |
|
36 | + function set_credentials($username, $password) |
|
37 | 37 | { |
38 | 38 | curl_setopt($this->ch, CURLOPT_USERPWD, "$username:$password"); |
39 | 39 | } |
@@ -83,22 +83,22 @@ discard block |
||
83 | 83 | * @return string data |
84 | 84 | * @access public |
85 | 85 | */ |
86 | - function send_post_data($url, $postdata, $ip=null, $timeout=10) |
|
86 | + function send_post_data($url, $postdata, $ip = null, $timeout = 10) |
|
87 | 87 | { |
88 | 88 | |
89 | 89 | //set various curl options first |
90 | 90 | // set url to post to |
91 | - curl_setopt($this->ch, CURLOPT_URL,$url); |
|
91 | + curl_setopt($this->ch, CURLOPT_URL, $url); |
|
92 | 92 | // return into a variable rather than displaying it |
93 | - curl_setopt($this->ch, CURLOPT_RETURNTRANSFER,true); |
|
93 | + curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true); |
|
94 | 94 | //bind to specific ip address if it is sent trough arguments |
95 | - if($ip) |
|
95 | + if ($ip) |
|
96 | 96 | { |
97 | - if($this->debug) |
|
97 | + if ($this->debug) |
|
98 | 98 | { |
99 | 99 | echo "Binding to ip $ip\n"; |
100 | 100 | } |
101 | - curl_setopt($this->ch,CURLOPT_INTERFACE,$ip); |
|
101 | + curl_setopt($this->ch, CURLOPT_INTERFACE, $ip); |
|
102 | 102 | } |
103 | 103 | //set curl function timeout to $timeout |
104 | 104 | curl_setopt($this->ch, CURLOPT_TIMEOUT, $timeout); |
@@ -109,13 +109,13 @@ discard block |
||
109 | 109 | curl_setopt($this->ch, CURLOPT_POSTFIELDS, $postdata); |
110 | 110 | //and finally send curl request |
111 | 111 | $result = curl_exec_redir($this->ch); |
112 | - if(curl_errno($this->ch)) |
|
112 | + if (curl_errno($this->ch)) |
|
113 | 113 | { |
114 | - if($this->debug) |
|
114 | + if ($this->debug) |
|
115 | 115 | { |
116 | 116 | echo "Error Occured in Curl\n"; |
117 | - echo "Error number: " .curl_errno($this->ch) ."\n"; |
|
118 | - echo "Error message: " .curl_error($this->ch)."\n"; |
|
117 | + echo "Error number: ".curl_errno($this->ch)."\n"; |
|
118 | + echo "Error message: ".curl_error($this->ch)."\n"; |
|
119 | 119 | } |
120 | 120 | return false; |
121 | 121 | } |
@@ -133,35 +133,35 @@ discard block |
||
133 | 133 | * @return string data |
134 | 134 | * @access public |
135 | 135 | */ |
136 | - function fetch_url($url, $ip=null, $timeout=5) |
|
136 | + function fetch_url($url, $ip = null, $timeout = 5) |
|
137 | 137 | { |
138 | 138 | // set url to post to |
139 | - curl_setopt($this->ch, CURLOPT_URL,$url); |
|
139 | + curl_setopt($this->ch, CURLOPT_URL, $url); |
|
140 | 140 | |
141 | 141 | //set method to get |
142 | - curl_setopt($this->ch, CURLOPT_HTTPGET,true); |
|
142 | + curl_setopt($this->ch, CURLOPT_HTTPGET, true); |
|
143 | 143 | // return into a variable rather than displaying it |
144 | - curl_setopt($this->ch, CURLOPT_RETURNTRANSFER,true); |
|
144 | + curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true); |
|
145 | 145 | //bind to specific ip address if it is sent trough arguments |
146 | - if($ip) |
|
146 | + if ($ip) |
|
147 | 147 | { |
148 | - if($this->debug) |
|
148 | + if ($this->debug) |
|
149 | 149 | { |
150 | 150 | echo "Binding to ip $ip\n"; |
151 | 151 | } |
152 | - curl_setopt($this->ch,CURLOPT_INTERFACE,$ip); |
|
152 | + curl_setopt($this->ch, CURLOPT_INTERFACE, $ip); |
|
153 | 153 | } |
154 | 154 | //set curl function timeout to $timeout |
155 | 155 | curl_setopt($this->ch, CURLOPT_TIMEOUT, $timeout); |
156 | 156 | //and finally send curl request |
157 | 157 | $result = curl_exec_redir($this->ch); |
158 | - if(curl_errno($this->ch)) |
|
158 | + if (curl_errno($this->ch)) |
|
159 | 159 | { |
160 | - if($this->debug) |
|
160 | + if ($this->debug) |
|
161 | 161 | { |
162 | 162 | echo "Error Occured in Curl\n"; |
163 | - echo "Error number: " .curl_errno($this->ch) ."\n"; |
|
164 | - echo "Error message: " .curl_error($this->ch)."\n"; |
|
163 | + echo "Error number: ".curl_errno($this->ch)."\n"; |
|
164 | + echo "Error message: ".curl_error($this->ch)."\n"; |
|
165 | 165 | } |
166 | 166 | return false; |
167 | 167 | } |
@@ -180,18 +180,18 @@ discard block |
||
180 | 180 | * @return boolean true on success false othervise |
181 | 181 | * @access public |
182 | 182 | */ |
183 | - function fetch_into_file($url, $fp, $ip=null, $timeout=5) |
|
183 | + function fetch_into_file($url, $fp, $ip = null, $timeout = 5) |
|
184 | 184 | { |
185 | 185 | // set url to post to |
186 | - curl_setopt($this->ch, CURLOPT_URL,$url); |
|
186 | + curl_setopt($this->ch, CURLOPT_URL, $url); |
|
187 | 187 | //set method to get |
188 | 188 | curl_setopt($this->ch, CURLOPT_HTTPGET, true); |
189 | 189 | // store data into file rather than displaying it |
190 | 190 | curl_setopt($this->ch, CURLOPT_FILE, $fp); |
191 | 191 | //bind to specific ip address if it is sent trough arguments |
192 | - if($ip) |
|
192 | + if ($ip) |
|
193 | 193 | { |
194 | - if($this->debug) |
|
194 | + if ($this->debug) |
|
195 | 195 | { |
196 | 196 | echo "Binding to ip $ip\n"; |
197 | 197 | } |
@@ -201,13 +201,13 @@ discard block |
||
201 | 201 | curl_setopt($this->ch, CURLOPT_TIMEOUT, $timeout); |
202 | 202 | //and finally send curl request |
203 | 203 | $result = curl_exec_redir($this->ch); |
204 | - if(curl_errno($this->ch)) |
|
204 | + if (curl_errno($this->ch)) |
|
205 | 205 | { |
206 | - if($this->debug) |
|
206 | + if ($this->debug) |
|
207 | 207 | { |
208 | 208 | echo "Error Occured in Curl\n"; |
209 | - echo "Error number: " .curl_errno($this->ch) ."\n"; |
|
210 | - echo "Error message: " .curl_error($this->ch)."\n"; |
|
209 | + echo "Error number: ".curl_errno($this->ch)."\n"; |
|
210 | + echo "Error message: ".curl_error($this->ch)."\n"; |
|
211 | 211 | } |
212 | 212 | return false; |
213 | 213 | } |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * @return string data |
229 | 229 | * @access public |
230 | 230 | */ |
231 | - function send_multipart_post_data($url, $postdata, $file_field_array=array(), $ip=null, $timeout=30) |
|
231 | + function send_multipart_post_data($url, $postdata, $file_field_array = array(), $ip = null, $timeout = 30) |
|
232 | 232 | { |
233 | 233 | //set various curl options first |
234 | 234 | // set url to post to |
@@ -236,13 +236,13 @@ discard block |
||
236 | 236 | // return into a variable rather than displaying it |
237 | 237 | curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true); |
238 | 238 | //bind to specific ip address if it is sent trough arguments |
239 | - if($ip) |
|
239 | + if ($ip) |
|
240 | 240 | { |
241 | - if($this->debug) |
|
241 | + if ($this->debug) |
|
242 | 242 | { |
243 | 243 | echo "Binding to ip $ip\n"; |
244 | 244 | } |
245 | - curl_setopt($this->ch,CURLOPT_INTERFACE,$ip); |
|
245 | + curl_setopt($this->ch, CURLOPT_INTERFACE, $ip); |
|
246 | 246 | } |
247 | 247 | //set curl function timeout to $timeout |
248 | 248 | curl_setopt($this->ch, CURLOPT_TIMEOUT, $timeout); |
@@ -257,28 +257,28 @@ discard block |
||
257 | 257 | //generate post string |
258 | 258 | $post_array = array(); |
259 | 259 | $post_string_array = array(); |
260 | - if(!is_array($postdata)) |
|
260 | + if (!is_array($postdata)) |
|
261 | 261 | { |
262 | 262 | return false; |
263 | 263 | } |
264 | - foreach($postdata as $key=>$value) |
|
264 | + foreach ($postdata as $key=>$value) |
|
265 | 265 | { |
266 | 266 | $post_array[$key] = $value; |
267 | 267 | $post_string_array[] = urlencode($key)."=".urlencode($value); |
268 | 268 | } |
269 | - $post_string = implode("&",$post_string_array); |
|
270 | - if($this->debug) |
|
269 | + $post_string = implode("&", $post_string_array); |
|
270 | + if ($this->debug) |
|
271 | 271 | { |
272 | 272 | echo "Post String: $post_string\n"; |
273 | 273 | } |
274 | 274 | // set post string |
275 | 275 | //curl_setopt($this->ch, CURLOPT_POSTFIELDS, $post_string); |
276 | 276 | // set multipart form data - file array field-value pairs |
277 | - if(!empty($file_field_array)) |
|
277 | + if (!empty($file_field_array)) |
|
278 | 278 | { |
279 | - foreach($file_field_array as $var_name => $var_value) |
|
279 | + foreach ($file_field_array as $var_name => $var_value) |
|
280 | 280 | { |
281 | - if(strpos(PHP_OS, "WIN") !== false) $var_value = str_replace("/", "\\", $var_value); // win hack |
|
281 | + if (strpos(PHP_OS, "WIN")!==false) $var_value = str_replace("/", "\\", $var_value); // win hack |
|
282 | 282 | $file_field_array[$var_name] = "@".$var_value; |
283 | 283 | } |
284 | 284 | } |
@@ -287,13 +287,13 @@ discard block |
||
287 | 287 | curl_setopt($this->ch, CURLOPT_POSTFIELDS, $result_post); |
288 | 288 | //and finally send curl request |
289 | 289 | $result = curl_exec_redir($this->ch); |
290 | - if(curl_errno($this->ch)) |
|
290 | + if (curl_errno($this->ch)) |
|
291 | 291 | { |
292 | - if($this->debug) |
|
292 | + if ($this->debug) |
|
293 | 293 | { |
294 | 294 | echo "Error Occured in Curl\n"; |
295 | - echo "Error number: " .curl_errno($this->ch) ."\n"; |
|
296 | - echo "Error message: " .curl_error($this->ch)."\n"; |
|
295 | + echo "Error number: ".curl_errno($this->ch)."\n"; |
|
296 | + echo "Error message: ".curl_error($this->ch)."\n"; |
|
297 | 297 | } |
298 | 298 | return false; |
299 | 299 | } |
@@ -310,8 +310,8 @@ discard block |
||
310 | 310 | function store_cookies($cookie_file) |
311 | 311 | { |
312 | 312 | // use cookies on each request (cookies stored in $cookie_file) |
313 | - curl_setopt ($this->ch, CURLOPT_COOKIEJAR, $cookie_file); |
|
314 | - curl_setopt ($this->ch, CURLOPT_COOKIEFILE, $cookie_file); |
|
313 | + curl_setopt($this->ch, CURLOPT_COOKIEJAR, $cookie_file); |
|
314 | + curl_setopt($this->ch, CURLOPT_COOKIEFILE, $cookie_file); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | /** |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | */ |
322 | 322 | function set_cookie($cookie) |
323 | 323 | { |
324 | - curl_setopt ($this->ch, CURLOPT_COOKIE, $cookie); |
|
324 | + curl_setopt($this->ch, CURLOPT_COOKIE, $cookie); |
|
325 | 325 | } |
326 | 326 | /** |
327 | 327 | * Get last URL info |
@@ -349,8 +349,8 @@ discard block |
||
349 | 349 | */ |
350 | 350 | function get_error_msg() |
351 | 351 | { |
352 | - $err = "Error number: " .curl_errno($this->ch) ."\n"; |
|
353 | - $err .="Error message: " .curl_error($this->ch)."\n"; |
|
352 | + $err = "Error number: ".curl_errno($this->ch)."\n"; |
|
353 | + $err .= "Error message: ".curl_error($this->ch)."\n"; |
|
354 | 354 | return $err; |
355 | 355 | } |
356 | 356 | |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | { |
375 | 375 | static $curl_loops = 0; |
376 | 376 | static $curl_max_loops = 20; |
377 | - if ($curl_loops++ >= $curl_max_loops) |
|
377 | + if ($curl_loops++>=$curl_max_loops) |
|
378 | 378 | { |
379 | 379 | $curl_loops = 0; |
380 | 380 | return FALSE; |
@@ -391,10 +391,10 @@ discard block |
||
391 | 391 | //echo "*** Got HTTP code: $http_code ***\n"; |
392 | 392 | //echo "** Got headers: \n$header\n\n"; |
393 | 393 | |
394 | - if ( $http_code == 301 || $http_code == 302 ) |
|
394 | + if ($http_code==301 || $http_code==302) |
|
395 | 395 | { |
396 | 396 | // If we're redirected, we should revert to GET |
397 | - curl_setopt($ch, CURLOPT_HTTPGET,true); |
|
397 | + curl_setopt($ch, CURLOPT_HTTPGET, true); |
|
398 | 398 | |
399 | 399 | $matches = array(); |
400 | 400 | preg_match('/Location:\s*(.*?)(\n|$)/i', $header, $matches); |
@@ -412,12 +412,12 @@ discard block |
||
412 | 412 | $url['host'] = $last_url['host']; |
413 | 413 | if (empty($url['path'])) |
414 | 414 | $url['path'] = $last_url['path']; |
415 | - $new_url = $url['scheme'] . '://' . $url['host'] . $url['path'] . (!empty($url['query'])?'?'.$url['query']:''); |
|
415 | + $new_url = $url['scheme'].'://'.$url['host'].$url['path'].(!empty($url['query']) ? '?'.$url['query'] : ''); |
|
416 | 416 | //echo "Being redirected to $new_url\n"; |
417 | 417 | curl_setopt($ch, CURLOPT_URL, $new_url); |
418 | 418 | return curl_exec_redir($ch); |
419 | 419 | } else { |
420 | - $curl_loops=0; |
|
420 | + $curl_loops = 0; |
|
421 | 421 | return $data; |
422 | 422 | } |
423 | 423 | } |
@@ -19,11 +19,11 @@ discard block |
||
19 | 19 | public $housenumber; |
20 | 20 | public $zipcode; |
21 | 21 | |
22 | - public function __construct () { } |
|
22 | + public function __construct() { } |
|
23 | 23 | |
24 | 24 | public static function fromArray(array $params) { |
25 | 25 | $geocoding = new Geocoding(); |
26 | - foreach($params as $key => $value) { |
|
26 | + foreach ($params as $key => $value) { |
|
27 | 27 | if (property_exists($geocoding, $key)) { |
28 | 28 | $geocoding->{$key} = $value; |
29 | 29 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | { |
36 | 36 | //Route4Me::simplePrint($params); |
37 | 37 | $query = array( |
38 | - 'format' => isset($params['format']) ? $params['format']: null, |
|
38 | + 'format' => isset($params['format']) ? $params['format'] : null, |
|
39 | 39 | 'addresses' => isset($params['addresses']) ? $params['addresses'] : null, |
40 | 40 | ); |
41 | 41 | //var_dump($query); |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | { |
53 | 53 | $url_query = self::$api_street; |
54 | 54 | if (isset($params['pk'])) { |
55 | - $url_query.=$params['pk'].'/'; |
|
55 | + $url_query .= $params['pk'].'/'; |
|
56 | 56 | } |
57 | 57 | if (isset($params['offset'])) { |
58 | - $url_query.=$params['offset'].'/'; |
|
58 | + $url_query .= $params['offset'].'/'; |
|
59 | 59 | } |
60 | 60 | if (isset($params['limit'])) { |
61 | - $url_query.=$params['limit'].'/'; |
|
61 | + $url_query .= $params['limit'].'/'; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | $query = array(); |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | { |
76 | 76 | $url_query = self::$api_zipcode; |
77 | 77 | if (isset($params['zipcode'])) { |
78 | - $url_query.=$params['zipcode'].'/'; |
|
78 | + $url_query .= $params['zipcode'].'/'; |
|
79 | 79 | } |
80 | 80 | if (isset($params['offset'])) { |
81 | - $url_query.=$params['offset'].'/'; |
|
81 | + $url_query .= $params['offset'].'/'; |
|
82 | 82 | } |
83 | 83 | if (isset($params['limit'])) { |
84 | - $url_query.=$params['limit'].'/'; |
|
84 | + $url_query .= $params['limit'].'/'; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | $query = array(); |
@@ -98,16 +98,16 @@ discard block |
||
98 | 98 | { |
99 | 99 | $url_query = self::$api_service; |
100 | 100 | if (isset($params['zipcode'])) { |
101 | - $url_query.=$params['zipcode'].'/'; |
|
101 | + $url_query .= $params['zipcode'].'/'; |
|
102 | 102 | } |
103 | 103 | if (isset($params['housenumber'])) { |
104 | - $url_query.=$params['housenumber'].'/'; |
|
104 | + $url_query .= $params['housenumber'].'/'; |
|
105 | 105 | } |
106 | 106 | if (isset($params['offset'])) { |
107 | - $url_query.=$params['offset'].'/'; |
|
107 | + $url_query .= $params['offset'].'/'; |
|
108 | 108 | } |
109 | 109 | if (isset($params['limit'])) { |
110 | - $url_query.=$params['limit'].'/'; |
|
110 | + $url_query .= $params['limit'].'/'; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | $query = array(); |
@@ -12,7 +12,7 @@ |
||
12 | 12 | public function toArray() |
13 | 13 | { |
14 | 14 | $params = array_filter(get_object_vars($this), function($item) { |
15 | - return ($item !== null) && !(is_array($item) && !count($item)); |
|
15 | + return ($item!==null) && !(is_array($item) && !count($item)); |
|
16 | 16 | }); |
17 | 17 | |
18 | 18 | return $params; |
@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | { |
9 | 9 | static public $apiUrl = '/api.v4/avoidance.php'; |
10 | 10 | |
11 | - public $territory_id; // Avoidance zone id |
|
11 | + public $territory_id; // Avoidance zone id |
|
12 | 12 | public $territory_name; |
13 | 13 | public $territory_color; |
14 | 14 | public $member_id; |
15 | 15 | public $territory; // Territory parameters |
16 | 16 | |
17 | - public function __construct () { |
|
17 | + public function __construct() { |
|
18 | 18 | |
19 | 19 | } |
20 | 20 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | $avoidancezoneparameters = new AvoidanceZone(); |
35 | - foreach($params as $key => $value) { |
|
35 | + foreach ($params as $key => $value) { |
|
36 | 36 | if (property_exists($avoidancezoneparameters, $key)) { |
37 | 37 | $avoidancezoneparameters->{$key} = $value; |
38 | 38 | } |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | 'url' => self::$apiUrl, |
61 | 61 | 'method' => 'GET', |
62 | 62 | 'query' => array( |
63 | - 'offset' => isset($params->offset) ? $params->offset: null, |
|
64 | - 'limit' => isset($params->limit) ? $params->limit: null, |
|
63 | + 'offset' => isset($params->offset) ? $params->offset : null, |
|
64 | + 'limit' => isset($params->limit) ? $params->limit : null, |
|
65 | 65 | ) |
66 | 66 | )); |
67 | 67 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | 'url' => self::$apiUrl, |
75 | 75 | 'method' => 'ADD', |
76 | 76 | 'query' => array( |
77 | - 'territory_name' => isset($params->territory_name) ? $params->territory_name: null, |
|
77 | + 'territory_name' => isset($params->territory_name) ? $params->territory_name : null, |
|
78 | 78 | 'territory_color' => isset($params->territory_color) ? $params->territory_color : null, |
79 | 79 | 'territory' => isset($params->territory) ? $params->territory : null, |
80 | 80 | ) |
@@ -10,9 +10,9 @@ discard block |
||
10 | 10 | class Address extends Common |
11 | 11 | { |
12 | 12 | static public $apiUrl = '/api.v4/address.php'; |
13 | - static public $apiUrlMove='/actions/route/move_route_destination.php'; |
|
14 | - static public $apiUrDeparted='/api/route/mark_address_departed.php'; |
|
15 | - static public $apiUrVisited='/actions/address/update_address_visited.php'; |
|
13 | + static public $apiUrlMove = '/actions/route/move_route_destination.php'; |
|
14 | + static public $apiUrDeparted = '/api/route/mark_address_departed.php'; |
|
15 | + static public $apiUrVisited = '/actions/address/update_address_visited.php'; |
|
16 | 16 | |
17 | 17 | public $route_destination_id; |
18 | 18 | public $alias; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | }*/ |
71 | 71 | |
72 | 72 | $address = new Address(); |
73 | - foreach($params as $key => $value) { |
|
73 | + foreach ($params as $key => $value) { |
|
74 | 74 | if (property_exists($address, $key)) { |
75 | 75 | $address->{$key} = $value; |
76 | 76 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | 'url' => self::$apiUrl, |
115 | 115 | 'method' => 'PUT', |
116 | 116 | 'query' => array( |
117 | - 'route_id' => isset($params['route_id']) ? $params['route_id']: null, |
|
117 | + 'route_id' => isset($params['route_id']) ? $params['route_id'] : null, |
|
118 | 118 | 'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null, |
119 | 119 | ), |
120 | 120 | 'body' => $body |
@@ -129,10 +129,10 @@ discard block |
||
129 | 129 | 'url' => self::$apiUrDeparted, |
130 | 130 | 'method' => 'GET', |
131 | 131 | 'query' => array( |
132 | - 'route_id' => isset($params['route_id']) ? $params['route_id']: null, |
|
133 | - 'address_id' => isset($params['address_id']) ? $params['address_id']: null, |
|
134 | - 'is_departed' => isset($params['is_departed']) ? $params['is_departed']: null, |
|
135 | - 'member_id' => isset($params['member_id']) ? $params['member_id']: null, |
|
132 | + 'route_id' => isset($params['route_id']) ? $params['route_id'] : null, |
|
133 | + 'address_id' => isset($params['address_id']) ? $params['address_id'] : null, |
|
134 | + 'is_departed' => isset($params['is_departed']) ? $params['is_departed'] : null, |
|
135 | + 'member_id' => isset($params['member_id']) ? $params['member_id'] : null, |
|
136 | 136 | ), |
137 | 137 | )); |
138 | 138 | |
@@ -145,10 +145,10 @@ discard block |
||
145 | 145 | 'url' => self::$apiUrVisited, |
146 | 146 | 'method' => 'GET', |
147 | 147 | 'query' => array( |
148 | - 'route_id' => isset($params['route_id']) ? $params['route_id']: null, |
|
149 | - 'address_id' => isset($params['address_id']) ? $params['address_id']: null, |
|
150 | - 'is_visited' => isset($params['is_visited']) ? $params['is_visited']: null, |
|
151 | - 'member_id' => isset($params['member_id']) ? $params['member_id']: null, |
|
148 | + 'route_id' => isset($params['route_id']) ? $params['route_id'] : null, |
|
149 | + 'address_id' => isset($params['address_id']) ? $params['address_id'] : null, |
|
150 | + 'is_visited' => isset($params['is_visited']) ? $params['is_visited'] : null, |
|
151 | + 'member_id' => isset($params['member_id']) ? $params['member_id'] : null, |
|
152 | 152 | ), |
153 | 153 | )); |
154 | 154 |
@@ -7,11 +7,11 @@ |
||
7 | 7 | { |
8 | 8 | static public $apiUrl = '/api/vehicles/view_vehicles.php'; |
9 | 9 | |
10 | - public function __construct () { } |
|
10 | + public function __construct() { } |
|
11 | 11 | |
12 | 12 | public static function fromArray(array $params) { |
13 | - $vehicle= new Vehicle(); |
|
14 | - foreach($params as $key => $value) { |
|
13 | + $vehicle = new Vehicle(); |
|
14 | + foreach ($params as $key => $value) { |
|
15 | 15 | if (property_exists($vehicle, $key)) { |
16 | 16 | $vehicle->{$key} = $value; |
17 | 17 | } |
@@ -8,14 +8,14 @@ discard block |
||
8 | 8 | { |
9 | 9 | static public $apiUrl = '/api.v4/territory.php'; |
10 | 10 | |
11 | - public $territory_id; // Territory id |
|
11 | + public $territory_id; // Territory id |
|
12 | 12 | public $territory_name; |
13 | 13 | public $territory_color; |
14 | 14 | public $addresses; |
15 | 15 | public $member_id; |
16 | 16 | public $territory; // Territory parameters |
17 | 17 | |
18 | - public function __construct () { |
|
18 | + public function __construct() { |
|
19 | 19 | |
20 | 20 | } |
21 | 21 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | $territoryparameters = new Territory(); |
36 | - foreach($params as $key => $value) { |
|
36 | + foreach ($params as $key => $value) { |
|
37 | 37 | if (property_exists($territoryparameters, $key)) { |
38 | 38 | $territoryparameters->{$key} = $value; |
39 | 39 | } |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | 'url' => self::$apiUrl, |
49 | 49 | 'method' => 'GET', |
50 | 50 | 'query' => array( |
51 | - 'territory_id' => isset($params['territory_id']) ? $params['territory_id']: null, |
|
52 | - 'addresses' => isset($params['addresses']) ? $params['addresses']: null, |
|
51 | + 'territory_id' => isset($params['territory_id']) ? $params['territory_id'] : null, |
|
52 | + 'addresses' => isset($params['addresses']) ? $params['addresses'] : null, |
|
53 | 53 | ) |
54 | 54 | )); |
55 | 55 | |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | 'url' => self::$apiUrl, |
63 | 63 | 'method' => 'GET', |
64 | 64 | 'query' => array( |
65 | - 'offset' => isset($params->offset) ? $params->offset: null, |
|
66 | - 'limit' => isset($params->limit) ? $params->limit: null, |
|
65 | + 'offset' => isset($params->offset) ? $params->offset : null, |
|
66 | + 'limit' => isset($params->limit) ? $params->limit : null, |
|
67 | 67 | ) |
68 | 68 | )); |
69 | 69 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | 'url' => self::$apiUrl, |
77 | 77 | 'method' => 'ADD', |
78 | 78 | 'query' => array( |
79 | - 'territory_name' => isset($params->territory_name) ? $params->territory_name: null, |
|
79 | + 'territory_name' => isset($params->territory_name) ? $params->territory_name : null, |
|
80 | 80 | 'territory_color' => isset($params->territory_color) ? $params->territory_color : null, |
81 | 81 | 'territory' => isset($params->territory) ? $params->territory : null, |
82 | 82 | ) |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | public $activity_type; |
20 | 20 | public $activity_message; |
21 | 21 | |
22 | - public function __construct () { |
|
22 | + public function __construct() { |
|
23 | 23 | |
24 | 24 | } |
25 | 25 | |
26 | 26 | public static function fromArray(array $params) { |
27 | 27 | $activityparameters = new ActivityParameters(); |
28 | - foreach($params as $key => $value) { |
|
28 | + foreach ($params as $key => $value) { |
|
29 | 29 | if (property_exists($activityparameters, $key)) { |
30 | 30 | $activityparameters->{$key} = $value; |
31 | 31 | } |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | 'method' => 'GET', |
42 | 42 | 'query' => array( |
43 | 43 | 'route_id' => isset($params->route_id) ? $params->route_id : null, |
44 | - 'team' => isset($params->team) ? $params->team: null, |
|
45 | - 'limit' => isset($params->limit) ? $params->limit: null, |
|
44 | + 'team' => isset($params->team) ? $params->team : null, |
|
45 | + 'limit' => isset($params->limit) ? $params->limit : null, |
|
46 | 46 | 'offset' => isset($params->offset) ? $params->offset : null, |
47 | 47 | ) |
48 | 48 | )); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | 'method' => 'GET', |
58 | 58 | 'query' => array( |
59 | 59 | 'route_id' => isset($params->route_id) ? $params->route_id : null, |
60 | - 'limit' => isset($params->limit) ? $params->limit: null, |
|
60 | + 'limit' => isset($params->limit) ? $params->limit : null, |
|
61 | 61 | 'offset' => isset($params->offset) ? $params->offset : null, |
62 | 62 | 'activity_type' => isset($params->activity_type) ? $params->activity_type : null, |
63 | 63 | ) |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | 'method' => 'POST', |
74 | 74 | 'body' => array( |
75 | 75 | 'activity_type' => isset($postParameters->activity_type) ? $postParameters->activity_type : null, |
76 | - 'activity_message' => isset($postParameters->activity_message) ? $postParameters->activity_message: null, |
|
76 | + 'activity_message' => isset($postParameters->activity_message) ? $postParameters->activity_message : null, |
|
77 | 77 | 'route_id' => isset($postParameters->route_id) ? $postParameters->route_id : null, |
78 | 78 | ) |
79 | 79 | )); |