GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( e71381...a2a532 )
by Oleg
03:35 queued 01:36
created
src/Route4Me/Route4Me.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -207,6 +207,7 @@  discard block
 block discarded – undo
207 207
 
208 208
     /**
209 209
      * @param $object: JSON object
210
+     * @param \SimpleXMLElement $object
210 211
      */
211 212
     public static function object2array($object)
212 213
     {
@@ -304,6 +305,7 @@  discard block
 block discarded – undo
304 305
      * Returns an array of the object properties
305 306
      * @param $object: An object.
306 307
      * @param $exclude: array of the object parameters to be excluded from the returned array.
308
+     * @param string[] $exclude
307 309
      */
308 310
     public static function getObjectProperties($object, $exclude)
309 311
     {
@@ -324,6 +326,7 @@  discard block
 block discarded – undo
324 326
      * Returns url path generated from the array of the fields and parameters.
325 327
      * @param $allFields; array of the paossible fields (parameter names).
326 328
      * @param $params: input parameters (array or object).
329
+     * @param string[] $allFields
327 330
      */
328 331
     public static function generateUrlPath($allFields, $params)
329 332
     {
Please login to merge, or discard this patch.
Indentation   +247 added lines, -247 removed lines patch added patch discarded remove patch
@@ -7,289 +7,289 @@
 block discarded – undo
7 7
 
8 8
 class Route4Me
9 9
 {
10
-    static public $apiKey;
11
-    static public $baseUrl = Endpoint::BASE_URL;
10
+	static public $apiKey;
11
+	static public $baseUrl = Endpoint::BASE_URL;
12 12
 
13
-    public static function setApiKey($apiKey)
14
-    {
15
-        self::$apiKey = $apiKey;
16
-    }
13
+	public static function setApiKey($apiKey)
14
+	{
15
+		self::$apiKey = $apiKey;
16
+	}
17 17
 
18
-    public static function getApiKey()
19
-    {
20
-        return self::$apiKey;
21
-    }
18
+	public static function getApiKey()
19
+	{
20
+		return self::$apiKey;
21
+	}
22 22
 
23
-    public static function setBaseUrl($baseUrl)
24
-    {
25
-        self::$baseUrl = $baseUrl;
26
-    }
23
+	public static function setBaseUrl($baseUrl)
24
+	{
25
+		self::$baseUrl = $baseUrl;
26
+	}
27 27
 
28
-    public static function getBaseUrl()
29
-    {
30
-        return self::$baseUrl;
31
-    }
28
+	public static function getBaseUrl()
29
+	{
30
+		return self::$baseUrl;
31
+	}
32 32
     
33
-    public static function makeRequst($options) {
34
-        $errorHandler = new myErrorHandler();
33
+	public static function makeRequst($options) {
34
+		$errorHandler = new myErrorHandler();
35 35
 
36
-        $method = isset($options['method']) ? $options['method'] : 'GET';
37
-        $query = isset($options['query']) ? array_filter($options['query'], function($x) { return !is_null($x); } ) : array();
36
+		$method = isset($options['method']) ? $options['method'] : 'GET';
37
+		$query = isset($options['query']) ? array_filter($options['query'], function($x) { return !is_null($x); } ) : array();
38 38
 
39
-        $body = isset($options['body']) ? $options['body'] : null;
40
-        $file = isset($options['FILE']) ? $options['FILE'] : null;
41
-        $headers = array(
42
-            "User-Agent: Route4Me php-sdk"
43
-        );
39
+		$body = isset($options['body']) ? $options['body'] : null;
40
+		$file = isset($options['FILE']) ? $options['FILE'] : null;
41
+		$headers = array(
42
+			"User-Agent: Route4Me php-sdk"
43
+		);
44 44
 
45
-        if (isset($options['HTTPHEADER'])) {
46
-            $headers[] = $options['HTTPHEADER'];
47
-        }
45
+		if (isset($options['HTTPHEADER'])) {
46
+			$headers[] = $options['HTTPHEADER'];
47
+		}
48 48
 
49
-        if (isset($options['HTTPHEADERS'])) {
50
-            foreach ($options['HTTPHEADERS'] As $header) {
51
-                $headers[] = $header;
52
-            } 
53
-        }
49
+		if (isset($options['HTTPHEADERS'])) {
50
+			foreach ($options['HTTPHEADERS'] As $header) {
51
+				$headers[] = $header;
52
+			} 
53
+		}
54 54
 
55
-        $ch = curl_init();
55
+		$ch = curl_init();
56 56
 
57
-        $url = isset($options['url']) ? $options['url'].'?'.http_build_query(array_merge(
58
-            $query, array('api_key' => self::getApiKey())
59
-        )) : "";
57
+		$url = isset($options['url']) ? $options['url'].'?'.http_build_query(array_merge(
58
+			$query, array('api_key' => self::getApiKey())
59
+		)) : "";
60 60
 
61
-        $baseUrl = self::getBaseUrl();
61
+		$baseUrl = self::getBaseUrl();
62 62
  
63
-        $curlOpts = array(
64
-            CURLOPT_URL            => $baseUrl.$url,
65
-            CURLOPT_RETURNTRANSFER => true,
66
-            CURLOPT_TIMEOUT        => 80,
67
-            CURLOPT_FOLLOWLOCATION => true,
68
-            CURLOPT_SSL_VERIFYHOST => FALSE,
69
-            CURLOPT_SSL_VERIFYPEER => FALSE,
70
-            CURLOPT_HTTPHEADER     => $headers
71
-        );
63
+		$curlOpts = array(
64
+			CURLOPT_URL            => $baseUrl.$url,
65
+			CURLOPT_RETURNTRANSFER => true,
66
+			CURLOPT_TIMEOUT        => 80,
67
+			CURLOPT_FOLLOWLOCATION => true,
68
+			CURLOPT_SSL_VERIFYHOST => FALSE,
69
+			CURLOPT_SSL_VERIFYPEER => FALSE,
70
+			CURLOPT_HTTPHEADER     => $headers
71
+		);
72 72
         
73
-        curl_setopt_array($ch, $curlOpts);
73
+		curl_setopt_array($ch, $curlOpts);
74 74
         
75
-        if ($file!=null) {
76
-            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
77
-            $fp = fopen($file, 'r');
78
-            curl_setopt($ch, CURLOPT_INFILE, $fp);
79
-            curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file));
80
-        }
75
+		if ($file!=null) {
76
+			curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
77
+			$fp = fopen($file, 'r');
78
+			curl_setopt($ch, CURLOPT_INFILE, $fp);
79
+			curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file));
80
+		}
81 81
 
82
-        switch ($method) {
83
-        case 'DELETE':
84
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
85
-            break;
86
-        case 'DELETEARRAY':
87
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
88
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
89
-            break;
90
-        case 'PUT':
91
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
92
-            break;
93
-        case 'POST':
94
-           if (isset($body)) {
95
-                $bodyData = json_encode($body);
96
-               if (isset($options['HTTPHEADER'])) {
97
-                  if (strpos($options['HTTPHEADER'], "multipart/form-data")>0) {
98
-                      $bodyData = $body;
99
-                  }
100
-               }
82
+		switch ($method) {
83
+		case 'DELETE':
84
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
85
+			break;
86
+		case 'DELETEARRAY':
87
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
88
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
89
+			break;
90
+		case 'PUT':
91
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
92
+			break;
93
+		case 'POST':
94
+		   if (isset($body)) {
95
+				$bodyData = json_encode($body);
96
+			   if (isset($options['HTTPHEADER'])) {
97
+				  if (strpos($options['HTTPHEADER'], "multipart/form-data")>0) {
98
+					  $bodyData = $body;
99
+				  }
100
+			   }
101 101
                
102
-               curl_setopt($ch, CURLOPT_POSTFIELDS, $bodyData); 
103
-            } 
104
-            break;
105
-        case 'ADD':
106
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
107
-        }
102
+			   curl_setopt($ch, CURLOPT_POSTFIELDS, $bodyData); 
103
+			} 
104
+			break;
105
+		case 'ADD':
106
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
107
+		}
108 108
 
109
-        if (is_numeric(array_search($method, array('DELETE', 'PUT')))) {
110
-            if (isset($body)) {
111
-                curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
112
-            } 
113
-        }
109
+		if (is_numeric(array_search($method, array('DELETE', 'PUT')))) {
110
+			if (isset($body)) {
111
+				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
112
+			} 
113
+		}
114 114
 
115
-        $result = curl_exec($ch);
115
+		$result = curl_exec($ch);
116 116
 
117
-        $isxml = FALSE;
118
-        $jxml = "";
119
-        if (strpos($result, '<?xml')>-1) {
120
-            $xml = simplexml_load_string($result);
121
-            //$jxml = json_encode($xml);
122
-            $jxml = self::object2array($xml);
123
-            $isxml = TRUE;
124
-        }
117
+		$isxml = FALSE;
118
+		$jxml = "";
119
+		if (strpos($result, '<?xml')>-1) {
120
+			$xml = simplexml_load_string($result);
121
+			//$jxml = json_encode($xml);
122
+			$jxml = self::object2array($xml);
123
+			$isxml = TRUE;
124
+		}
125 125
         
126
-        $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
127
-        curl_close($ch);
126
+		$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
127
+		curl_close($ch);
128 128
         
129
-        if (200==$code) {
130
-            if ($isxml) {
131
-                $json = $jxml;
132
-            } else {
133
-                $json = json_decode($result, true);
134
-            }
129
+		if (200==$code) {
130
+			if ($isxml) {
131
+				$json = $jxml;
132
+			} else {
133
+				$json = json_decode($result, true);
134
+			}
135 135
             
136
-            if (isset($json['errors'])) {
137
-                throw new ApiError(implode(', ', $json['errors']));
138
-            } else {
139
-                return $json;
140
-            }
141
-        } elseif (409==$code) {
142
-            throw new ApiError('Wrong API key');
143
-        } else {
144
-            throw new ApiError('Something wrong');
145
-        }
146
-    }
136
+			if (isset($json['errors'])) {
137
+				throw new ApiError(implode(', ', $json['errors']));
138
+			} else {
139
+				return $json;
140
+			}
141
+		} elseif (409==$code) {
142
+			throw new ApiError('Wrong API key');
143
+		} else {
144
+			throw new ApiError('Something wrong');
145
+		}
146
+	}
147 147
 
148
-    /**
149
-     * @param $object: JSON object
150
-     */
151
-    public static function object2array($object)
152
-    {
153
-        return @json_decode(@json_encode($object), 1);
154
-    }
148
+	/**
149
+	 * @param $object: JSON object
150
+	 */
151
+	public static function object2array($object)
152
+	{
153
+		return @json_decode(@json_encode($object), 1);
154
+	}
155 155
 
156 156
     
157
-    /**
158
-     * Prints on the screen main keys and values of the array 
159
-     * @param $results: object to be printed on the screen.
160
-     * @param $deepPrinting: if true, object will be printed recursively.
161
-     */
162
-    public static function simplePrint($results, $deepPrinting = null)
163
-    {
164
-        if (isset($results)) {
165
-            if (is_array($results)) {
166
-                foreach ($results as $key=>$result) {
167
-                    if (is_array($result)) {
168
-                        foreach ($result as $key1=>$result1) {
169
-                            if (is_array($result1)) {
170
-                                  if ($deepPrinting) {
171
-                                      echo "<br>$key1 ------><br>";
172
-                                      Route4Me::simplePrint($result1, true);
173
-                                      echo "------<br>";
174
-                                  } else {
175
-                                      echo $key1." --> "."Array() <br>";
176
-                                  } 
177
-                            } else {
178
-                                if (is_object($result1)) {
179
-                                    if ($deepPrinting) {
180
-                                        echo "<br>$key1 ------><br>";
181
-                                        $oarray = (array)$result1;
182
-                                        Route4Me::simplePrint($oarray, true);
183
-                                        echo "------<br>";
184
-                                    } else {
185
-                                        echo $key1." --> "."Object <br>";
186
-                                    } 
187
-                                } else {
188
-                                    if (!is_null($result1)) {
189
-                                        echo $key1." --> ".$result1."<br>"; 
190
-                                    }   
191
-                                }
192
-                            }
193
-                        }
194
-                    } else {
195
-                        if (is_object($result)) {
196
-                            if ($deepPrinting) {
197
-                                echo "<br>$key ------><br>";
198
-                                $oarray = (array)$result;
199
-                                Route4Me::simplePrint($oarray, true);
200
-                                echo "------<br>";
201
-                            } else {
202
-                                echo $key." --> "."Object <br>";
203
-                            } 
204
-                        } else {
205
-                            if (!is_null($result)) {
206
-                                echo $key." --> ".$result."<br>";
207
-                            }
208
-                        }
157
+	/**
158
+	 * Prints on the screen main keys and values of the array 
159
+	 * @param $results: object to be printed on the screen.
160
+	 * @param $deepPrinting: if true, object will be printed recursively.
161
+	 */
162
+	public static function simplePrint($results, $deepPrinting = null)
163
+	{
164
+		if (isset($results)) {
165
+			if (is_array($results)) {
166
+				foreach ($results as $key=>$result) {
167
+					if (is_array($result)) {
168
+						foreach ($result as $key1=>$result1) {
169
+							if (is_array($result1)) {
170
+								  if ($deepPrinting) {
171
+									  echo "<br>$key1 ------><br>";
172
+									  Route4Me::simplePrint($result1, true);
173
+									  echo "------<br>";
174
+								  } else {
175
+									  echo $key1." --> "."Array() <br>";
176
+								  } 
177
+							} else {
178
+								if (is_object($result1)) {
179
+									if ($deepPrinting) {
180
+										echo "<br>$key1 ------><br>";
181
+										$oarray = (array)$result1;
182
+										Route4Me::simplePrint($oarray, true);
183
+										echo "------<br>";
184
+									} else {
185
+										echo $key1." --> "."Object <br>";
186
+									} 
187
+								} else {
188
+									if (!is_null($result1)) {
189
+										echo $key1." --> ".$result1."<br>"; 
190
+									}   
191
+								}
192
+							}
193
+						}
194
+					} else {
195
+						if (is_object($result)) {
196
+							if ($deepPrinting) {
197
+								echo "<br>$key ------><br>";
198
+								$oarray = (array)$result;
199
+								Route4Me::simplePrint($oarray, true);
200
+								echo "------<br>";
201
+							} else {
202
+								echo $key." --> "."Object <br>";
203
+							} 
204
+						} else {
205
+							if (!is_null($result)) {
206
+								echo $key." --> ".$result."<br>";
207
+							}
208
+						}
209 209
                         
210
-                    }
211
-                    //echo "<br>";
212
-                }
213
-            } 
214
-        }
215
-    }
210
+					}
211
+					//echo "<br>";
212
+				}
213
+			} 
214
+		}
215
+	}
216 216
 
217
-    /**
218
-     * Generates query or body parameters.
219
-     * @param $allFields: all known fields could be used for parameters generation.
220
-     * @param $params: input parameters (array or object)
221
-     */
222
-    public static function generateRequestParameters($allFields, $params)
223
-    {
224
-        $generatedParams = array();
217
+	/**
218
+	 * Generates query or body parameters.
219
+	 * @param $allFields: all known fields could be used for parameters generation.
220
+	 * @param $params: input parameters (array or object)
221
+	 */
222
+	public static function generateRequestParameters($allFields, $params)
223
+	{
224
+		$generatedParams = array();
225 225
         
226
-        if (is_array($params)) {
227
-            foreach ($allFields as $field) {
228
-                if (isset($params[$field])) {
229
-                    $generatedParams[$field] = $params[$field];
230
-                }
231
-            }
232
-        } elseif (is_object($params)) {
233
-            foreach ($allFields as $field) {
234
-                if (isset($params->{$field})) {
235
-                    $generatedParams[$field] = $params->{$field};
236
-                }
237
-            }
238
-        }
226
+		if (is_array($params)) {
227
+			foreach ($allFields as $field) {
228
+				if (isset($params[$field])) {
229
+					$generatedParams[$field] = $params[$field];
230
+				}
231
+			}
232
+		} elseif (is_object($params)) {
233
+			foreach ($allFields as $field) {
234
+				if (isset($params->{$field})) {
235
+					$generatedParams[$field] = $params->{$field};
236
+				}
237
+			}
238
+		}
239 239
 
240
-        return $generatedParams;
241
-    }
240
+		return $generatedParams;
241
+	}
242 242
     
243
-    /**
244
-     * Returns an array of the object properties
245
-     * @param $object: An object.
246
-     * @param $exclude: array of the object parameters to be excluded from the returned array.
247
-     */
248
-    public static function getObjectProperties($object, $exclude)
249
-    {
250
-        $objectParameters = array();
243
+	/**
244
+	 * Returns an array of the object properties
245
+	 * @param $object: An object.
246
+	 * @param $exclude: array of the object parameters to be excluded from the returned array.
247
+	 */
248
+	public static function getObjectProperties($object, $exclude)
249
+	{
250
+		$objectParameters = array();
251 251
         
252
-        foreach (get_object_vars($object) as $key => $value) {
253
-            if (property_exists($object, $key)) {
254
-                if (!is_numeric(array_search($key, $exclude))) {
255
-                    array_push($objectParameters, $key);
256
-                }
257
-            }
258
-        }
252
+		foreach (get_object_vars($object) as $key => $value) {
253
+			if (property_exists($object, $key)) {
254
+				if (!is_numeric(array_search($key, $exclude))) {
255
+					array_push($objectParameters, $key);
256
+				}
257
+			}
258
+		}
259 259
         
260
-        return $objectParameters;
261
-    }
260
+		return $objectParameters;
261
+	}
262 262
     
263
-    /**
264
-     * Returns url path generated from the array of the fields and parameters.
265
-     * @param $allFields; array of the paossible fields (parameter names).
266
-     * @param $params: input parameters (array or object).
267
-     */
268
-    public static function generateUrlPath($allFields, $params)
269
-    {
270
-        $generatedPath = "";
263
+	/**
264
+	 * Returns url path generated from the array of the fields and parameters.
265
+	 * @param $allFields; array of the paossible fields (parameter names).
266
+	 * @param $params: input parameters (array or object).
267
+	 */
268
+	public static function generateUrlPath($allFields, $params)
269
+	{
270
+		$generatedPath = "";
271 271
 
272
-        if (is_array($params)) {
273
-            foreach ($allFields as $field) {
274
-                if (isset($params[$field])) {
275
-                    $generatedPath .= $params[$field].'/';
276
-                }
277
-            }
278
-        } elseif (is_object($params)) {
279
-            foreach ($allFields as $field) {
280
-                if (isset($params->{$field})) {
281
-                    $generatedPath .= $params->{$field}.'/';
282
-                }
283
-            }
284
-        }
272
+		if (is_array($params)) {
273
+			foreach ($allFields as $field) {
274
+				if (isset($params[$field])) {
275
+					$generatedPath .= $params[$field].'/';
276
+				}
277
+			}
278
+		} elseif (is_object($params)) {
279
+			foreach ($allFields as $field) {
280
+				if (isset($params->{$field})) {
281
+					$generatedPath .= $params->{$field}.'/';
282
+				}
283
+			}
284
+		}
285 285
         
286
-        return $generatedPath;
287
-    }
286
+		return $generatedPath;
287
+	}
288 288
     
289
-    public static function getFileRealPath($fileName)
290
-    {
291
-        $rpath = function_exists('curl_file_create') ? curl_file_create(realpath($fileName)) : '@'.realpath($fileName);
289
+	public static function getFileRealPath($fileName)
290
+	{
291
+		$rpath = function_exists('curl_file_create') ? curl_file_create(realpath($fileName)) : '@'.realpath($fileName);
292 292
         
293
-        return $rpath;
294
-    }
293
+		return $rpath;
294
+	}
295 295
 }
Please login to merge, or discard this patch.
examples/multiple_depot_multiple_driver.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -26,20 +26,20 @@
 block discarded – undo
26 26
 
27 27
 $addresses = array();
28 28
 foreach ($json as $address) {
29
-    $addresses[] = Address::fromArray($address);
29
+	$addresses[] = Address::fromArray($address);
30 30
 }
31 31
 
32 32
 $parameters = RouteParameters::fromArray(array(
33
-    "algorithm_type"          => AlgorithmType::CVRP_TW_SD,
34
-    "distance_unit"           => DistanceUnit::MILES,
35
-    "device_type"             => DeviceType::WEB,
36
-    "optimize"                => OptimizationType::DISTANCE,
37
-    "metric"                  => Metric::GEODESIC,
38
-    "route_max_duration"      => 86400 * 2,
39
-    "travel_mode"             => TravelMode::DRIVING,
40
-    "vehicle_capacity"        => 50,
41
-    "vehicle_max_distance_mi" => 10000,
42
-    "parts"                   => 50
33
+	"algorithm_type"          => AlgorithmType::CVRP_TW_SD,
34
+	"distance_unit"           => DistanceUnit::MILES,
35
+	"device_type"             => DeviceType::WEB,
36
+	"optimize"                => OptimizationType::DISTANCE,
37
+	"metric"                  => Metric::GEODESIC,
38
+	"route_max_duration"      => 86400 * 2,
39
+	"travel_mode"             => TravelMode::DRIVING,
40
+	"vehicle_capacity"        => 50,
41
+	"vehicle_max_distance_mi" => 10000,
42
+	"parts"                   => 50
43 43
 ));
44 44
 
45 45
 $optimizationParams = new OptimizationProblemParams;
Please login to merge, or discard this patch.
examples/SingleDriverMultipleTimeWindows.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -25,18 +25,18 @@  discard block
 block discarded – undo
25 25
 
26 26
 $addresses = array();
27 27
 foreach ($json as $address) {
28
-    $addresses[] = Address::fromArray($address);
28
+	$addresses[] = Address::fromArray($address);
29 29
 }
30 30
 
31 31
 $parameters = RouteParameters::fromArray(array(
32
-    "algorithm_type"     => Algorithmtype::TSP,
33
-    "route_name"         => "Single Driver Multiple TimeWindows 12 Stops",
34
-    "route_date"         => time() + 24 * 60 * 60,
35
-    "route_time"         => 5 * 3600 + 30 * 60,
36
-    "distance_unit"      => DistanceUnit::MILES,
37
-    "device_type"        => DeviceType::WEB,
38
-    "optimize"           => OptimizationType::DISTANCE,
39
-    "metric"             => Metric::GEODESIC
32
+	"algorithm_type"     => Algorithmtype::TSP,
33
+	"route_name"         => "Single Driver Multiple TimeWindows 12 Stops",
34
+	"route_date"         => time() + 24 * 60 * 60,
35
+	"route_time"         => 5 * 3600 + 30 * 60,
36
+	"distance_unit"      => DistanceUnit::MILES,
37
+	"device_type"        => DeviceType::WEB,
38
+	"optimize"           => OptimizationType::DISTANCE,
39
+	"metric"             => Metric::GEODESIC
40 40
 ));
41 41
 
42 42
 $optimizationParams = new OptimizationProblemParams;
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
 $problem = OptimizationProblem::optimize($optimizationParams);
47 47
 
48 48
 foreach ((array)$problem as $key => $value) {
49
-    if (is_string($value)) {
50
-        echo $key." --> ".$value."<br>";
51
-    } else {
52
-        echo "************ $key ************* <br>";
53
-        Route4Me::simplePrint((array)$value, true);
54
-        echo "******************************* <br>";
55
-    }
49
+	if (is_string($value)) {
50
+		echo $key." --> ".$value."<br>";
51
+	} else {
52
+		echo "************ $key ************* <br>";
53
+		Route4Me::simplePrint((array)$value, true);
54
+		echo "******************************* <br>";
55
+	}
56 56
 }
Please login to merge, or discard this patch.
examples/SingleDepotMultipleDriverNoTimeWindow.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -26,24 +26,24 @@  discard block
 block discarded – undo
26 26
 
27 27
 $addresses = array();
28 28
 foreach ($json as $address) {
29
-    $addresses[] = Address::fromArray($address);
29
+	$addresses[] = Address::fromArray($address);
30 30
 }
31 31
 
32 32
 $parameters = RouteParameters::fromArray(array(
33
-    "algorithm_type"          => Algorithmtype::CVRP_TW_SD,
34
-    "route_name"              => "Single Depot, Multiple Driver, No Time Window",
35
-    "route_date"              => time() + 24 * 60 * 60,
36
-    "route_time"              => 60 * 60 * 7,
37
-    "rt"                      => TRUE,
38
-    "distance_unit"           => DistanceUnit::MILES,
39
-    "device_type"             => DeviceType::WEB,
40
-    "optimize"                => OptimizationType::TIME,
41
-    "metric"                  => Metric::GEODESIC,
42
-    "route_max_duration"      => 86400,
43
-    "travel_mode"             => TravelMode::DRIVING,
44
-    "vehicle_capacity"        => 20,
45
-    "vehicle_max_distance_mi" => 99999,
46
-    "parts"                   => 4
33
+	"algorithm_type"          => Algorithmtype::CVRP_TW_SD,
34
+	"route_name"              => "Single Depot, Multiple Driver, No Time Window",
35
+	"route_date"              => time() + 24 * 60 * 60,
36
+	"route_time"              => 60 * 60 * 7,
37
+	"rt"                      => TRUE,
38
+	"distance_unit"           => DistanceUnit::MILES,
39
+	"device_type"             => DeviceType::WEB,
40
+	"optimize"                => OptimizationType::TIME,
41
+	"metric"                  => Metric::GEODESIC,
42
+	"route_max_duration"      => 86400,
43
+	"travel_mode"             => TravelMode::DRIVING,
44
+	"vehicle_capacity"        => 20,
45
+	"vehicle_max_distance_mi" => 99999,
46
+	"parts"                   => 4
47 47
 ));
48 48
 
49 49
 $optimizationParams = new OptimizationProblemParams;
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 $problem = OptimizationProblem::optimize($optimizationParams);
54 54
 
55 55
 foreach ((array)$problem as $key => $value) {
56
-    if (is_string($value)) {
57
-        echo $key." --> ".$value."<br>";
58
-    } else {
59
-        echo "************ $key ************* <br>";
60
-        Route4Me::simplePrint((array)$value, true);
61
-        echo "******************************* <br>";
62
-    }
56
+	if (is_string($value)) {
57
+		echo $key." --> ".$value."<br>";
58
+	} else {
59
+		echo "************ $key ************* <br>";
60
+		Route4Me::simplePrint((array)$value, true);
61
+		echo "******************************* <br>";
62
+	}
63 63
 }
Please login to merge, or discard this patch.
examples/single_driver_round_trip.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -27,19 +27,19 @@  discard block
 block discarded – undo
27 27
 $addresses = array();
28 28
 
29 29
 foreach ($json as $address) {
30
-    $addresses[] = Address::fromArray($address);
30
+	$addresses[] = Address::fromArray($address);
31 31
 }
32 32
 
33 33
 $parameters = RouteParameters::fromArray(array(
34
-    "algorithm_type"          => AlgorithmType::TSP,
35
-    "distance_unit"           => DistanceUnit::MILES,
36
-    "device_type"             => DeviceType::WEB,
37
-    "optimize"                => OptimizationType::DISTANCE,
38
-    "travel_mode"             => TravelMode::DRIVING,
39
-    "route_max_duration"      => 86400,
40
-    "vehicle_capacity"        => 1,
41
-    "vehicle_max_distance_mi" => 10000,
42
-    "rt"                      => true
34
+	"algorithm_type"          => AlgorithmType::TSP,
35
+	"distance_unit"           => DistanceUnit::MILES,
36
+	"device_type"             => DeviceType::WEB,
37
+	"optimize"                => OptimizationType::DISTANCE,
38
+	"travel_mode"             => TravelMode::DRIVING,
39
+	"route_max_duration"      => 86400,
40
+	"vehicle_capacity"        => 1,
41
+	"vehicle_max_distance_mi" => 10000,
42
+	"rt"                      => true
43 43
 ));
44 44
 
45 45
 $optimizationParams = new OptimizationProblemParams;
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
 $problems = OptimizationProblem::optimize($optimizationParams);
50 50
 
51 51
 foreach ($problems as $problem) {
52
-    if (is_array($problem) || is_object($problem)) {
53
-        foreach ($problem as $key => $value) {
54
-            if (!is_object($value)) {
55
-                echo $key." --> ".$value."<br>";
56
-            }
57
-        }
58
-    }
52
+	if (is_array($problem) || is_object($problem)) {
53
+		foreach ($problem as $key => $value) {
54
+			if (!is_object($value)) {
55
+				echo $key." --> ".$value."<br>";
56
+			}
57
+		}
58
+	}
59 59
 }
Please login to merge, or discard this patch.
examples/Members/create_device_record.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@
 block discarded – undo
13 13
 Route4Me::setApiKey('11111111111111111111111111111111');
14 14
 
15 15
 $recordParameters = Member::fromArray(array(
16
-    'device_id'   => '546546516',
17
-    'device_type' => 'IPAD',
18
-    'format'      => 'json',
16
+	'device_id'   => '546546516',
17
+	'device_type' => 'IPAD',
18
+	'format'      => 'json',
19 19
 ));
20 20
 
21 21
 $member = new Member();
Please login to merge, or discard this patch.
examples/Members/purchase_user_license.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@
 block discarded – undo
13 13
 Route4Me::setApiKey('11111111111111111111111111111111');
14 14
 
15 15
 $recordParameters = Member::fromArray(array(
16
-    'member_id'         => 77777,
17
-    'session_guid'      => '454563',
18
-    'device_id'         => '54564',
19
-    'device_type'       =>'ipad',
20
-    'subscription_name' =>'IPAD_MONTHLY',
21
-    'token'             =>'4/P7q7W91a-oMsCeLvIaQm6bTrgtp7',
22
-    'payload'           =>'APA91bHun4MxP5egoKMwt2KZFBaFUH-1RYqx',
23
-    'format'            =>'json'
16
+	'member_id'         => 77777,
17
+	'session_guid'      => '454563',
18
+	'device_id'         => '54564',
19
+	'device_type'       =>'ipad',
20
+	'subscription_name' =>'IPAD_MONTHLY',
21
+	'token'             =>'4/P7q7W91a-oMsCeLvIaQm6bTrgtp7',
22
+	'payload'           =>'APA91bHun4MxP5egoKMwt2KZFBaFUH-1RYqx',
23
+	'format'            =>'json'
24 24
 ));
25 25
 
26 26
 $member = new Member();
Please login to merge, or discard this patch.
src/Route4Me/Address.php 1 patch
Indentation   +236 added lines, -236 removed lines patch added patch discarded remove patch
@@ -7,284 +7,284 @@
 block discarded – undo
7 7
 
8 8
 class Address extends Common
9 9
 {
10
-    public $route_destination_id;
11
-    public $alias;
12
-    public $member_id;
13
-    public $address;
14
-    public $addressUpdate;
15
-    public $is_depot = false;
16
-    public $lat;
17
-    public $lng;
18
-    public $route_id;
19
-    public $original_route_id;
20
-    public $optimization_problem_id;
21
-    public $sequence_no;
22
-    public $geocoded;
23
-    public $preferred_geocoding;
24
-    public $failed_geocoding;
25
-    public $geocodings = array();
26
-    public $contact_id;
27
-    public $is_visited;
28
-    public $customer_po;
29
-    public $invoice_no;
30
-    public $reference_no;
31
-    public $order_no;
32
-    public $weight;
33
-    public $cost;
34
-    public $revenue;
35
-    public $cube;
36
-    public $pieces;
37
-    public $email;
38
-    public $phone;
39
-    public $tracking_number;
40
-    public $destination_note_count;
41
-    public $drive_time_to_next_destination;
42
-    public $distance_to_next_destination;
43
-    public $generated_time_window_start;
44
-    public $generated_time_window_end;
45
-    public $time_window_start;
46
-    public $time_window_end;
47
-    public $time;
48
-    public $notes;
49
-    public $timestamp_last_visited;
50
-    public $custom_fields = array();
51
-    public $manifest = array();
10
+	public $route_destination_id;
11
+	public $alias;
12
+	public $member_id;
13
+	public $address;
14
+	public $addressUpdate;
15
+	public $is_depot = false;
16
+	public $lat;
17
+	public $lng;
18
+	public $route_id;
19
+	public $original_route_id;
20
+	public $optimization_problem_id;
21
+	public $sequence_no;
22
+	public $geocoded;
23
+	public $preferred_geocoding;
24
+	public $failed_geocoding;
25
+	public $geocodings = array();
26
+	public $contact_id;
27
+	public $is_visited;
28
+	public $customer_po;
29
+	public $invoice_no;
30
+	public $reference_no;
31
+	public $order_no;
32
+	public $weight;
33
+	public $cost;
34
+	public $revenue;
35
+	public $cube;
36
+	public $pieces;
37
+	public $email;
38
+	public $phone;
39
+	public $tracking_number;
40
+	public $destination_note_count;
41
+	public $drive_time_to_next_destination;
42
+	public $distance_to_next_destination;
43
+	public $generated_time_window_start;
44
+	public $generated_time_window_end;
45
+	public $time_window_start;
46
+	public $time_window_end;
47
+	public $time;
48
+	public $notes;
49
+	public $timestamp_last_visited;
50
+	public $custom_fields = array();
51
+	public $manifest = array();
52 52
     
53
-    public $first_name;
54
-    public $last_name;
55
-    public $is_departed;
56
-    public $timestamp_last_departed;
57
-    public $order_id;
58
-    public $priority;
59
-    public $curbside_lat;
60
-    public $curbside_lng;
61
-    public $time_window_start_2;
62
-    public $time_window_end_2;
53
+	public $first_name;
54
+	public $last_name;
55
+	public $is_departed;
56
+	public $timestamp_last_departed;
57
+	public $order_id;
58
+	public $priority;
59
+	public $curbside_lat;
60
+	public $curbside_lng;
61
+	public $time_window_start_2;
62
+	public $time_window_end_2;
63 63
 
64
-    public static function fromArray(array $params)
65
-    {
66
-        $address = new Address();
67
-        foreach ($params as $key => $value) {
68
-            if (property_exists($address, $key)) {
69
-                $address->{$key} = $value;
70
-            }
71
-        }
64
+	public static function fromArray(array $params)
65
+	{
66
+		$address = new Address();
67
+		foreach ($params as $key => $value) {
68
+			if (property_exists($address, $key)) {
69
+				$address->{$key} = $value;
70
+			}
71
+		}
72 72
         
73
-        return $address;
74
-    }
73
+		return $address;
74
+	}
75 75
 
76
-    public static function getAddress($routeId, $addressId)
77
-    {
78
-        $address = Route4Me::makeRequst(array(
79
-            'url'    => Endpoint::ADDRESS_V4,
80
-            'method' => 'GET',
81
-            'query'  => array(
82
-                'route_id'             => $routeId,
83
-                'route_destination_id' => $addressId,
84
-            )
85
-        ));
76
+	public static function getAddress($routeId, $addressId)
77
+	{
78
+		$address = Route4Me::makeRequst(array(
79
+			'url'    => Endpoint::ADDRESS_V4,
80
+			'method' => 'GET',
81
+			'query'  => array(
82
+				'route_id'             => $routeId,
83
+				'route_destination_id' => $addressId,
84
+			)
85
+		));
86 86
     
87
-        return Address::fromArray($address);
88
-    }
87
+		return Address::fromArray($address);
88
+	}
89 89
     
90
-    /*Get notes from the specified route destination
90
+	/*Get notes from the specified route destination
91 91
      * Returns an address object with notes, if an address exists, otherwise - return null.
92 92
      */
93
-    public static function GetAddressesNotes($noteParams)
94
-    {
95
-        $address = Route4Me::makeRequst(array(
96
-            'url'    => Endpoint::ADDRESS_V4,
97
-            'method' => 'GET',
98
-            'query'  => array(
99
-                'route_id'             => isset($noteParams['route_id']) ? $noteParams['route_id'] : null, 
100
-                'route_destination_id' => isset($noteParams['route_destination_id']) 
101
-                                             ? $noteParams['route_destination_id'] : null,
102
-                'notes'                => 1,
103
-            )
104
-        ));
93
+	public static function GetAddressesNotes($noteParams)
94
+	{
95
+		$address = Route4Me::makeRequst(array(
96
+			'url'    => Endpoint::ADDRESS_V4,
97
+			'method' => 'GET',
98
+			'query'  => array(
99
+				'route_id'             => isset($noteParams['route_id']) ? $noteParams['route_id'] : null, 
100
+				'route_destination_id' => isset($noteParams['route_destination_id']) 
101
+											 ? $noteParams['route_destination_id'] : null,
102
+				'notes'                => 1,
103
+			)
104
+		));
105 105
     
106
-        return $address;
107
-    }
106
+		return $address;
107
+	}
108 108
 
109
-    public function update()
110
-    {
111
-        $addressUpdate = Route4Me::makeRequst(array(
112
-            'url'    => Endpoint::ADDRESS_V4,
113
-            'method' => 'PUT',
114
-            'body'   => $this->toArray(),
115
-            'query'  => array(
116
-                'route_id'             => $this->route_id,
117
-                'route_destination_id' => $this->route_destination_id,
118
-            ),
119
-        ));
109
+	public function update()
110
+	{
111
+		$addressUpdate = Route4Me::makeRequst(array(
112
+			'url'    => Endpoint::ADDRESS_V4,
113
+			'method' => 'PUT',
114
+			'body'   => $this->toArray(),
115
+			'query'  => array(
116
+				'route_id'             => $this->route_id,
117
+				'route_destination_id' => $this->route_destination_id,
118
+			),
119
+		));
120 120
     
121
-        return Address::fromArray($addressUpdate);
122
-    }
121
+		return Address::fromArray($addressUpdate);
122
+	}
123 123
     
124
-    public function markAddress($params)
125
-    {
126
-        $allQueryFields = array('route_id', 'route_destination_id');
127
-        $allBodyFields = array('is_visited', 'is_departed');
124
+	public function markAddress($params)
125
+	{
126
+		$allQueryFields = array('route_id', 'route_destination_id');
127
+		$allBodyFields = array('is_visited', 'is_departed');
128 128
         
129
-        $result = Route4Me::makeRequst(array(
130
-            'url'    => Endpoint::ADDRESS_V4,
131
-            'method' => 'PUT',
132
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
133
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
134
-        ));
129
+		$result = Route4Me::makeRequst(array(
130
+			'url'    => Endpoint::ADDRESS_V4,
131
+			'method' => 'PUT',
132
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
133
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
134
+		));
135 135
     
136
-        return $result;
137
-    }
136
+		return $result;
137
+	}
138 138
     
139
-    public function markAsDeparted($params)
140
-    {
141
-        $allQueryFields = array('route_id', 'address_id', 'is_departed', 'member_id');
139
+	public function markAsDeparted($params)
140
+	{
141
+		$allQueryFields = array('route_id', 'address_id', 'is_departed', 'member_id');
142 142
         
143
-        $address = Route4Me::makeRequst(array(
144
-            'url'    => Endpoint::MARK_ADDRESS_DEPARTED,
145
-            'method' => 'PUT',
146
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
147
-        ));
143
+		$address = Route4Me::makeRequst(array(
144
+			'url'    => Endpoint::MARK_ADDRESS_DEPARTED,
145
+			'method' => 'PUT',
146
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
147
+		));
148 148
     
149
-        return $address;
150
-    }
149
+		return $address;
150
+	}
151 151
     
152
-    public function markAsVisited($params)
153
-    {
154
-        $allQueryFields = array('route_id', 'address_id', 'is_visited', 'member_id');
152
+	public function markAsVisited($params)
153
+	{
154
+		$allQueryFields = array('route_id', 'address_id', 'is_visited', 'member_id');
155 155
         
156
-        $address = Route4Me::makeRequst(array(
157
-            'url'    => Endpoint::UPDATE_ADDRESS_VISITED,
158
-            'method' => 'PUT',
159
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
160
-        ));
156
+		$address = Route4Me::makeRequst(array(
157
+			'url'    => Endpoint::UPDATE_ADDRESS_VISITED,
158
+			'method' => 'PUT',
159
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
160
+		));
161 161
     
162
-        return $address;
163
-    }
162
+		return $address;
163
+	}
164 164
 
165
-    public function deleteAddress()
166
-    {
167
-        $address = Route4Me::makeRequst(array(
168
-            'url'    => Endpoint::ADDRESS_V4,
169
-            'method' => 'DELETE',
170
-            'query'  => array(
171
-                'route_id'             => $this->route_id,
172
-                'route_destination_id' => $this->route_destination_id,
173
-            )
174
-        ));
165
+	public function deleteAddress()
166
+	{
167
+		$address = Route4Me::makeRequst(array(
168
+			'url'    => Endpoint::ADDRESS_V4,
169
+			'method' => 'DELETE',
170
+			'query'  => array(
171
+				'route_id'             => $this->route_id,
172
+				'route_destination_id' => $this->route_destination_id,
173
+			)
174
+		));
175 175
     
176
-        return (bool)$address['deleted'];
177
-    }
176
+		return (bool)$address['deleted'];
177
+	}
178 178
     
179
-    public function moveDestinationToRoute($params)
180
-    {
181
-        $allBodyFields = array('to_route_id', 'route_destination_id', 'after_destination_id');
179
+	public function moveDestinationToRoute($params)
180
+	{
181
+		$allBodyFields = array('to_route_id', 'route_destination_id', 'after_destination_id');
182 182
         
183
-        $result = Route4Me::makeRequst(array(
184
-            'url'    => Endpoint::MOVE_ROUTE_DESTINATION,
185
-            'method' => 'POST',
186
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
187
-            'HTTPHEADER'  => 'Content-Type: multipart/form-data'
188
-        ));
183
+		$result = Route4Me::makeRequst(array(
184
+			'url'    => Endpoint::MOVE_ROUTE_DESTINATION,
185
+			'method' => 'POST',
186
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
187
+			'HTTPHEADER'  => 'Content-Type: multipart/form-data'
188
+		));
189 189
 
190
-        return $result;
191
-    }
190
+		return $result;
191
+	}
192 192
     
193
-    public function AddAddressNote($params)
194
-    {
195
-        $allQueryFields = array('route_id', 'address_id', 'dev_lat', 'dev_lng', 'device_type');
196
-        $allBodyFields = array('strNoteContents', 'strUpdateType');
193
+	public function AddAddressNote($params)
194
+	{
195
+		$allQueryFields = array('route_id', 'address_id', 'dev_lat', 'dev_lng', 'device_type');
196
+		$allBodyFields = array('strNoteContents', 'strUpdateType');
197 197
         
198
-        $result = Route4Me::makeRequst(array(
199
-            'url'    => Endpoint::ROUTE_NOTES_ADD,
200
-            'method' => 'POST',
201
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
202
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
203
-            'HTTPHEADER'  => 'Content-Type: multipart/form-data'
204
-        ));
198
+		$result = Route4Me::makeRequst(array(
199
+			'url'    => Endpoint::ROUTE_NOTES_ADD,
200
+			'method' => 'POST',
201
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
202
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
203
+			'HTTPHEADER'  => 'Content-Type: multipart/form-data'
204
+		));
205 205
 
206
-        return $result;
207
-    }
206
+		return $result;
207
+	}
208 208
 
209
-    public function AddNoteFile($params)
210
-    {
211
-        $allQueryFields = array('route_id', 'address_id', 'dev_lat', 'dev_lng', 'device_type', 'strUpdateType');
209
+	public function AddNoteFile($params)
210
+	{
211
+		$allQueryFields = array('route_id', 'address_id', 'dev_lat', 'dev_lng', 'device_type', 'strUpdateType');
212 212
         
213
-        $result = Route4Me::makeRequst(array(
214
-            'url'    => Endpoint::ROUTE_NOTES_ADD,
215
-            'method' => 'POST',
216
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
217
-            'body'   => array(
218
-                'strFilename'  => isset($params['strFilename']) ? Route4Me::getFileRealPath($params['strFilename']) : "" 
219
-            ),
220
-            'HTTPHEADER'  => 'Content-Type: multipart/form-data'
221
-        ));
213
+		$result = Route4Me::makeRequst(array(
214
+			'url'    => Endpoint::ROUTE_NOTES_ADD,
215
+			'method' => 'POST',
216
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
217
+			'body'   => array(
218
+				'strFilename'  => isset($params['strFilename']) ? Route4Me::getFileRealPath($params['strFilename']) : "" 
219
+			),
220
+			'HTTPHEADER'  => 'Content-Type: multipart/form-data'
221
+		));
222 222
 
223
-        return $result;
224
-    }
223
+		return $result;
224
+	}
225 225
 
226
-    public function createCustomNoteType($params)
227
-    {
228
-        $allBodyFields = array('type', 'values');
226
+	public function createCustomNoteType($params)
227
+	{
228
+		$allBodyFields = array('type', 'values');
229 229
         
230
-        $result = Route4Me::makeRequst(array(
231
-            'url'    => Endpoint::NOTE_CUSTOM_TYPES_V4,
232
-            'method' => 'POST',
233
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
234
-        ));
230
+		$result = Route4Me::makeRequst(array(
231
+			'url'    => Endpoint::NOTE_CUSTOM_TYPES_V4,
232
+			'method' => 'POST',
233
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
234
+		));
235 235
 
236
-        return $result;
237
-    }
236
+		return $result;
237
+	}
238 238
     
239
-    public function removeCustomNoteType($params)
240
-    {
241
-        $result = Route4Me::makeRequst(array(
242
-            'url'    => Endpoint::NOTE_CUSTOM_TYPES_V4,
243
-            'method' => 'DELETE',
244
-            'body'   => array(
245
-                'id' => isset($params['id']) ? $params['id'] : null
246
-            )
247
-        ));
239
+	public function removeCustomNoteType($params)
240
+	{
241
+		$result = Route4Me::makeRequst(array(
242
+			'url'    => Endpoint::NOTE_CUSTOM_TYPES_V4,
243
+			'method' => 'DELETE',
244
+			'body'   => array(
245
+				'id' => isset($params['id']) ? $params['id'] : null
246
+			)
247
+		));
248 248
 
249
-        return $result;
250
-    }
249
+		return $result;
250
+	}
251 251
     
252
-    public function getAllCustomNoteTypes()
253
-    {
254
-        $result = Route4Me::makeRequst(array(
255
-            'url'    => Endpoint::NOTE_CUSTOM_TYPES_V4,
256
-            'method' => 'GET'
257
-        ));
252
+	public function getAllCustomNoteTypes()
253
+	{
254
+		$result = Route4Me::makeRequst(array(
255
+			'url'    => Endpoint::NOTE_CUSTOM_TYPES_V4,
256
+			'method' => 'GET'
257
+		));
258 258
 
259
-        return $result;
260
-    }
259
+		return $result;
260
+	}
261 261
     
262
-    public function addCustomNoteToRoute($params)
263
-    {
264
-        $customArray = array();
262
+	public function addCustomNoteToRoute($params)
263
+	{
264
+		$customArray = array();
265 265
         
266
-        foreach ($params as $key => $value) {
267
-            if (strpos($key, "custom_note_type")!==false) {
268
-                $customArray[$key] = $value;
269
-            }
270
-        }
266
+		foreach ($params as $key => $value) {
267
+			if (strpos($key, "custom_note_type")!==false) {
268
+				$customArray[$key] = $value;
269
+			}
270
+		}
271 271
         
272
-        $allQueryFields = array('route_id', 'address_id', 'format', 'dev_lat', 'dev_lng');
273
-        $allBodyFields = array('strUpdateType', 'strUpdateType', 'strNoteContents');
272
+		$allQueryFields = array('route_id', 'address_id', 'format', 'dev_lat', 'dev_lng');
273
+		$allBodyFields = array('strUpdateType', 'strUpdateType', 'strNoteContents');
274 274
         
275
-        $result = Route4Me::makeRequst(array(
276
-            'url'    => Endpoint::ROUTE_NOTES_ADD,
277
-            'method' => 'POST',
278
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
279
-            'body'  => array_merge(Route4Me::generateRequestParameters($allBodyFields, $params), $customArray),
280
-            'HTTPHEADER'  => 'Content-Type: multipart/form-data'
281
-        ));
275
+		$result = Route4Me::makeRequst(array(
276
+			'url'    => Endpoint::ROUTE_NOTES_ADD,
277
+			'method' => 'POST',
278
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
279
+			'body'  => array_merge(Route4Me::generateRequestParameters($allBodyFields, $params), $customArray),
280
+			'HTTPHEADER'  => 'Content-Type: multipart/form-data'
281
+		));
282 282
 
283
-        return $result;
284
-    }
283
+		return $result;
284
+	}
285 285
 
286
-    function getAddressId()
287
-    {
288
-        return $this->route_destination_id;
289
-    }
286
+	function getAddressId()
287
+	{
288
+		return $this->route_destination_id;
289
+	}
290 290
 }
Please login to merge, or discard this patch.
examples/multiple_depot_with_time_window.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -27,23 +27,23 @@  discard block
 block discarded – undo
27 27
 $addresses = array();
28 28
 
29 29
 foreach ($json as $address) {
30
-    $addresses[] = Address::fromArray($address);
30
+	$addresses[] = Address::fromArray($address);
31 31
 }
32 32
 
33 33
 $parameters = RouteParameters::fromArray(array(
34
-    "algorithm_type"          => Algorithmtype::CVRP_TW_SD,
35
-    "route_name"              => "Multiple Depot, Multiple Driver, Time Window",
36
-    "route_date"              => time() + 24 * 60 * 60,
37
-    "route_time"              => 60 * 60 * 7,
38
-    "rt"                      => TRUE,
39
-    "distance_unit"           => DistanceUnit::MILES,
40
-    "device_type"             => DeviceType::WEB,
41
-    "optimize"                => OptimizationType::TIME,
42
-    "metric"                  => Metric::GEODESIC,
43
-    "route_max_duration"      => 86400 * 3,
44
-    "travel_mode"             => TravelMode::DRIVING,
45
-    "vehicle_capacity"        => 99,
46
-    "vehicle_max_distance_mi" => 99999
34
+	"algorithm_type"          => Algorithmtype::CVRP_TW_SD,
35
+	"route_name"              => "Multiple Depot, Multiple Driver, Time Window",
36
+	"route_date"              => time() + 24 * 60 * 60,
37
+	"route_time"              => 60 * 60 * 7,
38
+	"rt"                      => TRUE,
39
+	"distance_unit"           => DistanceUnit::MILES,
40
+	"device_type"             => DeviceType::WEB,
41
+	"optimize"                => OptimizationType::TIME,
42
+	"metric"                  => Metric::GEODESIC,
43
+	"route_max_duration"      => 86400 * 3,
44
+	"travel_mode"             => TravelMode::DRIVING,
45
+	"vehicle_capacity"        => 99,
46
+	"vehicle_max_distance_mi" => 99999
47 47
 ));
48 48
 
49 49
 $optimizationParams = new OptimizationProblemParams;
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 $problem = OptimizationProblem::optimize($optimizationParams);
54 54
 
55 55
 foreach ((array)$problem as $key => $value) {
56
-    if (is_string($value)) {
57
-        echo $key." --> ".$value."<br>";
58
-    } else {
59
-        echo "************ $key ************* <br>";
60
-        Route4Me::simplePrint((array)$value, true);
61
-        echo "******************************* <br>";
62
-    }
56
+	if (is_string($value)) {
57
+		echo $key." --> ".$value."<br>";
58
+	} else {
59
+		echo "************ $key ************* <br>";
60
+		Route4Me::simplePrint((array)$value, true);
61
+		echo "******************************* <br>";
62
+	}
63 63
 }
Please login to merge, or discard this patch.