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.
Passed
Push — master ( 39430a...e623a9 )
by Oleg
02:28
created
examples/Notes/GetAddressNotes.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 	
4 4
 	$vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
5 5
 
6
-    require $vdir.'/../vendor/autoload.php';
6
+	require $vdir.'/../vendor/autoload.php';
7 7
 	
8 8
 	use Route4Me\Route4Me;
9 9
 	use Route4Me\Route;
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	foreach ($notes['notes'] as $note) {
49 49
 		echo "========== Notes ==================<br>";
50 50
 		echo "note_id --> ".$note['note_id']."<br>";
51
-        $content = isset($note['contents']) ? $note['contents'] : "";
52
-        if (strlen($content)>0) echo "contents --> $content"."<br>";
51
+		$content = isset($note['contents']) ? $note['contents'] : "";
52
+		if (strlen($content)>0) echo "contents --> $content"."<br>";
53 53
 	}
54 54
 
55 55
 	//var_dump($notes);
Please login to merge, or discard this patch.
src/Route4Me/OptimizationProblemParams.php 1 patch
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -8,88 +8,88 @@
 block discarded – undo
8 8
 
9 9
 class OptimizationProblemParams extends Common
10 10
 {
11
-    public $optimization_problem_id;
12
-    public $reoptimize;
13
-    public $addresses = array();
14
-    public $parameters;
15
-    public $directions;
16
-    public $format;
17
-    public $route_path_output;
18
-    public $optimized_callback_url;
19
-    public $redirect = true;
11
+	public $optimization_problem_id;
12
+	public $reoptimize;
13
+	public $addresses = array();
14
+	public $parameters;
15
+	public $directions;
16
+	public $format;
17
+	public $route_path_output;
18
+	public $optimized_callback_url;
19
+	public $redirect = true;
20 20
 
21
-    public static function fromArray($params)
22
-    {
23
-        $param = new OptimizationProblemParams;
24
-        if (!isset($params['addresses'])) {
25
-            throw new BadParam('addresses must be provided.');
26
-        }
21
+	public static function fromArray($params)
22
+	{
23
+		$param = new OptimizationProblemParams;
24
+		if (!isset($params['addresses'])) {
25
+			throw new BadParam('addresses must be provided.');
26
+		}
27 27
 
28
-        if (!isset($params['parameters'])) {
29
-            throw new BadParam('parameters must be provided.');
30
-        }
28
+		if (!isset($params['parameters'])) {
29
+			throw new BadParam('parameters must be provided.');
30
+		}
31 31
 
32
-        if ($params['parameters'] instanceof RouteParameters) {
33
-            $param->setParameters($params['parameters']);
34
-        } else {
35
-            $param->setParameters(RouteParameters::fromArray($params['parameters']));
36
-        }
32
+		if ($params['parameters'] instanceof RouteParameters) {
33
+			$param->setParameters($params['parameters']);
34
+		} else {
35
+			$param->setParameters(RouteParameters::fromArray($params['parameters']));
36
+		}
37 37
 
38
-        foreach($params['addresses'] as $address) {
39
-            if (!($address instanceof Address)) {
40
-                $address = Address::fromArray($address);
41
-            }
42
-            $param->addAddress($address);
43
-        }
38
+		foreach($params['addresses'] as $address) {
39
+			if (!($address instanceof Address)) {
40
+				$address = Address::fromArray($address);
41
+			}
42
+			$param->addAddress($address);
43
+		}
44 44
 
45
-        $param->directions = self::getValue($params, 'directions');
46
-        $param->format = self::getValue($params, 'format');
47
-        $param->route_path_output = self::getValue($params, 'route_path_output');
48
-        $param->optimized_callback_url = self::getValue($params, 'optimized_callback_url');
49
-        $param->optimization_problem_id = self::getValue($params, 'optimization_problem_id');
50
-        $param->reoptimize = self::getValue($params, 'reoptimize');
51
-        $param->redirect = filter_var(
52
-            self::getValue($params, 'redirect', true), FILTER_VALIDATE_BOOLEAN);
45
+		$param->directions = self::getValue($params, 'directions');
46
+		$param->format = self::getValue($params, 'format');
47
+		$param->route_path_output = self::getValue($params, 'route_path_output');
48
+		$param->optimized_callback_url = self::getValue($params, 'optimized_callback_url');
49
+		$param->optimization_problem_id = self::getValue($params, 'optimization_problem_id');
50
+		$param->reoptimize = self::getValue($params, 'reoptimize');
51
+		$param->redirect = filter_var(
52
+			self::getValue($params, 'redirect', true), FILTER_VALIDATE_BOOLEAN);
53 53
 
54
-        return $param;
55
-    }
54
+		return $param;
55
+	}
56 56
 
57
-    public function __construct()
58
-    {
59
-        $this->parameters = new RouteParameters;
60
-    }
57
+	public function __construct()
58
+	{
59
+		$this->parameters = new RouteParameters;
60
+	}
61 61
 
62
-    public function setParameters(RouteParameters $params)
63
-    {
64
-        $this->parameters = $params;
65
-        return $this;
66
-    }
62
+	public function setParameters(RouteParameters $params)
63
+	{
64
+		$this->parameters = $params;
65
+		return $this;
66
+	}
67 67
 
68
-    public function addAddress(Address $address)
69
-    {
70
-        $this->addresses[] = $address;
71
-        return $this;
72
-    }
68
+	public function addAddress(Address $address)
69
+	{
70
+		$this->addresses[] = $address;
71
+		return $this;
72
+	}
73 73
     
74
-    public function getAddressesArray()
75
-    {
76
-        $addresses = array();
77
-        foreach($this->addresses as $address) {
78
-            $addresses[] = $address->toArray();
79
-        }
80
-        return $addresses;
81
-    }
74
+	public function getAddressesArray()
75
+	{
76
+		$addresses = array();
77
+		foreach($this->addresses as $address) {
78
+			$addresses[] = $address->toArray();
79
+		}
80
+		return $addresses;
81
+	}
82 82
 
83
-    public function getParametersArray()
84
-    {
85
-        return $this->parameters->toArray();
86
-    }
83
+	public function getParametersArray()
84
+	{
85
+		return $this->parameters->toArray();
86
+	}
87 87
 
88
-    public function setAddresses(array $addresses)
89
-    {
90
-        foreach ($addresses as $address) {
91
-            $this->addAddress($address);
92
-        }
93
-        return $this;
94
-    }
88
+	public function setAddresses(array $addresses)
89
+	{
90
+		foreach ($addresses as $address) {
91
+			$this->addAddress($address);
92
+		}
93
+		return $this;
94
+	}
95 95
 }
Please login to merge, or discard this patch.
src/Route4Me/Route4Me.php 1 patch
Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -7,37 +7,37 @@  discard block
 block discarded – undo
7 7
 
8 8
 class Route4Me
9 9
 {
10
-    static public $apiKey;
11
-    static public $baseUrl = 'https://api.route4me.com';
10
+	static public $apiKey;
11
+	static public $baseUrl = 'https://api.route4me.com';
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 33
 	public static function fileUploadRequest($options) {
34 34
 		$query = isset($options['query']) ?
35
-            array_filter($options['query']) : array();
35
+			array_filter($options['query']) : array();
36 36
 
37 37
 		if (sizeof($query)==0) return null;
38 38
 
39 39
 		$body = isset($options['body']) ?
40
-            array_filter($options['body']) : null;
40
+			array_filter($options['body']) : null;
41 41
 			
42 42
 		$fname = isset($body['strFilename']) ? $body['strFilename'] : '';
43 43
 		if ($fname=='') return null;
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 		$fp=fopen(realpath($fname),"r");
48 48
 		
49 49
 		$url = self::$baseUrl.$options['url'] . '?' . http_build_query(array_merge(
50
-            array( 'api_key' => self::getApiKey()), $query)
51
-        );
50
+			array( 'api_key' => self::getApiKey()), $query)
51
+		);
52 52
 		
53 53
 		//self::simplePrint($body);die("");
54 54
 		//echo "url=".$url."<br>";die("");
@@ -56,12 +56,12 @@  discard block
 block discarded – undo
56 56
 		$ch = curl_init($url);
57 57
 		
58 58
 		$curlOpts = array(
59
-            CURLOPT_RETURNTRANSFER => true,
60
-            CURLOPT_TIMEOUT        => 60,
61
-            CURLOPT_FOLLOWLOCATION => true,
62
-            CURLOPT_SSL_VERIFYHOST => FALSE,
63
-            CURLOPT_SSL_VERIFYPEER => FALSE
64
-        );
59
+			CURLOPT_RETURNTRANSFER => true,
60
+			CURLOPT_TIMEOUT        => 60,
61
+			CURLOPT_FOLLOWLOCATION => true,
62
+			CURLOPT_SSL_VERIFYHOST => FALSE,
63
+			CURLOPT_SSL_VERIFYPEER => FALSE
64
+		);
65 65
 		
66 66
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
67 67
 		
@@ -77,64 +77,64 @@  discard block
 block discarded – undo
77 77
 		fclose($fp);
78 78
 		//var_dump($result); die('');
79 79
 		$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
80
-        curl_close($ch);
80
+		curl_close($ch);
81 81
 		//echo "code = $code <br>";
82 82
 		$json = json_decode($result, true);
83 83
 		//var_dump($json); die("");
84
-        if (200 == $code) {
85
-            return $json;
86
-        } elseif (isset($json['errors'])) {
87
-            throw new ApiError(implode(', ', $json['errors']));
88
-        } else {
89
-            throw new ApiError('Something wrong');
90
-        }
84
+		if (200 == $code) {
85
+			return $json;
86
+		} elseif (isset($json['errors'])) {
87
+			throw new ApiError(implode(', ', $json['errors']));
88
+		} else {
89
+			throw new ApiError('Something wrong');
90
+		}
91 91
 	}
92 92
 
93
-    public static function makeRequst($options) {
94
-        $errorHandler = new myErrorHandler();
93
+	public static function makeRequst($options) {
94
+		$errorHandler = new myErrorHandler();
95 95
     
96
-        $old_error_handler = set_error_handler(array( $errorHandler, "proc_error"));
97
-        $method = isset($options['method']) ? $options['method'] : 'GET';
98
-        $query = isset($options['query']) ?
99
-            array_filter($options['query'], function($x) { return !is_null($x); } ) : array();
100
-        //echo "query=".$query['member_id'];die("");
101
-        $body = isset($options['body']) ? $options['body'] : null;
96
+		$old_error_handler = set_error_handler(array( $errorHandler, "proc_error"));
97
+		$method = isset($options['method']) ? $options['method'] : 'GET';
98
+		$query = isset($options['query']) ?
99
+			array_filter($options['query'], function($x) { return !is_null($x); } ) : array();
100
+		//echo "query=".$query['member_id'];die("");
101
+		$body = isset($options['body']) ? $options['body'] : null;
102 102
 		$file = isset($options['FILE']) ? $options['FILE'] : null;
103
-        $headers = array(
104
-            "User-Agent: Route4Me php-sdk"
105
-        );
103
+		$headers = array(
104
+			"User-Agent: Route4Me php-sdk"
105
+		);
106 106
         
107
-        if (isset($options['HTTPHEADER'])) {
108
-            $headers[]=$options['HTTPHEADER'];
109
-        }
107
+		if (isset($options['HTTPHEADER'])) {
108
+			$headers[]=$options['HTTPHEADER'];
109
+		}
110 110
 
111 111
 		if (isset($options['HTTPHEADERS'])) {
112
-		    foreach ($options['HTTPHEADERS'] As $header) $headers[]=$header;
113
-        }
114
-        //self::simplePrint($headers); die("");
115
-        $ch = curl_init();
116
-        $url = $options['url'] . '?' . http_build_query(array_merge(
117
-            $query, array( 'api_key' => self::getApiKey())
118
-        ));
112
+			foreach ($options['HTTPHEADERS'] As $header) $headers[]=$header;
113
+		}
114
+		//self::simplePrint($headers); die("");
115
+		$ch = curl_init();
116
+		$url = $options['url'] . '?' . http_build_query(array_merge(
117
+			$query, array( 'api_key' => self::getApiKey())
118
+		));
119 119
 		//var_dump($body); echo "<br><br>";
120 120
 		//$jfile=json_encode($body); echo "<br><br>".$jfile; die("STOPPPP");
121 121
 
122
-        //self::simplePrint($headers); die("");
122
+		//self::simplePrint($headers); die("");
123 123
 		$baseUrl=self::getBaseUrl();
124 124
 		
125 125
 		if (strpos($url,'move_route_destination')>0) $baseUrl='https://api.route4me.com';
126
-        $curlOpts = arraY(
127
-            CURLOPT_URL            => $baseUrl. $url,
128
-            CURLOPT_RETURNTRANSFER => true,
129
-            CURLOPT_TIMEOUT        => 60,
130
-            CURLOPT_FOLLOWLOCATION => true,
131
-            CURLOPT_SSL_VERIFYHOST => FALSE,
132
-            CURLOPT_SSL_VERIFYPEER => FALSE,
133
-            CURLOPT_HTTPHEADER     => $headers
134
-        );
126
+		$curlOpts = arraY(
127
+			CURLOPT_URL            => $baseUrl. $url,
128
+			CURLOPT_RETURNTRANSFER => true,
129
+			CURLOPT_TIMEOUT        => 60,
130
+			CURLOPT_FOLLOWLOCATION => true,
131
+			CURLOPT_SSL_VERIFYHOST => FALSE,
132
+			CURLOPT_SSL_VERIFYPEER => FALSE,
133
+			CURLOPT_HTTPHEADER     => $headers
134
+		);
135 135
 		
136 136
 		//echo "url=".$baseUrl.$url."<br>";die("");
137
-        curl_setopt_array($ch, $curlOpts);
137
+		curl_setopt_array($ch, $curlOpts);
138 138
 		
139 139
 		if ($file !=null) {
140 140
 			curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
@@ -143,21 +143,21 @@  discard block
 block discarded – undo
143 143
 			curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file));
144 144
 		}
145 145
 		
146
-        switch($method) {
147
-        case 'DELETE':
148
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
146
+		switch($method) {
147
+		case 'DELETE':
148
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
149 149
 
150 150
 			if (isset($body)) {
151 151
 				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
152 152
 			}
153
-            break;
153
+			break;
154 154
 		case 'DELETEARRAY':
155 155
 			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
156
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
157
-            break;
158
-        case 'PUT':
156
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
157
+			break;
158
+		case 'PUT':
159 159
 			//$jfile=json_encode($body); echo $jfile; die("");
160
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
160
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
161 161
 			if (isset($query)) {
162 162
 				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
163 163
 			}
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
 				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
167 167
 			}
168 168
 			break;
169
-        case 'POST':
169
+		case 'POST':
170 170
 			if (isset($query)) {
171
-            	curl_setopt($ch,  CURLOPT_POSTFIELDS, json_encode($query)); 
171
+				curl_setopt($ch,  CURLOPT_POSTFIELDS, json_encode($query)); 
172 172
 			}
173 173
             
174 174
 			//echo "<br><br>". json_encode($body); 
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
 			} 
178 178
 			break;
179 179
 		case 'ADD':
180
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
181
-        }
180
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
181
+		}
182 182
 
183
-        $result = curl_exec($ch);
183
+		$result = curl_exec($ch);
184 184
 		//var_dump($result); die("");
185 185
 		$isxml=FALSE;
186 186
 		$jxml="";
@@ -191,62 +191,62 @@  discard block
 block discarded – undo
191 191
 			$isxml = TRUE;
192 192
 		}
193 193
 		
194
-        $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
195
-        curl_close($ch);
194
+		$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
195
+		curl_close($ch);
196 196
 		//echo "code -> $code <br>";
197 197
 		
198
-        if (200 == $code) {
199
-            if ($isxml) {
200
-                $json = $jxml;
201
-            } else $json = json_decode($result, true);
202
-            //var_dump($json); die("");
203
-            if (isset($json['errors'])) {
204
-                throw new ApiError(implode(', ', $json['errors']));
205
-            } else {
206
-                return $json;
207
-            }
208
-        }  elseif (409 == $code) {
209
-            throw new ApiError('Wrong API key');
210
-        } else {
211
-            throw new ApiError('Something wrong');
212
-        }
213
-    }
198
+		if (200 == $code) {
199
+			if ($isxml) {
200
+				$json = $jxml;
201
+			} else $json = json_decode($result, true);
202
+			//var_dump($json); die("");
203
+			if (isset($json['errors'])) {
204
+				throw new ApiError(implode(', ', $json['errors']));
205
+			} else {
206
+				return $json;
207
+			}
208
+		}  elseif (409 == $code) {
209
+			throw new ApiError('Wrong API key');
210
+		} else {
211
+			throw new ApiError('Something wrong');
212
+		}
213
+	}
214 214
 
215 215
 	public static function makeUrlRequst($url, $options) {
216 216
 		$method = isset($options['method']) ? $options['method'] : 'GET';
217
-        $query = isset($options['query']) ?
218
-            array_filter($options['query'], function($x) { return !is_null($x); } ) : array();
219
-        $body = isset($options['body']) ? $options['body'] : null;
220
-        $ch = curl_init();
217
+		$query = isset($options['query']) ?
218
+			array_filter($options['query'], function($x) { return !is_null($x); } ) : array();
219
+		$body = isset($options['body']) ? $options['body'] : null;
220
+		$ch = curl_init();
221 221
 		
222 222
 		$curlOpts = arraY(
223
-            CURLOPT_URL            => $url,
224
-            CURLOPT_RETURNTRANSFER => true,
225
-            CURLOPT_TIMEOUT        => 60,
226
-            CURLOPT_FOLLOWLOCATION => true,
227
-            CURLOPT_SSL_VERIFYHOST => FALSE,
228
-            CURLOPT_SSL_VERIFYPEER => FALSE,
229
-            CURLOPT_HTTPHEADER     => array(
230
-                'User-Agent' => 'Route4Me php-sdk'
231
-            )
232
-        );
223
+			CURLOPT_URL            => $url,
224
+			CURLOPT_RETURNTRANSFER => true,
225
+			CURLOPT_TIMEOUT        => 60,
226
+			CURLOPT_FOLLOWLOCATION => true,
227
+			CURLOPT_SSL_VERIFYHOST => FALSE,
228
+			CURLOPT_SSL_VERIFYPEER => FALSE,
229
+			CURLOPT_HTTPHEADER     => array(
230
+				'User-Agent' => 'Route4Me php-sdk'
231
+			)
232
+		);
233 233
 		
234 234
 		curl_setopt_array($ch, $curlOpts);
235 235
 		
236
-        switch($method) {
237
-        case 'DELETE':
238
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
236
+		switch($method) {
237
+		case 'DELETE':
238
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
239 239
 
240 240
 			if (isset($body)) {
241 241
 				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
242 242
 			}
243
-            break;
243
+			break;
244 244
 		case 'DELETEARRAY':
245 245
 			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
246
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
247
-            break;
248
-        case 'PUT':
249
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
246
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
247
+			break;
248
+		case 'PUT':
249
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
250 250
 			if (isset($query)) {
251 251
 				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
252 252
 			}
@@ -255,10 +255,10 @@  discard block
 block discarded – undo
255 255
 				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
256 256
 			}
257 257
 			break;
258
-        case 'POST':
258
+		case 'POST':
259 259
 			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); 
260 260
 			if (isset($query)) {
261
-            	curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); 
261
+				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); 
262 262
 			}
263 263
 
264 264
 			if (isset($body)) {
@@ -266,8 +266,8 @@  discard block
 block discarded – undo
266 266
 			} 
267 267
 			break;
268 268
 		case 'ADD':
269
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
270
-        }
269
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
270
+		}
271 271
 
272 272
 		$result = curl_exec($ch);
273 273
         
@@ -280,21 +280,21 @@  discard block
 block discarded – undo
280 280
 			$isxml = TRUE;
281 281
 		}
282 282
 		
283
-        $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
284
-        curl_close($ch);
283
+		$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
284
+		curl_close($ch);
285 285
 		
286 286
 		if ($isxml) {
287 287
 			$json = $jxml;
288 288
 		} else $json = json_decode($result, true);
289 289
 		
290 290
 		
291
-        if (200 == $code) {
292
-            return $json;
293
-        } elseif (isset($json['errors'])) {
294
-            throw new ApiError(implode(', ', $json['errors']));
295
-        } else {
296
-            throw new ApiError('Something wrong');
297
-        }
291
+		if (200 == $code) {
292
+			return $json;
293
+		} elseif (isset($json['errors'])) {
294
+			throw new ApiError(implode(', ', $json['errors']));
295
+		} else {
296
+			throw new ApiError('Something wrong');
297
+		}
298 298
 	}
299 299
 	
300 300
 	/**
Please login to merge, or discard this patch.
src/Route4Me/OptimizationProblem.php 1 patch
Indentation   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -12,157 +12,157 @@  discard block
 block discarded – undo
12 12
 
13 13
 class OptimizationProblem extends Common
14 14
 {
15
-    static public $apiUrl = '/api.v4/optimization_problem.php';
15
+	static public $apiUrl = '/api.v4/optimization_problem.php';
16 16
 	static public $apiUrl_addr = '/api.v4/address.php';
17
-    static public $apiHybridUrl = '/api.v4/hybrid_date_optimization.php';
18
-    static public $apiHybridDepotUrl = '/api/change_hybrid_optimization_depot.php';
17
+	static public $apiHybridUrl = '/api.v4/hybrid_date_optimization.php';
18
+	static public $apiHybridDepotUrl = '/api/change_hybrid_optimization_depot.php';
19 19
 
20
-    public $optimization_problem_id;
21
-    public $user_errors = array();
22
-    public $state;
23
-    public $parameters;
24
-    public $sent_to_background;
25
-    public $addresses = array();
26
-    public $routes = array();
27
-    public $links = array();
20
+	public $optimization_problem_id;
21
+	public $user_errors = array();
22
+	public $state;
23
+	public $parameters;
24
+	public $sent_to_background;
25
+	public $addresses = array();
26
+	public $routes = array();
27
+	public $links = array();
28 28
 
29
-    function __construct()
30
-    {
31
-        $this->parameters = new RouteParameters;
32
-    }
29
+	function __construct()
30
+	{
31
+		$this->parameters = new RouteParameters;
32
+	}
33 33
 
34
-    public static function fromArray(array $params)
35
-    {
36
-        $problem = new OptimizationProblem;
37
-        $problem->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
38
-        $problem->user_errors = Common::getValue($params, 'user_errors', array());
39
-        $problem->state = Common::getValue($params, 'state', array());
40
-        $problem->sent_to_background = Common::getValue($params, 'sent_to_background', array());
41
-        $problem->links = Common::getValue($params, 'links', array());
34
+	public static function fromArray(array $params)
35
+	{
36
+		$problem = new OptimizationProblem;
37
+		$problem->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
38
+		$problem->user_errors = Common::getValue($params, 'user_errors', array());
39
+		$problem->state = Common::getValue($params, 'state', array());
40
+		$problem->sent_to_background = Common::getValue($params, 'sent_to_background', array());
41
+		$problem->links = Common::getValue($params, 'links', array());
42 42
 
43
-        if (isset($params['parameters'])) {
44
-            $problem->parameters = RouteParameters::fromArray($params['parameters']);
45
-        }
43
+		if (isset($params['parameters'])) {
44
+			$problem->parameters = RouteParameters::fromArray($params['parameters']);
45
+		}
46 46
 
47
-        if (isset($params['addresses'])) {
48
-            $addresses = array();
49
-            foreach ($params['addresses'] as $address) {
50
-                $addresses[] = Address::fromArray($address);
51
-            }
52
-            $problem->addresses = $addresses;
53
-        }
47
+		if (isset($params['addresses'])) {
48
+			$addresses = array();
49
+			foreach ($params['addresses'] as $address) {
50
+				$addresses[] = Address::fromArray($address);
51
+			}
52
+			$problem->addresses = $addresses;
53
+		}
54 54
 
55
-        if (isset($params['routes'])) {
56
-            $routes = array();
57
-            foreach ($params['routes'] as $route) {
58
-                $routes[] = Route::fromArray($route);
59
-            }
60
-            $problem->routes = $routes;
61
-        }
55
+		if (isset($params['routes'])) {
56
+			$routes = array();
57
+			foreach ($params['routes'] as $route) {
58
+				$routes[] = Route::fromArray($route);
59
+			}
60
+			$problem->routes = $routes;
61
+		}
62 62
 
63
-        return $problem;
64
-    }
63
+		return $problem;
64
+	}
65 65
 
66
-    public static function optimize(OptimizationProblemParams $params)
67
-    {
68
-        $optimize = Route4Me::makeRequst(array(
69
-            'url'    => self::$apiUrl,
70
-            'method' => 'POST',
71
-            'query'  => array(
72
-                'redirect'               => isset($params->redirect) ? $params->redirect : null,
73
-                'directions'             => isset($params->directions) ? $params->directions: null, 
74
-                'format'                 => isset($params->format) ? $params->format: null,
75
-                'route_path_output'      => isset($params->route_path_output) ? $params->route_path_output: null,
76
-                'optimized_callback_url' => isset($params->optimized_callback_url) ? $params->optimized_callback_url: null
77
-            ),
78
-            'body'   => array(
79
-                'addresses'  => $params->getAddressesArray(),
80
-                'parameters' => $params->getParametersArray()
81
-            )
82
-        ));
66
+	public static function optimize(OptimizationProblemParams $params)
67
+	{
68
+		$optimize = Route4Me::makeRequst(array(
69
+			'url'    => self::$apiUrl,
70
+			'method' => 'POST',
71
+			'query'  => array(
72
+				'redirect'               => isset($params->redirect) ? $params->redirect : null,
73
+				'directions'             => isset($params->directions) ? $params->directions: null, 
74
+				'format'                 => isset($params->format) ? $params->format: null,
75
+				'route_path_output'      => isset($params->route_path_output) ? $params->route_path_output: null,
76
+				'optimized_callback_url' => isset($params->optimized_callback_url) ? $params->optimized_callback_url: null
77
+			),
78
+			'body'   => array(
79
+				'addresses'  => $params->getAddressesArray(),
80
+				'parameters' => $params->getParametersArray()
81
+			)
82
+		));
83 83
 
84
-        return OptimizationProblem::fromArray($optimize);
85
-    }
84
+		return OptimizationProblem::fromArray($optimize);
85
+	}
86 86
 
87
-    public static function get($params)
88
-    {
89
-        $optimize = Route4Me::makeRequst(array(
90
-            'url'    => self::$apiUrl,
91
-            'method' => 'GET',
92
-            'query'  => array(
93
-                'state' => isset($params['state']) ? $params['state'] : null,
94
-                'limit' => isset($params['limit']) ? $params['limit'] : null,
95
-                'offset' => isset($params['offset']) ? $params['offset'] : null,
96
-                'optimization_problem_id' => isset($params['optimization_problem_id']) 
97
-                    ? $params['optimization_problem_id'] : null,
98
-                'wait_for_final_state' => isset($params['wait_for_final_state']) 
99
-                    ? $params['wait_for_final_state'] : null,
100
-            )
101
-        ));
87
+	public static function get($params)
88
+	{
89
+		$optimize = Route4Me::makeRequst(array(
90
+			'url'    => self::$apiUrl,
91
+			'method' => 'GET',
92
+			'query'  => array(
93
+				'state' => isset($params['state']) ? $params['state'] : null,
94
+				'limit' => isset($params['limit']) ? $params['limit'] : null,
95
+				'offset' => isset($params['offset']) ? $params['offset'] : null,
96
+				'optimization_problem_id' => isset($params['optimization_problem_id']) 
97
+					? $params['optimization_problem_id'] : null,
98
+				'wait_for_final_state' => isset($params['wait_for_final_state']) 
99
+					? $params['wait_for_final_state'] : null,
100
+			)
101
+		));
102 102
 
103
-        if (isset($optimize['optimizations'])) {
104
-            $problems = array();
105
-            foreach($optimize['optimizations'] as $problem) {
106
-                $problems[] = OptimizationProblem::fromArray($problem);
107
-            }
108
-            return $problems;
109
-        } else {
110
-            return OptimizationProblem::fromArray($optimize);
111
-        }
112
-    }
103
+		if (isset($optimize['optimizations'])) {
104
+			$problems = array();
105
+			foreach($optimize['optimizations'] as $problem) {
106
+				$problems[] = OptimizationProblem::fromArray($problem);
107
+			}
108
+			return $problems;
109
+		} else {
110
+			return OptimizationProblem::fromArray($optimize);
111
+		}
112
+	}
113 113
 
114
-    public static function reoptimize($params)
115
-    {
116
-        $param = new OptimizationProblemParams;
117
-        $param->optimization_problem_id = isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null;
118
-        $param->reoptimize = 1;
114
+	public static function reoptimize($params)
115
+	{
116
+		$param = new OptimizationProblemParams;
117
+		$param->optimization_problem_id = isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null;
118
+		$param->reoptimize = 1;
119 119
 
120
-        return self::update((array)$param);
121
-    }
120
+		return self::update((array)$param);
121
+	}
122 122
 
123
-    public static function update($params)
124
-    {
123
+	public static function update($params)
124
+	{
125 125
 		$optimize = Route4Me::makeRequst(array(
126
-            'url'    => self::$apiUrl,
127
-            'method' => 'PUT',
128
-            'query'  => array(
129
-                'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
130
-                'addresses' => isset($params['addresses']) ? $params['addresses'] : null,
131
-                'reoptimize' => isset($params['reoptimize']) ? $params['reoptimize'] : null,
132
-            )
133
-        ));
126
+			'url'    => self::$apiUrl,
127
+			'method' => 'PUT',
128
+			'query'  => array(
129
+				'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
130
+				'addresses' => isset($params['addresses']) ? $params['addresses'] : null,
131
+				'reoptimize' => isset($params['reoptimize']) ? $params['reoptimize'] : null,
132
+			)
133
+		));
134 134
 		
135 135
 		return $optimize;
136
-    }
136
+	}
137 137
 
138
-    public function getOptimizationId()
139
-    {
140
-        return $this->optimization_problem_id;
141
-    }
138
+	public function getOptimizationId()
139
+	{
140
+		return $this->optimization_problem_id;
141
+	}
142 142
 
143
-    public function getRoutes()
144
-    {
145
-        return $this->routes;
146
-    }
143
+	public function getRoutes()
144
+	{
145
+		return $this->routes;
146
+	}
147 147
 	
148 148
 	public function getRandomOptimizationId($offset,$limit)
149 149
 	{
150 150
 		$query['limit'] = isset($params['limit']) ? $params['limit'] : 30;
151
-        $query['offset'] = isset($params['offset']) ? $params['offset'] : 0;
151
+		$query['offset'] = isset($params['offset']) ? $params['offset'] : 0;
152 152
 			
153 153
 		$json = Route4Me::makeRequst(array(
154
-            'url'    => self::$apiUrl,
155
-            'method' => 'GET',
156
-            'query'  => $query
157
-        ));
154
+			'url'    => self::$apiUrl,
155
+			'method' => 'GET',
156
+			'query'  => $query
157
+		));
158 158
 		
159 159
 		$optimizations = array();
160
-            foreach($json as $optimization) {
160
+			foreach($json as $optimization) {
161 161
 				if (gettype($optimization)!="array") continue;
162 162
 				foreach ($optimization as $otp1) {
163 163
 					$optimizations[] = $otp1;
164 164
 				}
165
-            }
165
+			}
166 166
 			
167 167
 			$num=rand(0,sizeof($optimizations)-1);
168 168
 			//echo "num=$num.<br>".sizeof($optimizations)."<br>";
@@ -202,13 +202,13 @@  discard block
 block discarded – undo
202 202
 	public function removeAddress($params)
203 203
 	{
204 204
 		$response = Route4Me::makeRequst(array(
205
-            'url'    => self::$apiUrl_addr,
206
-            'method' => 'DELETE',
207
-            'query'  => array(
208
-                'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
209
-                'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
210
-            )
211
-        ));
205
+			'url'    => self::$apiUrl_addr,
206
+			'method' => 'DELETE',
207
+			'query'  => array(
208
+				'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
209
+				'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
210
+			)
211
+		));
212 212
 		
213 213
 		return $response;
214 214
 	}
@@ -216,48 +216,48 @@  discard block
 block discarded – undo
216 216
 	public function removeOptimization($params)
217 217
 	{
218 218
 		$response = Route4Me::makeRequst(array(
219
-            'url'    => self::$apiUrl,
220
-            'method' => 'DELETE',
221
-            'query'  => array(
222
-                'redirect' => isset($params['redirect']) ? $params['redirect'] : null,
223
-            ),
224
-            'body'  => array(
219
+			'url'    => self::$apiUrl,
220
+			'method' => 'DELETE',
221
+			'query'  => array(
222
+				'redirect' => isset($params['redirect']) ? $params['redirect'] : null,
223
+			),
224
+			'body'  => array(
225 225
 				'optimization_problem_ids' => isset($params['optimization_problem_ids']) ? $params['optimization_problem_ids'] : null,
226 226
 			)
227
-        ));
227
+		));
228 228
 		
229 229
 		return $response;
230 230
 	}
231 231
     
232
-    public function getHybridOptimization($params)
233
-    {
234
-        $optimize = Route4Me::makeRequst(array(
235
-            'url'    => self::$apiHybridUrl,
236
-            'method' => 'GET',
237
-            'query'  => array(
238
-                'target_date_string' => isset($params['target_date_string']) ? $params['target_date_string'] : null,
239
-                'timezone_offset_minutes' => isset($params['timezone_offset_minutes']) ? $params['timezone_offset_minutes'] : null
240
-            )
241
-        ));
232
+	public function getHybridOptimization($params)
233
+	{
234
+		$optimize = Route4Me::makeRequst(array(
235
+			'url'    => self::$apiHybridUrl,
236
+			'method' => 'GET',
237
+			'query'  => array(
238
+				'target_date_string' => isset($params['target_date_string']) ? $params['target_date_string'] : null,
239
+				'timezone_offset_minutes' => isset($params['timezone_offset_minutes']) ? $params['timezone_offset_minutes'] : null
240
+			)
241
+		));
242 242
 
243
-        return $optimize;
244
-    }
243
+		return $optimize;
244
+	}
245 245
     
246
-    Public function addDepotsToHybrid($params)
247
-    {
248
-        $depots = Route4Me::makeRequst(array( 
249
-            'url'    => self::$apiHybridDepotUrl,
250
-            'method' => 'POST',
251
-            'query'  => array(
252
-                'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
253
-                ),
254
-            'body'  => array(
255
-                'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
256
-                'delete_old_depots' => isset($params['delete_old_depots']) ? $params['delete_old_depots'] : null,
257
-                'new_depots' => isset($params['new_depots']) ? $params['new_depots'] : null,
258
-            )
259
-        ));
246
+	Public function addDepotsToHybrid($params)
247
+	{
248
+		$depots = Route4Me::makeRequst(array( 
249
+			'url'    => self::$apiHybridDepotUrl,
250
+			'method' => 'POST',
251
+			'query'  => array(
252
+				'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
253
+				),
254
+			'body'  => array(
255
+				'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
256
+				'delete_old_depots' => isset($params['delete_old_depots']) ? $params['delete_old_depots'] : null,
257
+				'new_depots' => isset($params['new_depots']) ? $params['new_depots'] : null,
258
+			)
259
+		));
260 260
         
261
-        return $depots;
262
-    }
261
+		return $depots;
262
+	}
263 263
 }
Please login to merge, or discard this patch.
src/Route4Me/Route.php 1 patch
Indentation   +274 added lines, -274 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 class Route extends Common
13 13
 {
14
-    static public $apiUrl = '/api.v4/route.php';
14
+	static public $apiUrl = '/api.v4/route.php';
15 15
 	static public $apiUrlAddress = '/api.v4/address.php';
16 16
 	static public $apiUrlDuplicate='/actions/duplicate_route.php';
17 17
 	static public $apiUrlDelete='/actions/delete_routes.php';
@@ -22,21 +22,21 @@  discard block
 block discarded – undo
22 22
 	static public $apiUrlAsset='/api.v4/status.php';
23 23
 	static public $apiUrlDeviceLocation='/api/track/get_device_location.php';
24 24
 	//static public $apiUrlMove='/actions/route/move_route_destination.php';
25
-    public $route_id;
25
+	public $route_id;
26 26
 	public $route_destination_id;
27
-    public $optimization_problem_id;
28
-    public $vehicle_alias;
29
-    public $driver_alias;
30
-    public $trip_distance;
31
-    public $mpg;
32
-    public $gas_price;
33
-    public $route_duration_sec;
34
-    public $parameters;
35
-    public $addresses = array();
36
-    public $links = array();
37
-    public $directions = array();
38
-    public $path = array();
39
-    public $tracking_history = array();
27
+	public $optimization_problem_id;
28
+	public $vehicle_alias;
29
+	public $driver_alias;
30
+	public $trip_distance;
31
+	public $mpg;
32
+	public $gas_price;
33
+	public $route_duration_sec;
34
+	public $parameters;
35
+	public $addresses = array();
36
+	public $links = array();
37
+	public $directions = array();
38
+	public $path = array();
39
+	public $tracking_history = array();
40 40
 	public $recipient_email;
41 41
 	public $httpheaders;
42 42
 	public $is_unrouted;
@@ -44,101 +44,101 @@  discard block
 block discarded – undo
44 44
 	public $dev_lat;
45 45
 	public $dev_lng;
46 46
 
47
-    public static function fromArray(array $params) 
48
-    {
49
-        $route = new Route();
50
-        $route->route_id = Common::getValue($params, 'route_id');
51
-        $route->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
52
-        $route->vehicle_alias = Common::getValue($params, 'vehicle_alias');
53
-        $route->driver_alias = Common::getValue($params, 'driver_alias');
54
-        $route->trip_distance = Common::getValue($params, 'trip_distance');
55
-        $route->mpg = Common::getValue($params, 'mpg');
56
-        $route->gas_price = Common::getValue($params, 'gas_price');
57
-        $route->route_duration_sec = Common::getvalue($params, 'route_duration_sec');
58
-        $route->is_unrouted = Common::getvalue($params, 'is_unrouted');
59
-
60
-        // Make RouteParameters
61
-        if (isset($params['parameters'])) {
62
-            $route->parameters = RouteParameters::fromArray($params['parameters']);
63
-        }
64
-
65
-        if (isset($params['addresses'])) {
66
-            $addresses = array();
67
-            foreach ($params['addresses'] as $address) {
68
-                $addresses[] = Address::fromArray($address);
69
-            }
70
-
71
-            $route->addresses = $addresses;
72
-        }
73
-
74
-        $route->links = Common::getValue($params, 'links', array());
75
-        $route->directions = Common::getValue($params, 'directions', array());
76
-        $route->path = Common::getValue($params, 'path', array());
77
-        $route->tracking_history = Common::getValue($params, 'tracking_history', array());
78
-
79
-        return $route;
80
-    }
81
-
82
-    public static function getRoutes($routeId=null, $params=null)
83
-    {
84
-        $query = array(
85
-            'api_key' => Route4Me::getApiKey()
86
-        );
87
-
88
-        if ($routeId) {
89
-            $query['route_id'] = implode(',', (array) $routeId);
90
-        }
91
-
92
-        if ($params) {
93
-            if (isset($params['directions'])) {
94
-                $query['directions'] = $params['directions'];
95
-            }
96
-
97
-            if (isset($params['route_path_output'])) {
98
-                $query['route_path_output'] = $params['route_path_output'];
99
-            }
100
-
101
-            if (isset($params['device_tracking_history'])) {
102
-                $query['device_tracking_history'] = $params['device_tracking_history'];
103
-            }
47
+	public static function fromArray(array $params) 
48
+	{
49
+		$route = new Route();
50
+		$route->route_id = Common::getValue($params, 'route_id');
51
+		$route->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
52
+		$route->vehicle_alias = Common::getValue($params, 'vehicle_alias');
53
+		$route->driver_alias = Common::getValue($params, 'driver_alias');
54
+		$route->trip_distance = Common::getValue($params, 'trip_distance');
55
+		$route->mpg = Common::getValue($params, 'mpg');
56
+		$route->gas_price = Common::getValue($params, 'gas_price');
57
+		$route->route_duration_sec = Common::getvalue($params, 'route_duration_sec');
58
+		$route->is_unrouted = Common::getvalue($params, 'is_unrouted');
59
+
60
+		// Make RouteParameters
61
+		if (isset($params['parameters'])) {
62
+			$route->parameters = RouteParameters::fromArray($params['parameters']);
63
+		}
64
+
65
+		if (isset($params['addresses'])) {
66
+			$addresses = array();
67
+			foreach ($params['addresses'] as $address) {
68
+				$addresses[] = Address::fromArray($address);
69
+			}
70
+
71
+			$route->addresses = $addresses;
72
+		}
73
+
74
+		$route->links = Common::getValue($params, 'links', array());
75
+		$route->directions = Common::getValue($params, 'directions', array());
76
+		$route->path = Common::getValue($params, 'path', array());
77
+		$route->tracking_history = Common::getValue($params, 'tracking_history', array());
78
+
79
+		return $route;
80
+	}
81
+
82
+	public static function getRoutes($routeId=null, $params=null)
83
+	{
84
+		$query = array(
85
+			'api_key' => Route4Me::getApiKey()
86
+		);
87
+
88
+		if ($routeId) {
89
+			$query['route_id'] = implode(',', (array) $routeId);
90
+		}
91
+
92
+		if ($params) {
93
+			if (isset($params['directions'])) {
94
+				$query['directions'] = $params['directions'];
95
+			}
96
+
97
+			if (isset($params['route_path_output'])) {
98
+				$query['route_path_output'] = $params['route_path_output'];
99
+			}
100
+
101
+			if (isset($params['device_tracking_history'])) {
102
+				$query['device_tracking_history'] = $params['device_tracking_history'];
103
+			}
104 104
 			
105 105
 			if (isset($params['query'])) {
106
-                $query['query'] = $params['query'];
107
-            }
106
+				$query['query'] = $params['query'];
107
+			}
108 108
 
109
-            $query['limit'] = isset($params['limit']) ? $params['limit'] : 30;
110
-            $query['offset'] = isset($params['offset']) ? $params['offset'] : 0;
111
-        }
112
-
113
-        $json = Route4Me::makeRequst(array(
114
-            'url'    => self::$apiUrl,
115
-            'method' => 'GET',
116
-            'query'  => $query
117
-        ));
109
+			$query['limit'] = isset($params['limit']) ? $params['limit'] : 30;
110
+			$query['offset'] = isset($params['offset']) ? $params['offset'] : 0;
111
+		}
118 112
 
119
-        if ($routeId) {
120
-            return Route::fromArray($json); die("");
121
-        } else {
122
-            $routes = array();
123
-            foreach($json as $route) {
124
-                $routes[] = Route::fromArray($route);
125
-            }
126
-            return $routes;
127
-        }
128
-    }
113
+		$json = Route4Me::makeRequst(array(
114
+			'url'    => self::$apiUrl,
115
+			'method' => 'GET',
116
+			'query'  => $query
117
+		));
118
+
119
+		if ($routeId) {
120
+			return Route::fromArray($json); die("");
121
+		} else {
122
+			$routes = array();
123
+			foreach($json as $route) {
124
+				$routes[] = Route::fromArray($route);
125
+			}
126
+			return $routes;
127
+		}
128
+	}
129 129
 
130 130
 	public function getRoutePoints($routeId, $params)
131 131
 	{
132 132
 		$result = Route4Me::makeRequst(array(
133
-            'url'    => self::$apiUrl,
134
-            'method' => 'GET',
135
-            'query'  => array(
136
-            	'api_key' => Route4Me::getApiKey(),
137
-                'route_id' => $routeId,
138
-                'route_path_output' => isset($params['route_path_output']) ? $params['route_path_output'] : null,
139
-                'directions' => isset($params['directions']) ? $params['directions'] : null,
140
-            )
141
-        ));
133
+			'url'    => self::$apiUrl,
134
+			'method' => 'GET',
135
+			'query'  => array(
136
+				'api_key' => Route4Me::getApiKey(),
137
+				'route_id' => $routeId,
138
+				'route_path_output' => isset($params['route_path_output']) ? $params['route_path_output'] : null,
139
+				'directions' => isset($params['directions']) ? $params['directions'] : null,
140
+			)
141
+		));
142 142
 
143 143
 		return $result;
144 144
 	}
@@ -146,14 +146,14 @@  discard block
 block discarded – undo
146 146
 	public function duplicateRoute($route_id)
147 147
 	{
148 148
 		$result = Route4Me::makeRequst(array(
149
-            'url'    => self::$apiUrlDuplicate,
150
-            'method' => 'GET',
151
-            'query'  => array(
152
-            	'api_key' => Route4Me::getApiKey(),
153
-                'route_id' => $route_id,
154
-                'to' => 'none',
155
-            )
156
-        ));
149
+			'url'    => self::$apiUrlDuplicate,
150
+			'method' => 'GET',
151
+			'query'  => array(
152
+				'api_key' => Route4Me::getApiKey(),
153
+				'route_id' => $route_id,
154
+				'to' => 'none',
155
+			)
156
+		));
157 157
 		
158 158
 		return $result;
159 159
 	}
@@ -161,17 +161,17 @@  discard block
 block discarded – undo
161 161
 	public function resequenceRoute($params)
162 162
 	{
163 163
 		$result = Route4Me::makeRequst(array(
164
-            'url'    => self::$apiUrl,
165
-            'method' => 'PUT',
166
-            'query'  => array(
167
-            	'api_key' => Route4Me::getApiKey(),
168
-                'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
169
-                'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
170
-            ),
171
-            'body'  => array(
164
+			'url'    => self::$apiUrl,
165
+			'method' => 'PUT',
166
+			'query'  => array(
167
+				'api_key' => Route4Me::getApiKey(),
168
+				'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
169
+				'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
170
+			),
171
+			'body'  => array(
172 172
 				'addresses' => isset($params['addresses']) ? $params['addresses'] : null,
173 173
 			)
174
-        ));
174
+		));
175 175
 		
176 176
 		return $result;
177 177
 	}
@@ -179,15 +179,15 @@  discard block
 block discarded – undo
179 179
 	public function resequenceAllAddresses($params)
180 180
 	{
181 181
 		$result = Route4Me::makeRequst(array(
182
-            'url'    => self::$apiUrlReseq,
183
-            'method' => 'GET',
184
-            'query'  => array(
185
-            	'api_key' => Route4Me::getApiKey(),
186
-                'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
187
-                'disable_optimization' => isset($params['disable_optimization']) ? $params['disable_optimization'] : null,
188
-                'optimize' => isset($params['optimize']) ? $params['optimize'] : null,
189
-            )
190
-        ));
182
+			'url'    => self::$apiUrlReseq,
183
+			'method' => 'GET',
184
+			'query'  => array(
185
+				'api_key' => Route4Me::getApiKey(),
186
+				'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
187
+				'disable_optimization' => isset($params['disable_optimization']) ? $params['disable_optimization'] : null,
188
+				'optimize' => isset($params['optimize']) ? $params['optimize'] : null,
189
+			)
190
+		));
191 191
 		
192 192
 		return $result;
193 193
 		
@@ -196,16 +196,16 @@  discard block
 block discarded – undo
196 196
 	public function mergeRoutes($params)
197 197
 	{
198 198
 		$result = Route4Me::makeRequst(array(
199
-            'url'    => self::$apiUrlMerge,
200
-            'method' => 'POST',
201
-            'query'  => array(
202
-            	'api_key' => Route4Me::getApiKey(),
203
-            ),
204
-            'body'  => array(
199
+			'url'    => self::$apiUrlMerge,
200
+			'method' => 'POST',
201
+			'query'  => array(
202
+				'api_key' => Route4Me::getApiKey(),
203
+			),
204
+			'body'  => array(
205 205
 				'route_ids' => isset($params['route_ids']) ? $params['route_ids'] : null,
206 206
 			),
207 207
 			'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
208
-        ));
208
+		));
209 209
 		
210 210
 		return $result;
211 211
 	}
@@ -213,17 +213,17 @@  discard block
 block discarded – undo
213 213
 	public function shareRoute($params)
214 214
 	{
215 215
 		$result = Route4Me::makeRequst(array(
216
-            'url'    => self::$apiUrlShare,
217
-            'method' => 'POST',
218
-            'query'  => array(
219
-            	'api_key' => Route4Me::getApiKey(),
220
-            	'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
221
-            ),
222
-            'body'  => array(
216
+			'url'    => self::$apiUrlShare,
217
+			'method' => 'POST',
218
+			'query'  => array(
219
+				'api_key' => Route4Me::getApiKey(),
220
+				'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
221
+			),
222
+			'body'  => array(
223 223
 				'recipient_email' => isset($params['recipient_email']) ? $params['recipient_email'] : null,
224 224
 			),
225 225
 			'Content-Type' => 'multipart/form-data'
226
-        ));
226
+		));
227 227
 		
228 228
 		return $result;
229 229
 	}
@@ -232,98 +232,98 @@  discard block
 block discarded – undo
232 232
 	public function getRandomRouteId($offset,$limit)
233 233
 	{
234 234
 		$query['limit'] = isset($params['limit']) ? $params['limit'] : 30;
235
-        $query['offset'] = isset($params['offset']) ? $params['offset'] : 0;
235
+		$query['offset'] = isset($params['offset']) ? $params['offset'] : 0;
236 236
 			
237 237
 		$json = Route4Me::makeRequst(array(
238
-            'url'    => self::$apiUrl,
239
-            'method' => 'GET',
240
-            'query'  => $query
241
-        ));
238
+			'url'    => self::$apiUrl,
239
+			'method' => 'GET',
240
+			'query'  => $query
241
+		));
242 242
         
243
-        if (sizeof($json)>0) {
244
-            $routes = array();
245
-            foreach($json as $route) {
246
-                $routes[] = Route::fromArray($route);
247
-            }
243
+		if (sizeof($json)>0) {
244
+			$routes = array();
245
+			foreach($json as $route) {
246
+				$routes[] = Route::fromArray($route);
247
+			}
248 248
             
249
-            $num=rand(0,sizeof($routes)-1);
250
-            $rRoute=(array)$routes[$num];
249
+			$num=rand(0,sizeof($routes)-1);
250
+			$rRoute=(array)$routes[$num];
251 251
             
252
-            if (is_array($rRoute)) 
253
-            {
254
-                return $rRoute["route_id"];
255
-            }
256
-            else return null;
257
-        } else return null;
252
+			if (is_array($rRoute)) 
253
+			{
254
+				return $rRoute["route_id"];
255
+			}
256
+			else return null;
257
+		} else return null;
258 258
 		
259 259
 		
260 260
 	}
261 261
 
262
-    public function update()
263
-    {
264
-        $route = Route4Me::makeRequst(array(
265
-            'url'    => self::$apiUrl,
266
-            'method' => 'PUT',
267
-            'query'  => array(
268
-                'route_id' => isset($this->route_id) ? $this->route_id : null,
269
-                'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
270
-            ),
271
-            'body' => array (
272
-            	'parameters' => $this->parameters,
273
-            	),
274
-            'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
275
-        ));
262
+	public function update()
263
+	{
264
+		$route = Route4Me::makeRequst(array(
265
+			'url'    => self::$apiUrl,
266
+			'method' => 'PUT',
267
+			'query'  => array(
268
+				'route_id' => isset($this->route_id) ? $this->route_id : null,
269
+				'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
270
+			),
271
+			'body' => array (
272
+				'parameters' => $this->parameters,
273
+				),
274
+			'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
275
+		));
276 276
 
277
-        return Route::fromArray($route);
278
-    }
277
+		return Route::fromArray($route);
278
+	}
279 279
 	
280 280
 	public function updateAddress()
281
-    {
282
-        $result = Route4Me::makeRequst(array(
283
-            'url'    => self::$apiUrlAddress,
284
-            'method' => 'PUT',
285
-            'query'  => array(
286
-                'route_id' => isset($this->route_id) ? $this->route_id : null,
287
-                'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
288
-            ),
289
-            'body' => get_object_vars($this->parameters),
290
-            'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
291
-        ));
281
+	{
282
+		$result = Route4Me::makeRequst(array(
283
+			'url'    => self::$apiUrlAddress,
284
+			'method' => 'PUT',
285
+			'query'  => array(
286
+				'route_id' => isset($this->route_id) ? $this->route_id : null,
287
+				'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
288
+			),
289
+			'body' => get_object_vars($this->parameters),
290
+			'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
291
+		));
292 292
 
293
-        return $result;
294
-    }
293
+		return $result;
294
+	}
295 295
 
296
-    public function addAddresses(array $params)
297
-    {
298
-        $route = Route4Me::makeRequst(array(
299
-            'url'    => self::$apiUrl,
300
-            'method' => 'PUT',
301
-            'query'  => array(
302
-            	'api_key' => Route4Me::getApiKey(),
303
-                'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
304
-                'addresses' => isset($params['addresses']) ? $params['addresses'] : null
305
-            )
306
-        ));
296
+	public function addAddresses(array $params)
297
+	{
298
+		$route = Route4Me::makeRequst(array(
299
+			'url'    => self::$apiUrl,
300
+			'method' => 'PUT',
301
+			'query'  => array(
302
+				'api_key' => Route4Me::getApiKey(),
303
+				'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
304
+				'addresses' => isset($params['addresses']) ? $params['addresses'] : null
305
+			)
306
+		));
307 307
 
308
-        return Route::fromArray($route);
309
-    }
308
+		return Route::fromArray($route);
309
+	}
310 310
 	
311 311
 	public function insertAddressOptimalPosition(array $params)
312 312
 	{
313 313
 		$route = Route4Me::makeRequst(array(
314
-            'url'    => self::$apiUrl,
315
-            'method' => 'PUT',
316
-            'query'  => array(
317
-            	'api_key' => Route4Me::getApiKey(),
318
-                'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
319
-            ),
320
-            'body'  => array(
314
+			'url'    => self::$apiUrl,
315
+			'method' => 'PUT',
316
+			'query'  => array(
317
+				'api_key' => Route4Me::getApiKey(),
318
+				'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
319
+			),
320
+			'body'  => array(
321 321
 				'addresses' => isset($params['addresses']) ? $params['addresses'] : null,
322 322
 				'optimal_position' => isset($params['optimal_position']) ? $params['optimal_position'] : null,
323 323
 			)
324
-        ));
324
+		));
325 325
 
326
-        return Route::fromArray($route);
326
+		return Route::fromArray($route);
327 327
 	}
328 328
 	
329 329
 	public function addNoteFile($params)
@@ -332,18 +332,18 @@  discard block
 block discarded – undo
332 332
 		$rpath = realpath($fname);
333 333
 		//echo $rpath;die("");
334 334
 		$result= Route4Me::makeRequst(array(
335
-            'url'    => self::$apiUrlNoteFile,
336
-            'method' => 'POST',
337
-            'query'  => array(
338
-            	'api_key' => Route4Me::getApiKey(),
339
-                'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
340
-                'address_id' => isset($params['address_id']) ? $params['address_id'] : null,
341
-                'dev_lat' => isset($params['dev_lat']) ? $params['dev_lat'] : null,
342
-                'dev_lng' => isset($params['dev_lng']) ? $params['dev_lng'] : null,
343
-                'device_type' => isset($params['device_type']) ? $params['device_type'] : null,
344
-                'dev_lng' => isset($params['dev_lng']) ? $params['dev_lng'] : null,
345
-            ),
346
-            'body'  => array(
335
+			'url'    => self::$apiUrlNoteFile,
336
+			'method' => 'POST',
337
+			'query'  => array(
338
+				'api_key' => Route4Me::getApiKey(),
339
+				'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
340
+				'address_id' => isset($params['address_id']) ? $params['address_id'] : null,
341
+				'dev_lat' => isset($params['dev_lat']) ? $params['dev_lat'] : null,
342
+				'dev_lng' => isset($params['dev_lng']) ? $params['dev_lng'] : null,
343
+				'device_type' => isset($params['device_type']) ? $params['device_type'] : null,
344
+				'dev_lng' => isset($params['dev_lng']) ? $params['dev_lng'] : null,
345
+			),
346
+			'body'  => array(
347 347
 				'strUpdateType' => isset($params['strUpdateType']) ? $params['strUpdateType'] : null,
348 348
 				'strFilename' => isset($params['strFilename']) ? $params['strFilename'] : null,
349 349
 				'strNoteContents' => isset($params['strNoteContents']) ? $params['strNoteContents'] : null,
@@ -353,18 +353,18 @@  discard block
 block discarded – undo
353 353
 			'HTTPHEADER' => array(
354 354
 				'Content-Type: application/x-www-form-urlencoded'
355 355
 			)
356
-        ));
356
+		));
357 357
 
358
-        return $result;
358
+		return $result;
359 359
 	}
360 360
 
361
-    public function delete($route_id)
362
-    {
363
-        $result = Route4Me::makeRequst(array(
364
-            'url'    => self::$apiUrl,
365
-            'method' => 'DELETE',
366
-            'query'  => array( 'route_id' => $route_id )
367
-        ));
361
+	public function delete($route_id)
362
+	{
363
+		$result = Route4Me::makeRequst(array(
364
+			'url'    => self::$apiUrl,
365
+			'method' => 'DELETE',
366
+			'query'  => array( 'route_id' => $route_id )
367
+		));
368 368
 		
369 369
 		// The code below doesn't work, altough this method is described as workable in REST API 
370 370
 		/*
@@ -377,8 +377,8 @@  discard block
 block discarded – undo
377 377
             )
378 378
         ));
379 379
 		*/
380
-        return $result;
381
-    }
380
+		return $result;
381
+	}
382 382
 	
383 383
 	public function GetAddressesFromRoute($route_id)
384 384
 	{
@@ -402,63 +402,63 @@  discard block
 block discarded – undo
402 402
 		} else { return null;}
403 403
 	}
404 404
 
405
-    public function getRouteId()
406
-    {
407
-        return $this->route_id;
408
-    }
405
+	public function getRouteId()
406
+	{
407
+		return $this->route_id;
408
+	}
409 409
 
410
-    public function getOptimizationId()
411
-    {
412
-        return $this->optimization_problem_id;
413
-    }
410
+	public function getOptimizationId()
411
+	{
412
+		return $this->optimization_problem_id;
413
+	}
414 414
 	
415 415
 	public function GetLastLocation(array $params)
416 416
 	{
417 417
 		$route = Route4Me::makeRequst(array(
418
-            'url'    => self::$apiUrl,
419
-            'method' => 'GET',
420
-            'query'  => array(
421
-            	'api_key' => Route4Me::getApiKey(),
422
-                'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
423
-                'device_tracking_history' => isset($params['device_tracking_history']) ? $params['device_tracking_history'] : null
424
-            )
425
-        ));
418
+			'url'    => self::$apiUrl,
419
+			'method' => 'GET',
420
+			'query'  => array(
421
+				'api_key' => Route4Me::getApiKey(),
422
+				'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
423
+				'device_tracking_history' => isset($params['device_tracking_history']) ? $params['device_tracking_history'] : null
424
+			)
425
+		));
426 426
 
427
-        return Route::fromArray($route);
427
+		return Route::fromArray($route);
428 428
 		
429 429
 	}
430 430
 	
431 431
 	public function GetTrackingHistoryFromTimeRange(array $params)
432 432
 	{
433 433
 		$route = Route4Me::makeRequst(array(
434
-            'url'    => self::$apiUrlDeviceLocation,
435
-            'method' => 'GET',
436
-            'query'  => array(
437
-            	'api_key' => Route4Me::getApiKey(),
438
-                'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
439
-                'format' => isset($params['format']) ? $params['format'] : null,
440
-                'time_period' => isset($params['time_period']) ? $params['time_period'] : null,
441
-                'start_date' => isset($params['start_date']) ? $params['start_date'] : null,
442
-                'end_date' => isset($params['end_date']) ? $params['end_date'] : null
443
-                )
444
-        ));
445
-
446
-        return $route;
434
+			'url'    => self::$apiUrlDeviceLocation,
435
+			'method' => 'GET',
436
+			'query'  => array(
437
+				'api_key' => Route4Me::getApiKey(),
438
+				'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
439
+				'format' => isset($params['format']) ? $params['format'] : null,
440
+				'time_period' => isset($params['time_period']) ? $params['time_period'] : null,
441
+				'start_date' => isset($params['start_date']) ? $params['start_date'] : null,
442
+				'end_date' => isset($params['end_date']) ? $params['end_date'] : null
443
+				)
444
+		));
445
+
446
+		return $route;
447 447
 		
448 448
 	}
449 449
 	
450 450
 	public function GetAssetTracking(array $params)
451 451
 	{
452 452
 		$route = Route4Me::makeRequst(array(
453
-            'url'    => self::$apiUrlAsset,
454
-            'method' => 'GET',
455
-            'query'  => array(
456
-            	'api_key' => Route4Me::getApiKey(),
457
-                'tracking' => isset($params['tracking']) ? $params['tracking'] : null
458
-                )
459
-        ));
460
-
461
-        return $route;
453
+			'url'    => self::$apiUrlAsset,
454
+			'method' => 'GET',
455
+			'query'  => array(
456
+				'api_key' => Route4Me::getApiKey(),
457
+				'tracking' => isset($params['tracking']) ? $params['tracking'] : null
458
+				)
459
+		));
460
+
461
+		return $route;
462 462
 		
463 463
 	}
464 464
 }
Please login to merge, or discard this patch.
src/Route4Me/Address.php 1 patch
Indentation   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -9,56 +9,56 @@  discard block
 block discarded – undo
9 9
 
10 10
 class Address extends Common
11 11
 {
12
-    static public $apiUrl = '/api.v4/address.php';
12
+	static public $apiUrl = '/api.v4/address.php';
13 13
 	static public $apiUrlMove='/actions/route/move_route_destination.php';
14 14
 	static public $apiUrDeparted='/api/route/mark_address_departed.php';
15 15
 	static public $apiUrVisited='/actions/address/update_address_visited.php';
16 16
 
17
-    public $route_destination_id;
18
-    public $alias;
19
-    public $member_id;
20
-    public $address;
21
-    public $addressUpdate;
22
-    public $is_depot = false;
23
-    public $lat;
24
-    public $lng;
25
-    public $route_id;
26
-    public $original_route_id;
27
-    public $optimization_problem_id;
28
-    public $sequence_no;
29
-    public $geocoded;
30
-    public $preferred_geocoding;
31
-    public $failed_geocoding;
32
-    public $geocodings = array();
33
-    public $contact_id;
34
-    public $is_visited;
35
-    public $customer_po;
36
-    public $invoice_no;
37
-    public $reference_no;
38
-    public $order_no;
39
-    public $weight;
40
-    public $cost;
41
-    public $revenue;
42
-    public $cube;
43
-    public $pieces;
44
-    public $email;
45
-    public $phone;
46
-    public $destination_note_count;
47
-    public $drive_time_to_next_destination;
48
-    public $distance_to_next_destination;
49
-    public $generated_time_window_start;
50
-    public $generated_time_window_end;
51
-    public $time_window_start;
52
-    public $time_window_end;
53
-    public $time;
17
+	public $route_destination_id;
18
+	public $alias;
19
+	public $member_id;
20
+	public $address;
21
+	public $addressUpdate;
22
+	public $is_depot = false;
23
+	public $lat;
24
+	public $lng;
25
+	public $route_id;
26
+	public $original_route_id;
27
+	public $optimization_problem_id;
28
+	public $sequence_no;
29
+	public $geocoded;
30
+	public $preferred_geocoding;
31
+	public $failed_geocoding;
32
+	public $geocodings = array();
33
+	public $contact_id;
34
+	public $is_visited;
35
+	public $customer_po;
36
+	public $invoice_no;
37
+	public $reference_no;
38
+	public $order_no;
39
+	public $weight;
40
+	public $cost;
41
+	public $revenue;
42
+	public $cube;
43
+	public $pieces;
44
+	public $email;
45
+	public $phone;
46
+	public $destination_note_count;
47
+	public $drive_time_to_next_destination;
48
+	public $distance_to_next_destination;
49
+	public $generated_time_window_start;
50
+	public $generated_time_window_end;
51
+	public $time_window_start;
52
+	public $time_window_end;
53
+	public $time;
54 54
 	public $notes;
55
-    public $timestamp_last_visited;
56
-    public $custom_fields = array();
57
-    public $manifest = array();
55
+	public $timestamp_last_visited;
56
+	public $custom_fields = array();
57
+	public $manifest = array();
58 58
 
59
-    public static function fromArray(array $params)
60
-    {
61
-        /*if (!isset($params['address'])) {
59
+	public static function fromArray(array $params)
60
+	{
61
+		/*if (!isset($params['address'])) {
62 62
             throw new BadParam('address must be provided');
63 63
         }
64 64
 
@@ -70,142 +70,142 @@  discard block
 block discarded – undo
70 70
             throw new BadParam('lng must be provided');
71 71
         }*/
72 72
 
73
-        $address = new Address();
74
-        foreach($params as $key => $value) {
75
-            if (property_exists($address, $key)) {
76
-                $address->{$key} = $value;
77
-            }
78
-        }
73
+		$address = new Address();
74
+		foreach($params as $key => $value) {
75
+			if (property_exists($address, $key)) {
76
+				$address->{$key} = $value;
77
+			}
78
+		}
79
+
80
+		return $address;
81
+	}
79 82
 
80
-        return $address;
81
-    }
82
-
83
-    public static function getAddress($routeId, $addressId)
84
-    {
85
-        $address = Route4Me::makeRequst(array(
86
-            'url'    => self::$apiUrl,
87
-            'method' => 'GET',
88
-            'query'  => array(
89
-                'route_id'             => $routeId,
90
-                'route_destination_id' => $addressId,
91
-            )
92
-        ));
93
-
94
-        return Address::fromArray($address);
95
-    }
83
+	public static function getAddress($routeId, $addressId)
84
+	{
85
+		$address = Route4Me::makeRequst(array(
86
+			'url'    => self::$apiUrl,
87
+			'method' => 'GET',
88
+			'query'  => array(
89
+				'route_id'             => $routeId,
90
+				'route_destination_id' => $addressId,
91
+			)
92
+		));
93
+
94
+		return Address::fromArray($address);
95
+	}
96 96
 	
97 97
 	/*Get notes from the specified route destination
98 98
      * Returns an address object with notes, if an address exists, otherwise - return null.
99 99
      */
100
-    public static function GetAddressesNotes($noteParams)
101
-    {
102
-        $address = Route4Me::makeRequst(array(
103
-            'url'    => self::$apiUrl,
104
-            'method' => 'GET',
105
-            'query'  => array(
106
-                'route_id'             => isset($noteParams['route_id']) ? $noteParams['route_id']: null, 
107
-                'route_destination_id' => isset($noteParams['route_destination_id']) ? $noteParams['route_destination_id'] : null,
108
-                'notes' => 1,
109
-            )
110
-        ));
111
-
112
-        return $address;
113
-    }
114
-
115
-    public function update()
116
-    {
117
-        $addressUpdate = Route4Me::makeRequst(array(
118
-            'url'    => self::$apiUrl,
119
-            'method' => 'PUT',
120
-            'body'   => $this->toArray(),
121
-            'query'  => array(
122
-                'route_id'             => $this->route_id,
123
-                'route_destination_id' => $this->route_destination_id,
124
-            ),
125
-        ));
126
-
127
-        return Address::fromArray($addressUpdate);
128
-    }
100
+	public static function GetAddressesNotes($noteParams)
101
+	{
102
+		$address = Route4Me::makeRequst(array(
103
+			'url'    => self::$apiUrl,
104
+			'method' => 'GET',
105
+			'query'  => array(
106
+				'route_id'             => isset($noteParams['route_id']) ? $noteParams['route_id']: null, 
107
+				'route_destination_id' => isset($noteParams['route_destination_id']) ? $noteParams['route_destination_id'] : null,
108
+				'notes' => 1,
109
+			)
110
+		));
111
+
112
+		return $address;
113
+	}
114
+
115
+	public function update()
116
+	{
117
+		$addressUpdate = Route4Me::makeRequst(array(
118
+			'url'    => self::$apiUrl,
119
+			'method' => 'PUT',
120
+			'body'   => $this->toArray(),
121
+			'query'  => array(
122
+				'route_id'             => $this->route_id,
123
+				'route_destination_id' => $this->route_destination_id,
124
+			),
125
+		));
126
+
127
+		return Address::fromArray($addressUpdate);
128
+	}
129 129
 	
130 130
 	public function markAddress($params, $body)
131
-    {
132
-        $result = Route4Me::makeRequst(array(
133
-            'url'    => self::$apiUrl,
134
-            'method' => 'PUT',
135
-            'query'  => array(
136
-                'route_id'  => isset($params['route_id']) ? $params['route_id']: null, 
137
-                'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
138
-            ),
139
-            'body'   => $body
140
-        ));
141
-
142
-        return $result;
143
-    }
131
+	{
132
+		$result = Route4Me::makeRequst(array(
133
+			'url'    => self::$apiUrl,
134
+			'method' => 'PUT',
135
+			'query'  => array(
136
+				'route_id'  => isset($params['route_id']) ? $params['route_id']: null, 
137
+				'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
138
+			),
139
+			'body'   => $body
140
+		));
141
+
142
+		return $result;
143
+	}
144 144
 	
145 145
 	public function markAsDeparted($params)
146 146
 	{
147 147
 		$address = Route4Me::makeRequst(array(
148
-            'url'    => self::$apiUrDeparted,
149
-            'method' => 'GET',
150
-            'query'  => array(
151
-                'route_id'   => isset($params['route_id']) ? $params['route_id']: null,
152
-                'address_id'   => isset($params['address_id']) ? $params['address_id']: null,
153
-                'is_departed'   => isset($params['is_departed']) ? $params['is_departed']: null,
154
-                'member_id'   => isset($params['member_id']) ? $params['member_id']: null,
155
-            ),
156
-        ));
157
-
158
-        return $address;
148
+			'url'    => self::$apiUrDeparted,
149
+			'method' => 'GET',
150
+			'query'  => array(
151
+				'route_id'   => isset($params['route_id']) ? $params['route_id']: null,
152
+				'address_id'   => isset($params['address_id']) ? $params['address_id']: null,
153
+				'is_departed'   => isset($params['is_departed']) ? $params['is_departed']: null,
154
+				'member_id'   => isset($params['member_id']) ? $params['member_id']: null,
155
+			),
156
+		));
157
+
158
+		return $address;
159 159
 	}
160 160
 	
161 161
 	public function markAsVisited($params)
162 162
 	{
163 163
 		$address = Route4Me::makeRequst(array(
164
-            'url'    => self::$apiUrVisited,
165
-            'method' => 'GET',
166
-            'query'  => array(
167
-                'route_id'   => isset($params['route_id']) ? $params['route_id']: null,
168
-                'address_id'   => isset($params['address_id']) ? $params['address_id']: null,
169
-                'is_visited'   => isset($params['is_visited']) ? $params['is_visited']: null,
170
-                'member_id'   => isset($params['member_id']) ? $params['member_id']: null,
171
-            ),
172
-        ));
173
-
174
-        return $address;
164
+			'url'    => self::$apiUrVisited,
165
+			'method' => 'GET',
166
+			'query'  => array(
167
+				'route_id'   => isset($params['route_id']) ? $params['route_id']: null,
168
+				'address_id'   => isset($params['address_id']) ? $params['address_id']: null,
169
+				'is_visited'   => isset($params['is_visited']) ? $params['is_visited']: null,
170
+				'member_id'   => isset($params['member_id']) ? $params['member_id']: null,
171
+			),
172
+		));
173
+
174
+		return $address;
175 175
 	}
176 176
 
177
-    public function delete()
178
-    {
179
-        $address = Route4Me::makeRequst(array(
180
-            'url'    => self::$apiUrl,
181
-            'method' => 'DELETE',
182
-            'query'  => array(
183
-                'route_id'             => $this->route_id,
184
-                'route_destination_id' => $this->route_destination_id,
185
-            )
186
-        ));
187
-
188
-        return (bool)$address['deleted'];
189
-    }
177
+	public function delete()
178
+	{
179
+		$address = Route4Me::makeRequst(array(
180
+			'url'    => self::$apiUrl,
181
+			'method' => 'DELETE',
182
+			'query'  => array(
183
+				'route_id'             => $this->route_id,
184
+				'route_destination_id' => $this->route_destination_id,
185
+			)
186
+		));
187
+
188
+		return (bool)$address['deleted'];
189
+	}
190 190
 	
191 191
 	public function MoveDestinationToRoute($params)
192 192
 	{
193 193
 		$result = Route4Me::makeRequst(array(
194
-            'url'    => self::$apiUrlMove,
195
-            'method' => 'POST',
196
-            'query'  => array(
197
-                'to_route_id' => isset($params['to_route_id']) ? $params['to_route_id'] : null,
198
-                'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
199
-                'after_destination_id' => isset($params['after_destination_id']) ? $params['after_destination_id'] : null
200
-            )
201
-        ));
202
-
203
-        return $result;
194
+			'url'    => self::$apiUrlMove,
195
+			'method' => 'POST',
196
+			'query'  => array(
197
+				'to_route_id' => isset($params['to_route_id']) ? $params['to_route_id'] : null,
198
+				'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
199
+				'after_destination_id' => isset($params['after_destination_id']) ? $params['after_destination_id'] : null
200
+			)
201
+		));
202
+
203
+		return $result;
204 204
 		
205 205
 	}
206 206
 
207
-    function getAddressId()
208
-    {
209
-        return $this->route_destination_id;
210
-    }
207
+	function getAddressId()
208
+	{
209
+		return $this->route_destination_id;
210
+	}
211 211
 }
Please login to merge, or discard this patch.