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.
Test Failed
Push — master ( 5793f9...e93048 )
by Oleg
04:32
created
examples/Order/GetOrders.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 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\Order;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 	namespace Route4Me;
3 3
 	
4
-	$vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
4
+	$vdir = $_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
5 5
 
6 6
     require $vdir.'/../vendor/autoload.php';
7 7
 	
Please login to merge, or discard this patch.
examples/Order/UpdateOrder.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 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\Order;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 	namespace Route4Me;
3 3
 	
4
-	$vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
4
+	$vdir = $_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
5 5
 
6 6
     require $vdir.'/../vendor/autoload.php';
7 7
 	
Please login to merge, or discard this patch.
examples/Members/member_validate_session.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 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\Member;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 	namespace Route4Me;
3 3
 	
4
-	$vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
4
+	$vdir = $_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
5 5
 
6 6
     require $vdir.'/../vendor/autoload.php';
7 7
 	
Please login to merge, or discard this patch.
examples/Members/get_users.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 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\Member;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 	namespace Route4Me;
3 3
 	
4
-	$vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
4
+	$vdir = $_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
5 5
 
6 6
     require $vdir.'/../vendor/autoload.php';
7 7
 	
Please login to merge, or discard this patch.
src/Route4Me/Route4Me.php 4 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -204,6 +204,9 @@
 block discarded – undo
204 204
         }
205 205
     }
206 206
 
207
+	/**
208
+	 * @param string $url
209
+	 */
207 210
 	public static function makeUrlRequst($url, $options) {
208 211
 		$method = isset($options['method']) ? $options['method'] : 'GET';
209 212
         $query = isset($options['query']) ?
Please login to merge, or discard this patch.
Indentation   +125 added lines, -125 removed lines patch added patch discarded remove patch
@@ -6,37 +6,37 @@  discard block
 block discarded – undo
6 6
 
7 7
 class Route4Me
8 8
 {
9
-    static public $apiKey;
10
-    static public $baseUrl = 'https://route4me.com';
9
+	static public $apiKey;
10
+	static public $baseUrl = 'https://route4me.com';
11 11
 
12
-    public static function setApiKey($apiKey)
13
-    {
14
-        self::$apiKey = $apiKey;
15
-    }
12
+	public static function setApiKey($apiKey)
13
+	{
14
+		self::$apiKey = $apiKey;
15
+	}
16 16
 
17
-    public static function getApiKey()
18
-    {
19
-        return self::$apiKey;
20
-    }
17
+	public static function getApiKey()
18
+	{
19
+		return self::$apiKey;
20
+	}
21 21
 
22
-    public static function setBaseUrl($baseUrl)
23
-    {
24
-        self::$baseUrl = $baseUrl;
25
-    }
22
+	public static function setBaseUrl($baseUrl)
23
+	{
24
+		self::$baseUrl = $baseUrl;
25
+	}
26 26
 
27
-    public static function getBaseUrl()
28
-    {
29
-        return self::$baseUrl;
30
-    }
27
+	public static function getBaseUrl()
28
+	{
29
+		return self::$baseUrl;
30
+	}
31 31
 	
32 32
 	public static function fileUploadRequest($options) {
33 33
 		$query = isset($options['query']) ?
34
-            array_filter($options['query']) : array();
34
+			array_filter($options['query']) : array();
35 35
 
36 36
 		if (sizeof($query)==0) return null;
37 37
 
38 38
 		$body = isset($options['body']) ?
39
-            array_filter($options['body']) : null;
39
+			array_filter($options['body']) : null;
40 40
 			
41 41
 		$fname = isset($body['strFilename']) ? $body['strFilename'] : '';
42 42
 		if ($fname=='') return null;
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 		$fp=fopen(realpath($fname),"r");
47 47
 		
48 48
 		$url = self::$baseUrl.$options['url'] . '?' . http_build_query(array_merge(
49
-            array( 'api_key' => self::getApiKey()), $query)
50
-        );
49
+			array( 'api_key' => self::getApiKey()), $query)
50
+		);
51 51
 		
52 52
 		//self::simplePrint($body);die("");
53 53
 		//echo "url=".$url."<br>";die("");
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
 		$ch = curl_init($url);
56 56
 		
57 57
 		$curlOpts = array(
58
-            CURLOPT_RETURNTRANSFER => true,
59
-            CURLOPT_TIMEOUT        => 60,
60
-            CURLOPT_FOLLOWLOCATION => true,
61
-            CURLOPT_SSL_VERIFYHOST => FALSE,
62
-            CURLOPT_SSL_VERIFYPEER => FALSE
63
-        );
58
+			CURLOPT_RETURNTRANSFER => true,
59
+			CURLOPT_TIMEOUT        => 60,
60
+			CURLOPT_FOLLOWLOCATION => true,
61
+			CURLOPT_SSL_VERIFYHOST => FALSE,
62
+			CURLOPT_SSL_VERIFYPEER => FALSE
63
+		);
64 64
 		
65 65
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
66 66
 		
@@ -76,62 +76,62 @@  discard block
 block discarded – undo
76 76
 		fclose($fp);
77 77
 		//var_dump($result); die('');
78 78
 		$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
79
-        curl_close($ch);
79
+		curl_close($ch);
80 80
 		//echo "code = $code <br>";
81 81
 		$json = json_decode($result, true);
82 82
 		//var_dump($json); die("");
83
-        if (200 == $code) {
84
-            return $json;
85
-        } elseif (isset($json['errors'])) {
86
-            throw new ApiError(implode(', ', $json['errors']));
87
-        } else {
88
-            throw new ApiError('Something wrong');
89
-        }
83
+		if (200 == $code) {
84
+			return $json;
85
+		} elseif (isset($json['errors'])) {
86
+			throw new ApiError(implode(', ', $json['errors']));
87
+		} else {
88
+			throw new ApiError('Something wrong');
89
+		}
90 90
 	}
91 91
 
92
-    public static function makeRequst($options) {
93
-        $method = isset($options['method']) ? $options['method'] : 'GET';
94
-        $query = isset($options['query']) ?
95
-            array_filter($options['query']) : array();
92
+	public static function makeRequst($options) {
93
+		$method = isset($options['method']) ? $options['method'] : 'GET';
94
+		$query = isset($options['query']) ?
95
+			array_filter($options['query']) : array();
96 96
 		//echo "query=".$query['member_id'];die("");
97
-        $body = isset($options['body']) ?
98
-            array_filter($options['body']) : null;
97
+		$body = isset($options['body']) ?
98
+			array_filter($options['body']) : null;
99 99
 		$file = isset($options['FILE']) ? $options['FILE'] : null;
100
-        $headers = array(
101
-            "User-Agent: Route4Me php-sdk"
102
-        );
100
+		$headers = array(
101
+			"User-Agent: Route4Me php-sdk"
102
+		);
103 103
         
104
-        if (isset($options['HTTPHEADER'])) {
105
-            $headers[]=$options['HTTPHEADER'];
106
-        }
104
+		if (isset($options['HTTPHEADER'])) {
105
+			$headers[]=$options['HTTPHEADER'];
106
+		}
107 107
 
108 108
 		if (isset($options['HTTPHEADERS'])) {
109
-		    foreach ($options['HTTPHEADERS'] As $header) $headers[]=$header;
110
-        }
111
-        //self::simplePrint($headers); die("");
112
-        $ch = curl_init();
113
-        $url = $options['url'] . '?' . http_build_query(array_merge(
114
-            $query, array( 'api_key' => self::getApiKey())
115
-        ));
109
+			foreach ($options['HTTPHEADERS'] As $header) $headers[]=$header;
110
+		}
111
+		//self::simplePrint($headers); die("");
112
+		$ch = curl_init();
113
+		$url = $options['url'] . '?' . http_build_query(array_merge(
114
+			$query, array( 'api_key' => self::getApiKey())
115
+		));
116 116
 		
117 117
 		//$jfile=json_encode($body); echo $jfile; die("");
118 118
 
119
-        //self::simplePrint($headers); die("");
119
+		//self::simplePrint($headers); die("");
120 120
 		$baseUrl=self::getBaseUrl();
121 121
 		
122 122
 		if (strpos($url,'move_route_destination')>0) $baseUrl='https://www.route4me.com';
123
-        $curlOpts = arraY(
124
-            CURLOPT_URL            => $baseUrl. $url,
125
-            CURLOPT_RETURNTRANSFER => true,
126
-            CURLOPT_TIMEOUT        => 60,
127
-            CURLOPT_FOLLOWLOCATION => true,
128
-            CURLOPT_SSL_VERIFYHOST => FALSE,
129
-            CURLOPT_SSL_VERIFYPEER => FALSE,
130
-            CURLOPT_HTTPHEADER     => $headers
131
-        );
123
+		$curlOpts = arraY(
124
+			CURLOPT_URL            => $baseUrl. $url,
125
+			CURLOPT_RETURNTRANSFER => true,
126
+			CURLOPT_TIMEOUT        => 60,
127
+			CURLOPT_FOLLOWLOCATION => true,
128
+			CURLOPT_SSL_VERIFYHOST => FALSE,
129
+			CURLOPT_SSL_VERIFYPEER => FALSE,
130
+			CURLOPT_HTTPHEADER     => $headers
131
+		);
132 132
 		
133 133
 		//echo "url=".$baseUrl.$url."<br>";die("");
134
-        curl_setopt_array($ch, $curlOpts);
134
+		curl_setopt_array($ch, $curlOpts);
135 135
 		
136 136
 		if ($file !=null) {
137 137
 			curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
@@ -140,21 +140,21 @@  discard block
 block discarded – undo
140 140
 			curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file));
141 141
 		}
142 142
 		
143
-        switch($method) {
144
-        case 'DELETE':
145
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
143
+		switch($method) {
144
+		case 'DELETE':
145
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
146 146
 
147 147
 			if (isset($body)) {
148 148
 				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
149 149
 			}
150
-            break;
150
+			break;
151 151
 		case 'DELETEARRAY':
152 152
 			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
153
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
154
-            break;
155
-        case 'PUT':
153
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
154
+			break;
155
+		case 'PUT':
156 156
 			//$jfile=json_encode($body); echo $jfile; die("");
157
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
157
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
158 158
 			if (isset($query)) {
159 159
 				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
160 160
 			}
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
164 164
 			}
165 165
 			break;
166
-        case 'POST':
166
+		case 'POST':
167 167
 			if (isset($query)) {
168
-            	curl_setopt($ch,  CURLOPT_POSTFIELDS, json_encode($query)); 
168
+				curl_setopt($ch,  CURLOPT_POSTFIELDS, json_encode($query)); 
169 169
 			}
170 170
             
171 171
 			//echo json_encode($body); die("");
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 			} 
175 175
 			break;
176 176
 		case 'ADD':
177
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
178
-        }
177
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
178
+		}
179 179
 
180
-        $result = curl_exec($ch);
180
+		$result = curl_exec($ch);
181 181
 		//var_dump($result); die("");
182 182
 		$isxml=FALSE;
183 183
 		$jxml="";
@@ -188,58 +188,58 @@  discard block
 block discarded – undo
188 188
 			$isxml = TRUE;
189 189
 		}
190 190
 		
191
-        $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
192
-        curl_close($ch);
191
+		$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
192
+		curl_close($ch);
193 193
 		
194 194
 		if ($isxml) {
195 195
 			$json = $jxml;
196 196
 		} else $json = json_decode($result, true);
197 197
 		//var_dump($json); die("");
198
-        if (200 == $code) {
199
-            return $json;
200
-        } elseif (isset($json['errors'])) {
201
-            throw new ApiError(implode(', ', $json['errors']));
202
-        } else {
203
-            throw new ApiError('Something wrong');
204
-        }
205
-    }
198
+		if (200 == $code) {
199
+			return $json;
200
+		} elseif (isset($json['errors'])) {
201
+			throw new ApiError(implode(', ', $json['errors']));
202
+		} else {
203
+			throw new ApiError('Something wrong');
204
+		}
205
+	}
206 206
 
207 207
 	public static function makeUrlRequst($url, $options) {
208 208
 		$method = isset($options['method']) ? $options['method'] : 'GET';
209
-        $query = isset($options['query']) ?
210
-            array_filter($options['query']) : array();
211
-        $body = isset($options['body']) ?
212
-            array_filter($options['body']) : null;
213
-        $ch = curl_init();
209
+		$query = isset($options['query']) ?
210
+			array_filter($options['query']) : array();
211
+		$body = isset($options['body']) ?
212
+			array_filter($options['body']) : null;
213
+		$ch = curl_init();
214 214
 		
215 215
 		$curlOpts = arraY(
216
-            CURLOPT_URL            => $url,
217
-            CURLOPT_RETURNTRANSFER => true,
218
-            CURLOPT_TIMEOUT        => 60,
219
-            CURLOPT_FOLLOWLOCATION => true,
220
-            CURLOPT_SSL_VERIFYHOST => FALSE,
221
-            CURLOPT_SSL_VERIFYPEER => FALSE,
222
-            CURLOPT_HTTPHEADER     => array(
223
-                'User-Agent' => 'Route4Me php-sdk'
224
-            )
225
-        );
216
+			CURLOPT_URL            => $url,
217
+			CURLOPT_RETURNTRANSFER => true,
218
+			CURLOPT_TIMEOUT        => 60,
219
+			CURLOPT_FOLLOWLOCATION => true,
220
+			CURLOPT_SSL_VERIFYHOST => FALSE,
221
+			CURLOPT_SSL_VERIFYPEER => FALSE,
222
+			CURLOPT_HTTPHEADER     => array(
223
+				'User-Agent' => 'Route4Me php-sdk'
224
+			)
225
+		);
226 226
 		
227 227
 		curl_setopt_array($ch, $curlOpts);
228 228
 		
229
-        switch($method) {
230
-        case 'DELETE':
231
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
229
+		switch($method) {
230
+		case 'DELETE':
231
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
232 232
 
233 233
 			if (isset($body)) {
234 234
 				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
235 235
 			}
236
-            break;
236
+			break;
237 237
 		case 'DELETEARRAY':
238 238
 			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
239
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
240
-            break;
241
-        case 'PUT':
242
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
239
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
240
+			break;
241
+		case 'PUT':
242
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
243 243
 			if (isset($query)) {
244 244
 				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
245 245
 			}
@@ -248,10 +248,10 @@  discard block
 block discarded – undo
248 248
 				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
249 249
 			}
250 250
 			break;
251
-        case 'POST':
251
+		case 'POST':
252 252
 			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); 
253 253
 			if (isset($query)) {
254
-            	curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); 
254
+				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); 
255 255
 			}
256 256
 
257 257
 			if (isset($body)) {
@@ -259,8 +259,8 @@  discard block
 block discarded – undo
259 259
 			} 
260 260
 			break;
261 261
 		case 'ADD':
262
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
263
-        }
262
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
263
+		}
264 264
 
265 265
 		$result = curl_exec($ch);
266 266
         
@@ -273,21 +273,21 @@  discard block
 block discarded – undo
273 273
 			$isxml = TRUE;
274 274
 		}
275 275
 		
276
-        $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
277
-        curl_close($ch);
276
+		$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
277
+		curl_close($ch);
278 278
 		
279 279
 		if ($isxml) {
280 280
 			$json = $jxml;
281 281
 		} else $json = json_decode($result, true);
282 282
 		
283 283
 		
284
-        if (200 == $code) {
285
-            return $json;
286
-        } elseif (isset($json['errors'])) {
287
-            throw new ApiError(implode(', ', $json['errors']));
288
-        } else {
289
-            throw new ApiError('Something wrong');
290
-        }
284
+		if (200 == $code) {
285
+			return $json;
286
+		} elseif (isset($json['errors'])) {
287
+			throw new ApiError(implode(', ', $json['errors']));
288
+		} else {
289
+			throw new ApiError('Something wrong');
290
+		}
291 291
 	}
292 292
 	
293 293
 	/**
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 
44 44
 		$rpath = realpath($fname);
45 45
 		
46
-		$fp=fopen(realpath($fname),"r");
46
+		$fp = fopen(realpath($fname), "r");
47 47
 		
48
-		$url = self::$baseUrl.$options['url'] . '?' . http_build_query(array_merge(
49
-            array( 'api_key' => self::getApiKey()), $query)
48
+		$url = self::$baseUrl.$options['url'].'?'.http_build_query(array_merge(
49
+            array('api_key' => self::getApiKey()), $query)
50 50
         );
51 51
 		
52 52
 		//self::simplePrint($body);die("");
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 		//echo "code = $code <br>";
81 81
 		$json = json_decode($result, true);
82 82
 		//var_dump($json); die("");
83
-        if (200 == $code) {
83
+        if (200==$code) {
84 84
             return $json;
85 85
         } elseif (isset($json['errors'])) {
86 86
             throw new ApiError(implode(', ', $json['errors']));
@@ -102,26 +102,26 @@  discard block
 block discarded – undo
102 102
         );
103 103
         
104 104
         if (isset($options['HTTPHEADER'])) {
105
-            $headers[]=$options['HTTPHEADER'];
105
+            $headers[] = $options['HTTPHEADER'];
106 106
         }
107 107
 
108 108
 		if (isset($options['HTTPHEADERS'])) {
109
-		    foreach ($options['HTTPHEADERS'] As $header) $headers[]=$header;
109
+		    foreach ($options['HTTPHEADERS'] As $header) $headers[] = $header;
110 110
         }
111 111
         //self::simplePrint($headers); die("");
112 112
         $ch = curl_init();
113
-        $url = $options['url'] . '?' . http_build_query(array_merge(
114
-            $query, array( 'api_key' => self::getApiKey())
113
+        $url = $options['url'].'?'.http_build_query(array_merge(
114
+            $query, array('api_key' => self::getApiKey())
115 115
         ));
116 116
 		
117 117
 		//$jfile=json_encode($body); echo $jfile; die("");
118 118
 
119 119
         //self::simplePrint($headers); die("");
120
-		$baseUrl=self::getBaseUrl();
120
+		$baseUrl = self::getBaseUrl();
121 121
 		
122
-		if (strpos($url,'move_route_destination')>0) $baseUrl='https://www.route4me.com';
122
+		if (strpos($url, 'move_route_destination')>0) $baseUrl = 'https://www.route4me.com';
123 123
         $curlOpts = arraY(
124
-            CURLOPT_URL            => $baseUrl. $url,
124
+            CURLOPT_URL            => $baseUrl.$url,
125 125
             CURLOPT_RETURNTRANSFER => true,
126 126
             CURLOPT_TIMEOUT        => 60,
127 127
             CURLOPT_FOLLOWLOCATION => true,
@@ -133,14 +133,14 @@  discard block
 block discarded – undo
133 133
 		//echo "url=".$baseUrl.$url."<br>";die("");
134 134
         curl_setopt_array($ch, $curlOpts);
135 135
 		
136
-		if ($file !=null) {
136
+		if ($file!=null) {
137 137
 			curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
138
-			$fp=fopen($file,'r');
139
-			curl_setopt($ch, CURLOPT_INFILE , $fp);
138
+			$fp = fopen($file, 'r');
139
+			curl_setopt($ch, CURLOPT_INFILE, $fp);
140 140
 			curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file));
141 141
 		}
142 142
 		
143
-        switch($method) {
143
+        switch ($method) {
144 144
         case 'DELETE':
145 145
             curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
146 146
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 			break;
166 166
         case 'POST':
167 167
 			if (isset($query)) {
168
-            	curl_setopt($ch,  CURLOPT_POSTFIELDS, json_encode($query)); 
168
+            	curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); 
169 169
 			}
170 170
             
171 171
 			//echo json_encode($body); die("");
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 
180 180
         $result = curl_exec($ch);
181 181
 		//var_dump($result); die("");
182
-		$isxml=FALSE;
183
-		$jxml="";
182
+		$isxml = FALSE;
183
+		$jxml = "";
184 184
 		if (strpos($result, '<?xml')>-1)
185 185
 		{
186 186
 			$xml = simplexml_load_string($result);
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 			$json = $jxml;
196 196
 		} else $json = json_decode($result, true);
197 197
 		//var_dump($json); die("");
198
-        if (200 == $code) {
198
+        if (200==$code) {
199 199
             return $json;
200 200
         } elseif (isset($json['errors'])) {
201 201
             throw new ApiError(implode(', ', $json['errors']));
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 		
227 227
 		curl_setopt_array($ch, $curlOpts);
228 228
 		
229
-        switch($method) {
229
+        switch ($method) {
230 230
         case 'DELETE':
231 231
             curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
232 232
 
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
 
265 265
 		$result = curl_exec($ch);
266 266
         
267
-		$isxml=FALSE;
268
-		$jxml="";
267
+		$isxml = FALSE;
268
+		$jxml = "";
269 269
 		if (strpos($result, '<?xml')>-1)
270 270
 		{
271 271
 			$xml = simplexml_load_string($result);
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 		} else $json = json_decode($result, true);
282 282
 		
283 283
 		
284
-        if (200 == $code) {
284
+        if (200==$code) {
285 285
             return $json;
286 286
         } elseif (isset($json['errors'])) {
287 287
             throw new ApiError(implode(', ', $json['errors']));
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,13 +33,17 @@  discard block
 block discarded – undo
33 33
 		$query = isset($options['query']) ?
34 34
             array_filter($options['query']) : array();
35 35
 
36
-		if (sizeof($query)==0) return null;
36
+		if (sizeof($query)==0) {
37
+			return null;
38
+		}
37 39
 
38 40
 		$body = isset($options['body']) ?
39 41
             array_filter($options['body']) : null;
40 42
 			
41 43
 		$fname = isset($body['strFilename']) ? $body['strFilename'] : '';
42
-		if ($fname=='') return null;
44
+		if ($fname=='') {
45
+			return null;
46
+		}
43 47
 
44 48
 		$rpath = realpath($fname);
45 49
 		
@@ -106,7 +110,9 @@  discard block
 block discarded – undo
106 110
         }
107 111
 
108 112
 		if (isset($options['HTTPHEADERS'])) {
109
-		    foreach ($options['HTTPHEADERS'] As $header) $headers[]=$header;
113
+		    foreach ($options['HTTPHEADERS'] As $header) {
114
+		    	$headers[]=$header;
115
+		    }
110 116
         }
111 117
         //self::simplePrint($headers); die("");
112 118
         $ch = curl_init();
@@ -119,7 +125,9 @@  discard block
 block discarded – undo
119 125
         //self::simplePrint($headers); die("");
120 126
 		$baseUrl=self::getBaseUrl();
121 127
 		
122
-		if (strpos($url,'move_route_destination')>0) $baseUrl='https://www.route4me.com';
128
+		if (strpos($url,'move_route_destination')>0) {
129
+			$baseUrl='https://www.route4me.com';
130
+		}
123 131
         $curlOpts = arraY(
124 132
             CURLOPT_URL            => $baseUrl. $url,
125 133
             CURLOPT_RETURNTRANSFER => true,
@@ -193,7 +201,9 @@  discard block
 block discarded – undo
193 201
 		
194 202
 		if ($isxml) {
195 203
 			$json = $jxml;
196
-		} else $json = json_decode($result, true);
204
+		} else {
205
+			$json = json_decode($result, true);
206
+		}
197 207
 		//var_dump($json); die("");
198 208
         if (200 == $code) {
199 209
             return $json;
@@ -278,7 +288,9 @@  discard block
 block discarded – undo
278 288
 		
279 289
 		if ($isxml) {
280 290
 			$json = $jxml;
281
-		} else $json = json_decode($result, true);
291
+		} else {
292
+			$json = json_decode($result, true);
293
+		}
282 294
 		
283 295
 		
284 296
         if (200 == $code) {
Please login to merge, or discard this patch.
examples/GarageDoorOpener/myq_login.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 	$vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
3
-    require $vdir.'/../vendor/autoload.php';
3
+	require $vdir.'/../vendor/autoload.php';
4 4
 	
5 5
 	use Route4Me\MyQ;
6 6
 	
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-	$vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
2
+	$vdir = $_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
3 3
     require $vdir.'/../vendor/autoload.php';
4 4
 	
5 5
 	use Route4Me\MyQ;
Please login to merge, or discard this patch.
src/Route4Me/Member.php 2 patches
Indentation   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -68,60 +68,60 @@  discard block
 block discarded – undo
68 68
 		
69 69
 		public static function fromArray(array $params) {
70 70
 			$member= new Member();
71
-	        foreach($params as $key => $value) {
72
-	            if (property_exists($member, $key)) {
73
-	                $member->{$key} = $value;
74
-	            }
71
+			foreach($params as $key => $value) {
72
+				if (property_exists($member, $key)) {
73
+					$member->{$key} = $value;
74
+				}
75 75
 			}
76 76
 			
77 77
 			return $member;
78 78
 		}
79 79
 		
80 80
 		public static function getUsers()
81
-	    {
82
-	    	$response = Route4Me::makeRequst(array(
83
-	            'url'    => self::$apiUrl,
84
-	            'method' => 'GET'
85
-	        ));
81
+		{
82
+			$response = Route4Me::makeRequst(array(
83
+				'url'    => self::$apiUrl,
84
+				'method' => 'GET'
85
+			));
86 86
 			//var_dump($response); die("");
87 87
 			return $response;
88 88
 		}
89 89
 		
90 90
 		public static function getUser($params)
91
-	    {
92
-	    	$response = Route4Me::makeRequst(array(
93
-	            'url'    => self::$apiUrl,
94
-	            'method' => 'GET',
95
-	            'query'  => array(
96
-	            	'member_id' => isset($params['member_id']) ? $params['member_id'] : null
91
+		{
92
+			$response = Route4Me::makeRequst(array(
93
+				'url'    => self::$apiUrl,
94
+				'method' => 'GET',
95
+				'query'  => array(
96
+					'member_id' => isset($params['member_id']) ? $params['member_id'] : null
97 97
 				)
98
-	        ));
98
+			));
99 99
 			//var_dump($response); die("");
100 100
 			return $response;
101 101
 		}
102 102
 		
103 103
 		public static function getUserLocations($param)
104
-	    {
105
-	    	$response = Route4Me::makeRequst(array(
106
-	            'url'    => self::$apiUserLocations,
107
-	            'method' => 'GET',
108
-	            'query'  => array(
109
-	            	'query' => $param
104
+		{
105
+			$response = Route4Me::makeRequst(array(
106
+				'url'    => self::$apiUserLocations,
107
+				'method' => 'GET',
108
+				'query'  => array(
109
+					'query' => $param
110 110
 				)
111
-	        ));
111
+			));
112 112
 			//var_dump($response); die("");
113 113
 			return $response;
114 114
 		}
115 115
 		
116 116
 		public static function addDeviceRecord($body)
117
-	    {
118
-	    	$response = Route4Me::makeRequst(array(
119
-	            'url'    => self::$apiUrlDevice,
120
-	            'method' => 'POST',
121
-	            'body'  => array(
117
+		{
118
+			$response = Route4Me::makeRequst(array(
119
+				'url'    => self::$apiUrlDevice,
120
+				'method' => 'POST',
121
+				'body'  => array(
122 122
 					'device_id' => 	isset($body->device_id) ? $body->device_id: null,
123
-	                'device_type' => isset($body->device_type) ? $body->device_type : null,
124
-	                'format' => isset($body->format) ? $body->format : null
123
+					'device_type' => isset($body->device_type) ? $body->device_type : null,
124
+					'format' => isset($body->format) ? $body->format : null
125 125
 				)
126 126
 
127 127
 			));
@@ -129,25 +129,25 @@  discard block
 block discarded – undo
129 129
 		}
130 130
 		
131 131
 		public static function createMember($body)
132
-	    {
133
-	    	$response = Route4Me::makeRequst(array(
134
-	            'url'    => self::$apiUrl,
135
-	            'method' => 'POST',
136
-	            'body'  => array(
132
+		{
133
+			$response = Route4Me::makeRequst(array(
134
+				'url'    => self::$apiUrl,
135
+				'method' => 'POST',
136
+				'body'  => array(
137 137
 					'HIDE_ROUTED_ADDRESSES' => 	isset($body->HIDE_ROUTED_ADDRESSES) ? $body->HIDE_ROUTED_ADDRESSES: null,
138
-	                'member_phone' => isset($body->member_phone) ? $body->member_phone : null,
139
-	                'member_zipcode' => isset($body->member_zipcode) ? $body->member_zipcode : null,
140
-	                'route_count' => isset($body->route_count) ? $body->route_count : null,
141
-	                'member_email' => isset($body->member_email) ? $body->member_email : null,
142
-	                'HIDE_VISITED_ADDRESSES' => isset($body->HIDE_VISITED_ADDRESSES) ? $body->HIDE_VISITED_ADDRESSES : null,
143
-	                'READONLY_USER' => isset($body->READONLY_USER) ? $body->READONLY_USER : null,
144
-	                'date_of_birth' => isset($body->date_of_birth) ? $body->date_of_birth : null,
145
-	                'member_first_name' => isset($body->member_first_name) ? $body->member_first_name : null,
146
-	                'member_password' => isset($body->member_password) ? $body->member_password : null,
147
-	                'HIDE_NONFUTURE_ROUTES' => isset($body->HIDE_NONFUTURE_ROUTES) ? $body->HIDE_NONFUTURE_ROUTES : null,
148
-	                'member_last_name' => isset($body->member_last_name) ? $body->member_last_name : null,
149
-	                'SHOW_ALL_VEHICLES' => isset($body->SHOW_ALL_VEHICLES) ? $body->SHOW_ALL_VEHICLES : null,
150
-	                'SHOW_ALL_DRIVERS' => isset($body->SHOW_ALL_DRIVERS) ? $body->SHOW_ALL_DRIVERS : null
138
+					'member_phone' => isset($body->member_phone) ? $body->member_phone : null,
139
+					'member_zipcode' => isset($body->member_zipcode) ? $body->member_zipcode : null,
140
+					'route_count' => isset($body->route_count) ? $body->route_count : null,
141
+					'member_email' => isset($body->member_email) ? $body->member_email : null,
142
+					'HIDE_VISITED_ADDRESSES' => isset($body->HIDE_VISITED_ADDRESSES) ? $body->HIDE_VISITED_ADDRESSES : null,
143
+					'READONLY_USER' => isset($body->READONLY_USER) ? $body->READONLY_USER : null,
144
+					'date_of_birth' => isset($body->date_of_birth) ? $body->date_of_birth : null,
145
+					'member_first_name' => isset($body->member_first_name) ? $body->member_first_name : null,
146
+					'member_password' => isset($body->member_password) ? $body->member_password : null,
147
+					'HIDE_NONFUTURE_ROUTES' => isset($body->HIDE_NONFUTURE_ROUTES) ? $body->HIDE_NONFUTURE_ROUTES : null,
148
+					'member_last_name' => isset($body->member_last_name) ? $body->member_last_name : null,
149
+					'SHOW_ALL_VEHICLES' => isset($body->SHOW_ALL_VEHICLES) ? $body->SHOW_ALL_VEHICLES : null,
150
+					'SHOW_ALL_DRIVERS' => isset($body->SHOW_ALL_DRIVERS) ? $body->SHOW_ALL_DRIVERS : null
151 151
 				)
152 152
 
153 153
 			));
@@ -155,26 +155,26 @@  discard block
 block discarded – undo
155 155
 		}
156 156
 
157 157
 		public static function updateMember($body)
158
-	    {
159
-	    	$response = Route4Me::makeRequst(array(
160
-	            'url'    => self::$apiUrl,
161
-	            'method' => 'PUT',
162
-	            'body'  => array(
158
+		{
159
+			$response = Route4Me::makeRequst(array(
160
+				'url'    => self::$apiUrl,
161
+				'method' => 'PUT',
162
+				'body'  => array(
163 163
 					'member_id' => 	isset($body->member_id) ? $body->member_id: null,
164
-	                'member_phone' => isset($body->member_phone) ? $body->member_phone : null,
165
-	                'HIDE_ROUTED_ADDRESSES' => 	isset($body->HIDE_ROUTED_ADDRESSES) ? $body->HIDE_ROUTED_ADDRESSES: null,
166
-	                'member_zipcode' => isset($body->member_zipcode) ? $body->member_zipcode : null,
167
-	                'route_count' => isset($body->route_count) ? $body->route_count : null,
168
-	                'member_email' => isset($body->member_email) ? $body->member_email : null,
169
-	                'HIDE_VISITED_ADDRESSES' => isset($body->HIDE_VISITED_ADDRESSES) ? $body->HIDE_VISITED_ADDRESSES : null,
170
-	                'READONLY_USER' => isset($body->READONLY_USER) ? $body->READONLY_USER : null,
171
-	                'date_of_birth' => isset($body->date_of_birth) ? $body->date_of_birth : null,
172
-	                'member_first_name' => isset($body->member_first_name) ? $body->member_first_name : null,
173
-	                'member_password' => isset($body->member_password) ? $body->member_password : null,
174
-	                'HIDE_NONFUTURE_ROUTES' => isset($body->HIDE_NONFUTURE_ROUTES) ? $body->HIDE_NONFUTURE_ROUTES : null,
175
-	                'member_last_name' => isset($body->member_last_name) ? $body->member_last_name : null,
176
-	                'SHOW_ALL_VEHICLES' => isset($body->SHOW_ALL_VEHICLES) ? $body->SHOW_ALL_VEHICLES : null,
177
-	                'SHOW_ALL_DRIVERS' => isset($body->SHOW_ALL_DRIVERS) ? $body->SHOW_ALL_DRIVERS : null
164
+					'member_phone' => isset($body->member_phone) ? $body->member_phone : null,
165
+					'HIDE_ROUTED_ADDRESSES' => 	isset($body->HIDE_ROUTED_ADDRESSES) ? $body->HIDE_ROUTED_ADDRESSES: null,
166
+					'member_zipcode' => isset($body->member_zipcode) ? $body->member_zipcode : null,
167
+					'route_count' => isset($body->route_count) ? $body->route_count : null,
168
+					'member_email' => isset($body->member_email) ? $body->member_email : null,
169
+					'HIDE_VISITED_ADDRESSES' => isset($body->HIDE_VISITED_ADDRESSES) ? $body->HIDE_VISITED_ADDRESSES : null,
170
+					'READONLY_USER' => isset($body->READONLY_USER) ? $body->READONLY_USER : null,
171
+					'date_of_birth' => isset($body->date_of_birth) ? $body->date_of_birth : null,
172
+					'member_first_name' => isset($body->member_first_name) ? $body->member_first_name : null,
173
+					'member_password' => isset($body->member_password) ? $body->member_password : null,
174
+					'HIDE_NONFUTURE_ROUTES' => isset($body->HIDE_NONFUTURE_ROUTES) ? $body->HIDE_NONFUTURE_ROUTES : null,
175
+					'member_last_name' => isset($body->member_last_name) ? $body->member_last_name : null,
176
+					'SHOW_ALL_VEHICLES' => isset($body->SHOW_ALL_VEHICLES) ? $body->SHOW_ALL_VEHICLES : null,
177
+					'SHOW_ALL_DRIVERS' => isset($body->SHOW_ALL_DRIVERS) ? $body->SHOW_ALL_DRIVERS : null
178 178
 				)
179 179
 
180 180
 			));
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
 		}
183 183
 
184 184
 		public static function deleteMember($body)
185
-	    {
186
-	    	$response = Route4Me::makeRequst(array(
187
-	            'url'    => self::$apiUrl,
188
-	            'method' => 'DELETE',
189
-	            'body'  => array(
185
+		{
186
+			$response = Route4Me::makeRequst(array(
187
+				'url'    => self::$apiUrl,
188
+				'method' => 'DELETE',
189
+				'body'  => array(
190 190
 					'member_id' => 	isset($body->member_id) ? $body->member_id: null
191 191
 				)
192 192
 
@@ -195,50 +195,50 @@  discard block
 block discarded – undo
195 195
 		}
196 196
 		
197 197
 		public static function newAccountRegistration($body)
198
-	    {
199
-	    	$response = Route4Me::makeRequst(array(
200
-	            'url'    => self::$apiUrlRegistr,
201
-	            'method' => 'POST',
202
-	            'body'  => array(
198
+		{
199
+			$response = Route4Me::makeRequst(array(
200
+				'url'    => self::$apiUrlRegistr,
201
+				'method' => 'POST',
202
+				'body'  => array(
203 203
 					'strEmail' => 	isset($body->strEmail) ? $body->strEmail: null,
204
-	                'strPassword_1' => isset($body->strPassword_1) ? $body->strPassword_1 : null,
205
-	                'strPassword_2' => isset($body->strPassword_2) ? $body->strPassword_2 : null,
206
-	                'strFirstName' => 	isset($body->strFirstName) ? $body->strFirstName: null,
207
-	                'strLastName' => 	isset($body->strLastName) ? $body->strLastName: null,
208
-	                'strIndustry' => 	isset($body->strIndustry) ? $body->strIndustry: null,
209
-	                'chkTerms' => 	isset($body->chkTerms) ? $body->chkTerms: null,
210
-	                'plan' => 	isset($body->plan) ? $body->plan: null,
211
-	                'strSubAccountType' =>  isset($body->strSubAccountType) ? $body->strSubAccountType: null,
212
-	                'blDisableMarketing' => isset($body->blDisableMarketing) ? $body->blDisableMarketing: false,
213
-	                'blDisableAccountActivationEmail' => isset($body->blDisableAccountActivationEmail) ? $body->blDisableAccountActivationEmail: false
204
+					'strPassword_1' => isset($body->strPassword_1) ? $body->strPassword_1 : null,
205
+					'strPassword_2' => isset($body->strPassword_2) ? $body->strPassword_2 : null,
206
+					'strFirstName' => 	isset($body->strFirstName) ? $body->strFirstName: null,
207
+					'strLastName' => 	isset($body->strLastName) ? $body->strLastName: null,
208
+					'strIndustry' => 	isset($body->strIndustry) ? $body->strIndustry: null,
209
+					'chkTerms' => 	isset($body->chkTerms) ? $body->chkTerms: null,
210
+					'plan' => 	isset($body->plan) ? $body->plan: null,
211
+					'strSubAccountType' =>  isset($body->strSubAccountType) ? $body->strSubAccountType: null,
212
+					'blDisableMarketing' => isset($body->blDisableMarketing) ? $body->blDisableMarketing: false,
213
+					'blDisableAccountActivationEmail' => isset($body->blDisableAccountActivationEmail) ? $body->blDisableAccountActivationEmail: false
214 214
 				)
215 215
 			));
216 216
 			return $response;
217 217
 		}
218 218
 		
219 219
 		public static function validateSession($params)
220
-	    {
221
-	    	$response = Route4Me::makeRequst(array(
222
-	            'url'    => self::$apiUrlSessValid,
223
-	            'method' => 'GET',
224
-	            'query'  => array(
220
+		{
221
+			$response = Route4Me::makeRequst(array(
222
+				'url'    => self::$apiUrlSessValid,
223
+				'method' => 'GET',
224
+				'query'  => array(
225 225
 					'session_guid' => 	isset($params->session_guid) ? $params->session_guid: null,
226
-	                'member_id' => isset($params->member_id) ? $params->member_id : null,
227
-	                'format' => isset($params->format) ? $params->format : null
226
+					'member_id' => isset($params->member_id) ? $params->member_id : null,
227
+					'format' => isset($params->format) ? $params->format : null
228 228
 				)
229 229
 			));
230 230
 			return $response;
231 231
 		}
232 232
 		
233 233
 		public static function memberAuthentication($body)
234
-	    {
235
-	    	$response = Route4Me::makeRequst(array(
236
-	            'url'    => self::$apiUrlAuthen,
237
-	            'method' => 'POST',
238
-	            'body'  => array(
234
+		{
235
+			$response = Route4Me::makeRequst(array(
236
+				'url'    => self::$apiUrlAuthen,
237
+				'method' => 'POST',
238
+				'body'  => array(
239 239
 					'strEmail' => 	isset($body->strEmail) ? $body->strEmail: null,
240
-	                'strPassword' => isset($body->strPassword) ? $body->strPassword : null,
241
-	                'format' => isset($body->format) ? $body->format : null
240
+					'strPassword' => isset($body->strPassword) ? $body->strPassword : null,
241
+					'format' => isset($body->format) ? $body->format : null
242 242
 				)
243 243
 
244 244
 			));
@@ -246,18 +246,18 @@  discard block
 block discarded – undo
246 246
 		}
247 247
 		
248 248
 		public static function webinarRegistration($body)
249
-	    {
250
-	    	$response = Route4Me::makeRequst(array(
251
-	            'url'    => self::$apiUrlWebinar,
252
-	            'method' => 'POST',
253
-	            'body'  => array(
249
+		{
250
+			$response = Route4Me::makeRequst(array(
251
+				'url'    => self::$apiUrlWebinar,
252
+				'method' => 'POST',
253
+				'body'  => array(
254 254
 					'email_address' => 	isset($body->email_address) ? $body->email_address: null,
255
-	                'first_name' => isset($body->first_name) ? $body->first_name : null,
256
-	                'last_name' => isset($body->last_name) ? $body->last_name : null,
257
-	                'phone_number' => isset($body->phone_number) ? $body->phone_number : null,
258
-	                'phone_number' => isset($body->phone_number) ? $body->phone_number : null,
259
-	                'member_id' => isset($body->member_id) ? $body->member_id : null,
260
-	                'webiinar_date' => isset($body->webiinar_date) ? $body->webiinar_date : null,
255
+					'first_name' => isset($body->first_name) ? $body->first_name : null,
256
+					'last_name' => isset($body->last_name) ? $body->last_name : null,
257
+					'phone_number' => isset($body->phone_number) ? $body->phone_number : null,
258
+					'phone_number' => isset($body->phone_number) ? $body->phone_number : null,
259
+					'member_id' => isset($body->member_id) ? $body->member_id : null,
260
+					'webiinar_date' => isset($body->webiinar_date) ? $body->webiinar_date : null,
261 261
 				)
262 262
 
263 263
 			));
@@ -265,19 +265,19 @@  discard block
 block discarded – undo
265 265
 		}
266 266
 		
267 267
 		public static function purchaseUserLicense($body)
268
-	    {
269
-	    	$response = Route4Me::makeRequst(array(
270
-	            'url'    => self::$apiUrlLicense,
271
-	            'method' => 'POST',
272
-	            'body'  => array(
268
+		{
269
+			$response = Route4Me::makeRequst(array(
270
+				'url'    => self::$apiUrlLicense,
271
+				'method' => 'POST',
272
+				'body'  => array(
273 273
 					'member_id' => 	isset($body->member_id) ? $body->member_id: null,
274
-	                'session_guid' => isset($body->session_guid) ? $body->session_guid : null,
275
-	                'device_id' => isset($body->device_id) ? $body->device_id : null,
276
-	                'device_type' => isset($body->device_type) ? $body->device_type : null,
277
-	                'subscription_name' => isset($body->subscription_name) ? $body->subscription_name : null,
278
-	                'token' => isset($body->token) ? $body->token : null,
279
-	                'payload' => isset($body->payload) ? $body->payload : null,
280
-	                'format' => isset($body->format) ? $body->format : null,
274
+					'session_guid' => isset($body->session_guid) ? $body->session_guid : null,
275
+					'device_id' => isset($body->device_id) ? $body->device_id : null,
276
+					'device_type' => isset($body->device_type) ? $body->device_type : null,
277
+					'subscription_name' => isset($body->subscription_name) ? $body->subscription_name : null,
278
+					'token' => isset($body->token) ? $body->token : null,
279
+					'payload' => isset($body->payload) ? $body->payload : null,
280
+					'format' => isset($body->format) ? $body->format : null,
281 281
 				)
282 282
 
283 283
 			));
@@ -285,24 +285,24 @@  discard block
 block discarded – undo
285 285
 		}
286 286
 		
287 287
 		public static function newMemberConfigKey($body)
288
-	    {
289
-	    	$response = Route4Me::makeRequst(array(
290
-	            'url'    => self::$apiMemberConfig,
291
-	            'method' => 'POST',
292
-	            'body'  => array(
288
+		{
289
+			$response = Route4Me::makeRequst(array(
290
+				'url'    => self::$apiMemberConfig,
291
+				'method' => 'POST',
292
+				'body'  => array(
293 293
 					'config_key' => 	isset($body->config_key) ? $body->config_key: null,
294
-	                'config_value' => isset($body->config_value) ? $body->config_value : null
294
+					'config_value' => isset($body->config_value) ? $body->config_value : null
295 295
 				)
296 296
 			));
297 297
 			return $response;
298 298
 		}
299 299
 		
300 300
 		public static function removeMemberConfigKey($body)
301
-	    {
302
-	    	$response = Route4Me::makeRequst(array(
303
-	            'url'    => self::$apiMemberConfig,
304
-	            'method' => 'DELETE',
305
-	            'body'  => array(
301
+		{
302
+			$response = Route4Me::makeRequst(array(
303
+				'url'    => self::$apiMemberConfig,
304
+				'method' => 'DELETE',
305
+				'body'  => array(
306 306
 					'config_key' => 	isset($body->config_key) ? $body->config_key: null
307 307
 				)
308 308
 			));
@@ -310,11 +310,11 @@  discard block
 block discarded – undo
310 310
 		}
311 311
 		
312 312
 		public static function getMemberConfigData($body)
313
-	    {
314
-	    	$response = Route4Me::makeRequst(array(
315
-	            'url'    => self::$apiMemberConfig,
316
-	            'method' => 'GET',
317
-	            'query'  => array(
313
+		{
314
+			$response = Route4Me::makeRequst(array(
315
+				'url'    => self::$apiMemberConfig,
316
+				'method' => 'GET',
317
+				'query'  => array(
318 318
 					'config_key' => 	isset($body->config_key) ? $body->config_key: null
319 319
 				)
320 320
 			));
@@ -322,13 +322,13 @@  discard block
 block discarded – undo
322 322
 		}
323 323
 
324 324
 		public static function updateMemberConfigKey($body)
325
-	    {
326
-	    	$response = Route4Me::makeRequst(array(
327
-	            'url'    => self::$apiMemberConfig,
328
-	            'method' => 'PUT',
329
-	            'body'  => array(
325
+		{
326
+			$response = Route4Me::makeRequst(array(
327
+				'url'    => self::$apiMemberConfig,
328
+				'method' => 'PUT',
329
+				'body'  => array(
330 330
 					'config_key' => 	isset($body->config_key) ? $body->config_key: null,
331
-	                'config_value' => isset($body->config_value) ? $body->config_value : null
331
+					'config_value' => isset($body->config_value) ? $body->config_value : null
332 332
 				)
333 333
 			));
334 334
 			return $response;
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 		public $config_key;
65 65
 		public $config_value;
66 66
 		
67
-		public function __construct () {  }
67
+		public function __construct() {  }
68 68
 		
69 69
 		public static function fromArray(array $params) {
70
-			$member= new Member();
71
-	        foreach($params as $key => $value) {
70
+			$member = new Member();
71
+	        foreach ($params as $key => $value) {
72 72
 	            if (property_exists($member, $key)) {
73 73
 	                $member->{$key} = $value;
74 74
 	            }
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	            'url'    => self::$apiUrlDevice,
120 120
 	            'method' => 'POST',
121 121
 	            'body'  => array(
122
-					'device_id' => 	isset($body->device_id) ? $body->device_id: null,
122
+					'device_id' => 	isset($body->device_id) ? $body->device_id : null,
123 123
 	                'device_type' => isset($body->device_type) ? $body->device_type : null,
124 124
 	                'format' => isset($body->format) ? $body->format : null
125 125
 				)
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	            'url'    => self::$apiUrl,
135 135
 	            'method' => 'POST',
136 136
 	            'body'  => array(
137
-					'HIDE_ROUTED_ADDRESSES' => 	isset($body->HIDE_ROUTED_ADDRESSES) ? $body->HIDE_ROUTED_ADDRESSES: null,
137
+					'HIDE_ROUTED_ADDRESSES' => 	isset($body->HIDE_ROUTED_ADDRESSES) ? $body->HIDE_ROUTED_ADDRESSES : null,
138 138
 	                'member_phone' => isset($body->member_phone) ? $body->member_phone : null,
139 139
 	                'member_zipcode' => isset($body->member_zipcode) ? $body->member_zipcode : null,
140 140
 	                'route_count' => isset($body->route_count) ? $body->route_count : null,
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
 	            'url'    => self::$apiUrl,
161 161
 	            'method' => 'PUT',
162 162
 	            'body'  => array(
163
-					'member_id' => 	isset($body->member_id) ? $body->member_id: null,
163
+					'member_id' => 	isset($body->member_id) ? $body->member_id : null,
164 164
 	                'member_phone' => isset($body->member_phone) ? $body->member_phone : null,
165
-	                'HIDE_ROUTED_ADDRESSES' => 	isset($body->HIDE_ROUTED_ADDRESSES) ? $body->HIDE_ROUTED_ADDRESSES: null,
165
+	                'HIDE_ROUTED_ADDRESSES' => 	isset($body->HIDE_ROUTED_ADDRESSES) ? $body->HIDE_ROUTED_ADDRESSES : null,
166 166
 	                'member_zipcode' => isset($body->member_zipcode) ? $body->member_zipcode : null,
167 167
 	                'route_count' => isset($body->route_count) ? $body->route_count : null,
168 168
 	                'member_email' => isset($body->member_email) ? $body->member_email : null,
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	            'url'    => self::$apiUrl,
188 188
 	            'method' => 'DELETE',
189 189
 	            'body'  => array(
190
-					'member_id' => 	isset($body->member_id) ? $body->member_id: null
190
+					'member_id' => 	isset($body->member_id) ? $body->member_id : null
191 191
 				)
192 192
 
193 193
 			));
@@ -200,17 +200,17 @@  discard block
 block discarded – undo
200 200
 	            'url'    => self::$apiUrlRegistr,
201 201
 	            'method' => 'POST',
202 202
 	            'body'  => array(
203
-					'strEmail' => 	isset($body->strEmail) ? $body->strEmail: null,
203
+					'strEmail' => 	isset($body->strEmail) ? $body->strEmail : null,
204 204
 	                'strPassword_1' => isset($body->strPassword_1) ? $body->strPassword_1 : null,
205 205
 	                'strPassword_2' => isset($body->strPassword_2) ? $body->strPassword_2 : null,
206
-	                'strFirstName' => 	isset($body->strFirstName) ? $body->strFirstName: null,
207
-	                'strLastName' => 	isset($body->strLastName) ? $body->strLastName: null,
208
-	                'strIndustry' => 	isset($body->strIndustry) ? $body->strIndustry: null,
209
-	                'chkTerms' => 	isset($body->chkTerms) ? $body->chkTerms: null,
210
-	                'plan' => 	isset($body->plan) ? $body->plan: null,
211
-	                'strSubAccountType' =>  isset($body->strSubAccountType) ? $body->strSubAccountType: null,
212
-	                'blDisableMarketing' => isset($body->blDisableMarketing) ? $body->blDisableMarketing: false,
213
-	                'blDisableAccountActivationEmail' => isset($body->blDisableAccountActivationEmail) ? $body->blDisableAccountActivationEmail: false
206
+	                'strFirstName' => 	isset($body->strFirstName) ? $body->strFirstName : null,
207
+	                'strLastName' => 	isset($body->strLastName) ? $body->strLastName : null,
208
+	                'strIndustry' => 	isset($body->strIndustry) ? $body->strIndustry : null,
209
+	                'chkTerms' => 	isset($body->chkTerms) ? $body->chkTerms : null,
210
+	                'plan' => 	isset($body->plan) ? $body->plan : null,
211
+	                'strSubAccountType' =>  isset($body->strSubAccountType) ? $body->strSubAccountType : null,
212
+	                'blDisableMarketing' => isset($body->blDisableMarketing) ? $body->blDisableMarketing : false,
213
+	                'blDisableAccountActivationEmail' => isset($body->blDisableAccountActivationEmail) ? $body->blDisableAccountActivationEmail : false
214 214
 				)
215 215
 			));
216 216
 			return $response;
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	            'url'    => self::$apiUrlSessValid,
223 223
 	            'method' => 'GET',
224 224
 	            'query'  => array(
225
-					'session_guid' => 	isset($params->session_guid) ? $params->session_guid: null,
225
+					'session_guid' => 	isset($params->session_guid) ? $params->session_guid : null,
226 226
 	                'member_id' => isset($params->member_id) ? $params->member_id : null,
227 227
 	                'format' => isset($params->format) ? $params->format : null
228 228
 				)
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	            'url'    => self::$apiUrlAuthen,
237 237
 	            'method' => 'POST',
238 238
 	            'body'  => array(
239
-					'strEmail' => 	isset($body->strEmail) ? $body->strEmail: null,
239
+					'strEmail' => 	isset($body->strEmail) ? $body->strEmail : null,
240 240
 	                'strPassword' => isset($body->strPassword) ? $body->strPassword : null,
241 241
 	                'format' => isset($body->format) ? $body->format : null
242 242
 				)
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	            'url'    => self::$apiUrlWebinar,
252 252
 	            'method' => 'POST',
253 253
 	            'body'  => array(
254
-					'email_address' => 	isset($body->email_address) ? $body->email_address: null,
254
+					'email_address' => 	isset($body->email_address) ? $body->email_address : null,
255 255
 	                'first_name' => isset($body->first_name) ? $body->first_name : null,
256 256
 	                'last_name' => isset($body->last_name) ? $body->last_name : null,
257 257
 	                'phone_number' => isset($body->phone_number) ? $body->phone_number : null,
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	            'url'    => self::$apiUrlLicense,
271 271
 	            'method' => 'POST',
272 272
 	            'body'  => array(
273
-					'member_id' => 	isset($body->member_id) ? $body->member_id: null,
273
+					'member_id' => 	isset($body->member_id) ? $body->member_id : null,
274 274
 	                'session_guid' => isset($body->session_guid) ? $body->session_guid : null,
275 275
 	                'device_id' => isset($body->device_id) ? $body->device_id : null,
276 276
 	                'device_type' => isset($body->device_type) ? $body->device_type : null,
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 	            'url'    => self::$apiMemberConfig,
291 291
 	            'method' => 'POST',
292 292
 	            'body'  => array(
293
-					'config_key' => 	isset($body->config_key) ? $body->config_key: null,
293
+					'config_key' => 	isset($body->config_key) ? $body->config_key : null,
294 294
 	                'config_value' => isset($body->config_value) ? $body->config_value : null
295 295
 				)
296 296
 			));
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 	            'url'    => self::$apiMemberConfig,
304 304
 	            'method' => 'DELETE',
305 305
 	            'body'  => array(
306
-					'config_key' => 	isset($body->config_key) ? $body->config_key: null
306
+					'config_key' => 	isset($body->config_key) ? $body->config_key : null
307 307
 				)
308 308
 			));
309 309
 			return $response;
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	            'url'    => self::$apiMemberConfig,
316 316
 	            'method' => 'GET',
317 317
 	            'query'  => array(
318
-					'config_key' => 	isset($body->config_key) ? $body->config_key: null
318
+					'config_key' => 	isset($body->config_key) ? $body->config_key : null
319 319
 				)
320 320
 			));
321 321
 			return $response;
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	            'url'    => self::$apiMemberConfig,
328 328
 	            'method' => 'PUT',
329 329
 	            'body'  => array(
330
-					'config_key' => 	isset($body->config_key) ? $body->config_key: null,
330
+					'config_key' => 	isset($body->config_key) ? $body->config_key : null,
331 331
 	                'config_value' => isset($body->config_value) ? $body->config_value : null
332 332
 				)
333 333
 			));
Please login to merge, or discard this patch.
examples/Optimizations/hybridOptimization.php 5 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,6 @@
 block discarded – undo
6 6
 require $vdir.'/../vendor/autoload.php';
7 7
 
8 8
 use Route4Me\OptimizationProblem;
9
-use Route4Me\Route;
10 9
 use Route4Me\Route4Me;
11 10
 
12 11
 /* The example demonstrates process of creating a Hybrid Optimization using scheduling addresses and orders.
Please login to merge, or discard this patch.
Indentation   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -25,222 +25,222 @@
 block discarded – undo
25 25
 /* Add Address Book Locations with schedules */
26 26
 
27 27
 if (($handle = fopen("$source_file", "r")) !== FALSE) {
28
-        $columns = fgetcsv($handle, $max_line_length, $delemietr);
29
-        if (!$columns) {
30
-            $error['message'] = 'Empty';
31
-             return ($error);
32
-        }
28
+		$columns = fgetcsv($handle, $max_line_length, $delemietr);
29
+		if (!$columns) {
30
+			$error['message'] = 'Empty';
31
+			 return ($error);
32
+		}
33 33
         
34
-        $iRow=1;
34
+		$iRow=1;
35 35
         
36
-        while (($rows = fgetcsv($handle, $max_line_length, $delemietr)) !== false) {
37
-            //if ($iRow==1) {$iRow++; continue;}
36
+		while (($rows = fgetcsv($handle, $max_line_length, $delemietr)) !== false) {
37
+			//if ($iRow==1) {$iRow++; continue;}
38 38
             
39
-            if ($rows[0] && $rows[1] && $rows[3] && array(null) !== $rows) { // ignore blank lines
40
-                    //$data1 = $rows[0].", ".$rows[1].", ".$rows[3];
41
-                    
42
-                    $schedule="";
43
-                    $mode="";
44
-                    
45
-                    if (isset($rows[8])) {
46
-                        if (AddressBookLocation::validateScheduleMode($rows[8])) {
47
-                            $schedule='"mode":"'.$rows[8].'",'; 
48
-                            $mode=$rows[8];
49
-                        }
50
-                        else {echo "$iRow --> Wrong schedule mode parameter <br>"; $schedule="";}
51
-                    }
52
-                    else {echo "$iRow --> The schedule mode parameter is not set <br>"; $schedule="";}
53
-                    
54
-                    if ($schedule=="") {$iRow++; continue;}
55
-                    
56
-                    if (isset($rows[9])) {
57
-                        if (AddressBookLocation::validateScheduleEnable($rows[9])) { 
58
-                            $schedule.='"enabled":'.$rows[9].',';
59
-                        }
60
-                        else {echo "$iRow --> The schedule enabled parameter is not set <br>"; $schedule="";}
61
-                    }
62
-                    
63
-                    if ($schedule=="") {$iRow++; continue;}
64
-                    
65
-                    if (isset($rows[10])) {
66
-                        if (AddressBookLocation::validateScheduleEvery($rows[10])) {
67
-                            $schedule.='"'.$mode.'":{'.'"every":'.$rows[10].','; 
68
-                            if ($mode=='daily') {
69
-                                $schedule=trim($schedule,',');
70
-                                $schedule.='}';
71
-                            }
72
-                        }
73
-                        else {echo "$iRow --> The parameter sched_every is not set <br>"; $schedule=""; }
74
-                    }
75
-                    
76
-                    if ($schedule=="") {$iRow++; continue;}
77
-                    
78
-                    if ($mode!='daily') {
79
-                        switch ($mode) {
80
-                            case 'weekly':
81
-                                if (isset($rows[11])) {
82
-                                    if (AddressBookLocation::validateScheduleWeekDays($rows[11])) {
83
-                                         $schedule.='"weekdays":['.$rows[11].']}';
84
-                                    }
85
-                                    else {echo "$iRow --> Wrong weekdays <br>";$schedule="";}
86
-                                }
87
-                                else {echo "$iRow --> The parameters sched_weekdays is not set <br>"; $schedule="";}
88
-                                break;
89
-                            case 'monthly':
90
-                                $monthlyMode="";
91
-                                if (isset($rows[12])) {
92
-                                    if (AddressBookLocation::validateScheduleMonthlyMode($rows[12])) {
93
-                                         $monthlyMode=$rows[12];
94
-                                         $schedule.='"mode": "'.$rows[12].'",';
95
-                                    }
96
-                                    else {echo "$iRow --> Wrong monthly mode <br>"; $schedule="";}
97
-                                }
98
-                                else {echo "$iRow --> The parameter sched_monthly_mode is not set <br>"; $schedule="";}
39
+			if ($rows[0] && $rows[1] && $rows[3] && array(null) !== $rows) { // ignore blank lines
40
+					//$data1 = $rows[0].", ".$rows[1].", ".$rows[3];
41
+                    
42
+					$schedule="";
43
+					$mode="";
44
+                    
45
+					if (isset($rows[8])) {
46
+						if (AddressBookLocation::validateScheduleMode($rows[8])) {
47
+							$schedule='"mode":"'.$rows[8].'",'; 
48
+							$mode=$rows[8];
49
+						}
50
+						else {echo "$iRow --> Wrong schedule mode parameter <br>"; $schedule="";}
51
+					}
52
+					else {echo "$iRow --> The schedule mode parameter is not set <br>"; $schedule="";}
53
+                    
54
+					if ($schedule=="") {$iRow++; continue;}
55
+                    
56
+					if (isset($rows[9])) {
57
+						if (AddressBookLocation::validateScheduleEnable($rows[9])) { 
58
+							$schedule.='"enabled":'.$rows[9].',';
59
+						}
60
+						else {echo "$iRow --> The schedule enabled parameter is not set <br>"; $schedule="";}
61
+					}
62
+                    
63
+					if ($schedule=="") {$iRow++; continue;}
64
+                    
65
+					if (isset($rows[10])) {
66
+						if (AddressBookLocation::validateScheduleEvery($rows[10])) {
67
+							$schedule.='"'.$mode.'":{'.'"every":'.$rows[10].','; 
68
+							if ($mode=='daily') {
69
+								$schedule=trim($schedule,',');
70
+								$schedule.='}';
71
+							}
72
+						}
73
+						else {echo "$iRow --> The parameter sched_every is not set <br>"; $schedule=""; }
74
+					}
75
+                    
76
+					if ($schedule=="") {$iRow++; continue;}
77
+                    
78
+					if ($mode!='daily') {
79
+						switch ($mode) {
80
+							case 'weekly':
81
+								if (isset($rows[11])) {
82
+									if (AddressBookLocation::validateScheduleWeekDays($rows[11])) {
83
+										 $schedule.='"weekdays":['.$rows[11].']}';
84
+									}
85
+									else {echo "$iRow --> Wrong weekdays <br>";$schedule="";}
86
+								}
87
+								else {echo "$iRow --> The parameters sched_weekdays is not set <br>"; $schedule="";}
88
+								break;
89
+							case 'monthly':
90
+								$monthlyMode="";
91
+								if (isset($rows[12])) {
92
+									if (AddressBookLocation::validateScheduleMonthlyMode($rows[12])) {
93
+										 $monthlyMode=$rows[12];
94
+										 $schedule.='"mode": "'.$rows[12].'",';
95
+									}
96
+									else {echo "$iRow --> Wrong monthly mode <br>"; $schedule="";}
97
+								}
98
+								else {echo "$iRow --> The parameter sched_monthly_mode is not set <br>"; $schedule="";}
99 99
                                 
100
-                                if ($monthlyMode!="") {
101
-                                    switch ($monthlyMode) {
102
-                                        case 'dates':
103
-                                            if (isset($rows[13])) {
104
-                                                if (AddressBookLocation::validateScheduleMonthlyDates($rows[13])) {
105
-                                                     $schedule.='"dates":['.$rows[13].']}';
106
-                                                }
107
-                                                else {echo "$iRow --> Wrong monthly dates <br>"; $schedule="";}
108
-                                            }
109
-                                            break;
110
-                                        case 'nth':
111
-                                            if (isset($rows[16])) {
112
-                                                if (AddressBookLocation::validateScheduleNthN($rows[16])) {
113
-                                                     $schedule.='"nth":{"n":'.$rows[16].',';
114
-                                                }
115
-                                                else {echo "$iRow --> Wrong parameter sched_nth_n <br>"; $schedule="";}
116
-                                            }
117
-                                            else {echo "$iRow --> The parameter sched_nth_n is not set <br>"; $schedule="";}
100
+								if ($monthlyMode!="") {
101
+									switch ($monthlyMode) {
102
+										case 'dates':
103
+											if (isset($rows[13])) {
104
+												if (AddressBookLocation::validateScheduleMonthlyDates($rows[13])) {
105
+													 $schedule.='"dates":['.$rows[13].']}';
106
+												}
107
+												else {echo "$iRow --> Wrong monthly dates <br>"; $schedule="";}
108
+											}
109
+											break;
110
+										case 'nth':
111
+											if (isset($rows[16])) {
112
+												if (AddressBookLocation::validateScheduleNthN($rows[16])) {
113
+													 $schedule.='"nth":{"n":'.$rows[16].',';
114
+												}
115
+												else {echo "$iRow --> Wrong parameter sched_nth_n <br>"; $schedule="";}
116
+											}
117
+											else {echo "$iRow --> The parameter sched_nth_n is not set <br>"; $schedule="";}
118 118
                                             
119
-                                            if ($schedule!="") {
120
-                                                if (isset($rows[17])) {
121
-                                                    if (AddressBookLocation::validateScheduleNthWhat($rows[17])) {
122
-                                                         $schedule.='"what":'.$rows[17].'}}';
123
-                                                    }
124
-                                                    else {echo "$iRow --> Wrong parameter sched_nth_what <br>"; $schedule="";}
125
-                                                }
126
-                                                else {echo "$iRow --> The parameter sched_nth_what is not set <br>"; $schedule="";}
127
-                                            }
119
+											if ($schedule!="") {
120
+												if (isset($rows[17])) {
121
+													if (AddressBookLocation::validateScheduleNthWhat($rows[17])) {
122
+														 $schedule.='"what":'.$rows[17].'}}';
123
+													}
124
+													else {echo "$iRow --> Wrong parameter sched_nth_what <br>"; $schedule="";}
125
+												}
126
+												else {echo "$iRow --> The parameter sched_nth_what is not set <br>"; $schedule="";}
127
+											}
128 128
                                             
129
-                                            break;
130
-                                    }
131
-                                }
132
-                                break;
133
-                            default:
134
-                                $schedule=="";
135
-                                break;
136
-                        }
129
+											break;
130
+									}
131
+								}
132
+								break;
133
+							default:
134
+								$schedule=="";
135
+								break;
136
+						}
137 137
                         
138
-                    }
138
+					}
139 139
                     
140
-                    if ($schedule=="") {$iRow++; continue;}
140
+					if ($schedule=="") {$iRow++; continue;}
141 141
                     
142
-                    $schedule=strtolower($schedule);
142
+					$schedule=strtolower($schedule);
143 143
                     
144
-                    $schedule='[{'.$schedule.'}]';
144
+					$schedule='[{'.$schedule.'}]';
145 145
 
146
-                    //echo "$iRow --> ".$schedule."<br>";
147
-                    $oSchedule= json_decode($schedule,TRUE);
148
-                    
149
-                    //echo "<br>"; var_dump($oSchedule); echo "<br>";
150
-                    
151
-                    $AdressBookLocationParameters=AddressBookLocation::fromArray(array(
152
-                        "cached_lat"    => $rows[0],
153
-                        "cached_lng"    => $rows[1],
154
-                        "address_alias"     => $rows[2],
155
-                        "address_1"     => $rows[3],
156
-                        "address_city"     => isset($rows[4]) ? $rows[4] : null,
157
-                        "address_state_id"     => isset($rows[5]) ? $rows[5] : null,
158
-                        "address_zip"     => isset($rows[6]) ? "$rows[6]" : null,
159
-                        "address_phone_number"  => isset($rows[7]) ? $rows[7] : null,
160
-                        "schedule" => isset($oSchedule) ? $oSchedule : null,
161
-                    ));
162
-                    
163
-                    $abContacts=new AddressBookLocation();
146
+					//echo "$iRow --> ".$schedule."<br>";
147
+					$oSchedule= json_decode($schedule,TRUE);
148
+                    
149
+					//echo "<br>"; var_dump($oSchedule); echo "<br>";
150
+                    
151
+					$AdressBookLocationParameters=AddressBookLocation::fromArray(array(
152
+						"cached_lat"    => $rows[0],
153
+						"cached_lng"    => $rows[1],
154
+						"address_alias"     => $rows[2],
155
+						"address_1"     => $rows[3],
156
+						"address_city"     => isset($rows[4]) ? $rows[4] : null,
157
+						"address_state_id"     => isset($rows[5]) ? $rows[5] : null,
158
+						"address_zip"     => isset($rows[6]) ? "$rows[6]" : null,
159
+						"address_phone_number"  => isset($rows[7]) ? $rows[7] : null,
160
+						"schedule" => isset($oSchedule) ? $oSchedule : null,
161
+					));
162
+                    
163
+					$abContacts=new AddressBookLocation();
164 164
     
165
-                    $abcResults=$abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry
166
-                    
167
-                    echo "The schedule location with address_id = ".strval($abcResults["address_id"])." added successfuly <br>"; //temporarry
168
-              }
169
-              else echo "$iRow --> Wrong Address or latitude or longitude <br>";
170
-              $iRow++;
171
-            }
172
-    }
165
+					$abcResults=$abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry
166
+                    
167
+					echo "The schedule location with address_id = ".strval($abcResults["address_id"])." added successfuly <br>"; //temporarry
168
+			  }
169
+			  else echo "$iRow --> Wrong Address or latitude or longitude <br>";
170
+			  $iRow++;
171
+			}
172
+	}
173 173
 
174 174
 /* Get Hybrid Optimization */
175 175
 
176
-    $ep = time()+604800;
177
-    $sched_date = date("Y-m-d", $ep);
176
+	$ep = time()+604800;
177
+	$sched_date = date("Y-m-d", $ep);
178 178
 
179
-    $hybridParams = array(
180
-        "target_date_string" => $sched_date,
181
-        "timezone_offset_minutes" => 480
182
-    );
179
+	$hybridParams = array(
180
+		"target_date_string" => $sched_date,
181
+		"timezone_offset_minutes" => 480
182
+	);
183 183
     
184
-    $optimization = new OptimizationProblem(); 
185
-    $hybridOptimization = $optimization->getHybridOptimization($hybridParams);
184
+	$optimization = new OptimizationProblem(); 
185
+	$hybridOptimization = $optimization->getHybridOptimization($hybridParams);
186 186
     
187
-    if ($hybridOptimization!=null) {
187
+	if ($hybridOptimization!=null) {
188 188
         
189
-        if (isset($hybridOptimization['optimization_problem_id'])) {
190
-            $optid = $hybridOptimization['optimization_problem_id'];
189
+		if (isset($hybridOptimization['optimization_problem_id'])) {
190
+			$optid = $hybridOptimization['optimization_problem_id'];
191 191
             
192
-            echo "Hibrid optimization with optimization_problem_id=$optid <br><br>";
192
+			echo "Hibrid optimization with optimization_problem_id=$optid <br><br>";
193 193
             
194
-            /* Add depots to the Hybrid Optimization */
195
-            $depotfile = "depots.csv";
194
+			/* Add depots to the Hybrid Optimization */
195
+			$depotfile = "depots.csv";
196 196
             
197
-            if (($handle = fopen("$depotfile", "r")) !== FALSE) {
197
+			if (($handle = fopen("$depotfile", "r")) !== FALSE) {
198 198
                 
199
-                $columns = fgetcsv($handle, $max_line_length, $delemietr);
199
+				$columns = fgetcsv($handle, $max_line_length, $delemietr);
200 200
                 
201
-                if (!$columns) {
202
-                    $error['message'] = 'Empty';
203
-                     return ($error);
204
-                }
201
+				if (!$columns) {
202
+					$error['message'] = 'Empty';
203
+					 return ($error);
204
+				}
205 205
                 
206
-                $depotsParams = array(
207
-                    'optimization_problem_id' => $optid,
208
-                    'delete_old_depots'  => true,
209
-                );
206
+				$depotsParams = array(
207
+					'optimization_problem_id' => $optid,
208
+					'delete_old_depots'  => true,
209
+				);
210 210
                 
211
-                $iRow=1;
212
-                $depotAddresses = array();
211
+				$iRow=1;
212
+				$depotAddresses = array();
213 213
                 
214
-                while (($rows = fgetcsv($handle, $max_line_length, $delemietr)) !== false) {
215
-                    if ($rows[0] && $rows[1] && $rows[3] && array(null) !== $rows) {
216
-                        $depotAddress['lat']= $rows[0];
217
-                        $depotAddress['lng']= $rows[1];
218
-                        $depotAddress['address']= $rows[3];   
219
-                        array_push($depotAddresses,$depotAddress);
220
-                    }
221
-                }
214
+				while (($rows = fgetcsv($handle, $max_line_length, $delemietr)) !== false) {
215
+					if ($rows[0] && $rows[1] && $rows[3] && array(null) !== $rows) {
216
+						$depotAddress['lat']= $rows[0];
217
+						$depotAddress['lng']= $rows[1];
218
+						$depotAddress['address']= $rows[3];   
219
+						array_push($depotAddresses,$depotAddress);
220
+					}
221
+				}
222 222
                 
223
-                $depotsParams['new_depots'] = $depotAddresses;
223
+				$depotsParams['new_depots'] = $depotAddresses;
224 224
                 
225
-                $optProblem = new OptimizationProblem();
225
+				$optProblem = new OptimizationProblem();
226 226
                 
227
-                $resultDepots = $optProblem->addDepotsToHybrid($depotsParams);
227
+				$resultDepots = $optProblem->addDepotsToHybrid($depotsParams);
228 228
                 
229
-                var_dump($resultDepots);
229
+				var_dump($resultDepots);
230 230
                 
231
-                /* Reoptimize hybrid optimization */
231
+				/* Reoptimize hybrid optimization */
232 232
                 
233
-                if ($resultDepots!=null) {
234
-                    $problemParams = array(
235
-                        'optimization_problem_id'  =>  $optid
236
-                    );
237
-                    $problem = OptimizationProblem::reoptimize($problemParams);
238
-                    
239
-                    Route4Me::simplePrint($problem);
240
-                }
241
-            }
233
+				if ($resultDepots!=null) {
234
+					$problemParams = array(
235
+						'optimization_problem_id'  =>  $optid
236
+					);
237
+					$problem = OptimizationProblem::reoptimize($problemParams);
238
+                    
239
+					Route4Me::simplePrint($problem);
240
+				}
241
+			}
242 242
                 
243
-        }
243
+		}
244 244
 
245
-    }
245
+	}
246 246
 ?>
247 247
\ No newline at end of file
Please login to merge, or discard this patch.
Switch Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -77,62 +77,62 @@
 block discarded – undo
77 77
                     
78 78
                     if ($mode!='daily') {
79 79
                         switch ($mode) {
80
-                            case 'weekly':
81
-                                if (isset($rows[11])) {
82
-                                    if (AddressBookLocation::validateScheduleWeekDays($rows[11])) {
83
-                                         $schedule.='"weekdays":['.$rows[11].']}';
84
-                                    }
85
-                                    else {echo "$iRow --> Wrong weekdays <br>";$schedule="";}
80
+                        case 'weekly':
81
+                            if (isset($rows[11])) {
82
+                                if (AddressBookLocation::validateScheduleWeekDays($rows[11])) {
83
+                                     $schedule.='"weekdays":['.$rows[11].']}';
86 84
                                 }
87
-                                else {echo "$iRow --> The parameters sched_weekdays is not set <br>"; $schedule="";}
88
-                                break;
89
-                            case 'monthly':
90
-                                $monthlyMode="";
91
-                                if (isset($rows[12])) {
92
-                                    if (AddressBookLocation::validateScheduleMonthlyMode($rows[12])) {
93
-                                         $monthlyMode=$rows[12];
94
-                                         $schedule.='"mode": "'.$rows[12].'",';
95
-                                    }
96
-                                    else {echo "$iRow --> Wrong monthly mode <br>"; $schedule="";}
85
+                                else {echo "$iRow --> Wrong weekdays <br>";$schedule="";}
86
+                            }
87
+                            else {echo "$iRow --> The parameters sched_weekdays is not set <br>"; $schedule="";}
88
+                            break;
89
+                        case 'monthly':
90
+                            $monthlyMode="";
91
+                            if (isset($rows[12])) {
92
+                                if (AddressBookLocation::validateScheduleMonthlyMode($rows[12])) {
93
+                                     $monthlyMode=$rows[12];
94
+                                     $schedule.='"mode": "'.$rows[12].'",';
97 95
                                 }
98
-                                else {echo "$iRow --> The parameter sched_monthly_mode is not set <br>"; $schedule="";}
96
+                                else {echo "$iRow --> Wrong monthly mode <br>"; $schedule="";}
97
+                            }
98
+                            else {echo "$iRow --> The parameter sched_monthly_mode is not set <br>"; $schedule="";}
99 99
                                 
100
-                                if ($monthlyMode!="") {
101
-                                    switch ($monthlyMode) {
102
-                                        case 'dates':
103
-                                            if (isset($rows[13])) {
104
-                                                if (AddressBookLocation::validateScheduleMonthlyDates($rows[13])) {
105
-                                                     $schedule.='"dates":['.$rows[13].']}';
106
-                                                }
107
-                                                else {echo "$iRow --> Wrong monthly dates <br>"; $schedule="";}
108
-                                            }
109
-                                            break;
110
-                                        case 'nth':
111
-                                            if (isset($rows[16])) {
112
-                                                if (AddressBookLocation::validateScheduleNthN($rows[16])) {
113
-                                                     $schedule.='"nth":{"n":'.$rows[16].',';
114
-                                                }
115
-                                                else {echo "$iRow --> Wrong parameter sched_nth_n <br>"; $schedule="";}
116
-                                            }
117
-                                            else {echo "$iRow --> The parameter sched_nth_n is not set <br>"; $schedule="";}
118
-                                            
119
-                                            if ($schedule!="") {
120
-                                                if (isset($rows[17])) {
121
-                                                    if (AddressBookLocation::validateScheduleNthWhat($rows[17])) {
122
-                                                         $schedule.='"what":'.$rows[17].'}}';
123
-                                                    }
124
-                                                    else {echo "$iRow --> Wrong parameter sched_nth_what <br>"; $schedule="";}
125
-                                                }
126
-                                                else {echo "$iRow --> The parameter sched_nth_what is not set <br>"; $schedule="";}
127
-                                            }
100
+                            if ($monthlyMode!="") {
101
+                                switch ($monthlyMode) {
102
+                                case 'dates':
103
+                                if (isset($rows[13])) {
104
+                                if (AddressBookLocation::validateScheduleMonthlyDates($rows[13])) {
105
+                                     $schedule.='"dates":['.$rows[13].']}';
106
+                                }
107
+                                else {echo "$iRow --> Wrong monthly dates <br>"; $schedule="";}
108
+                                }
109
+                                break;
110
+                                case 'nth':
111
+                                if (isset($rows[16])) {
112
+                                if (AddressBookLocation::validateScheduleNthN($rows[16])) {
113
+                                     $schedule.='"nth":{"n":'.$rows[16].',';
114
+                                }
115
+                                else {echo "$iRow --> Wrong parameter sched_nth_n <br>"; $schedule="";}
116
+                                }
117
+                                else {echo "$iRow --> The parameter sched_nth_n is not set <br>"; $schedule="";}
128 118
                                             
129
-                                            break;
119
+                                if ($schedule!="") {
120
+                                if (isset($rows[17])) {
121
+                                    if (AddressBookLocation::validateScheduleNthWhat($rows[17])) {
122
+                                         $schedule.='"what":'.$rows[17].'}}';
130 123
                                     }
124
+                                    else {echo "$iRow --> Wrong parameter sched_nth_what <br>"; $schedule="";}
125
+                                }
126
+                                else {echo "$iRow --> The parameter sched_nth_what is not set <br>"; $schedule="";}
131 127
                                 }
128
+                                            
132 129
                                 break;
133
-                            default:
134
-                                $schedule=="";
130
+                                }
131
+                                }
135 132
                                 break;
133
+                        default:
134
+                            $schedule=="";
135
+                            break;
136 136
                         }
137 137
                         
138 138
                     }
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace Route4Me;
3 3
 
4
-$vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
4
+$vdir = $_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
5 5
 
6 6
 require $vdir.'/../vendor/autoload.php';
7 7
 
@@ -17,113 +17,113 @@  discard block
 block discarded – undo
17 17
 
18 18
 Route4Me::setApiKey('11111111111111111111111111111111');
19 19
 
20
-$source_file="addresses_1000.csv";
20
+$source_file = "addresses_1000.csv";
21 21
 $max_line_length = 512;
22
-$delemietr=',';
22
+$delemietr = ',';
23 23
 
24 24
 
25 25
 /* Add Address Book Locations with schedules */
26 26
 
27
-if (($handle = fopen("$source_file", "r")) !== FALSE) {
27
+if (($handle = fopen("$source_file", "r"))!==FALSE) {
28 28
         $columns = fgetcsv($handle, $max_line_length, $delemietr);
29 29
         if (!$columns) {
30 30
             $error['message'] = 'Empty';
31 31
              return ($error);
32 32
         }
33 33
         
34
-        $iRow=1;
34
+        $iRow = 1;
35 35
         
36
-        while (($rows = fgetcsv($handle, $max_line_length, $delemietr)) !== false) {
36
+        while (($rows = fgetcsv($handle, $max_line_length, $delemietr))!==false) {
37 37
             //if ($iRow==1) {$iRow++; continue;}
38 38
             
39
-            if ($rows[0] && $rows[1] && $rows[3] && array(null) !== $rows) { // ignore blank lines
39
+            if ($rows[0] && $rows[1] && $rows[3] && array(null)!==$rows) { // ignore blank lines
40 40
                     //$data1 = $rows[0].", ".$rows[1].", ".$rows[3];
41 41
                     
42
-                    $schedule="";
43
-                    $mode="";
42
+                    $schedule = "";
43
+                    $mode = "";
44 44
                     
45 45
                     if (isset($rows[8])) {
46 46
                         if (AddressBookLocation::validateScheduleMode($rows[8])) {
47
-                            $schedule='"mode":"'.$rows[8].'",'; 
48
-                            $mode=$rows[8];
47
+                            $schedule = '"mode":"'.$rows[8].'",'; 
48
+                            $mode = $rows[8];
49 49
                         }
50
-                        else {echo "$iRow --> Wrong schedule mode parameter <br>"; $schedule="";}
50
+                        else {echo "$iRow --> Wrong schedule mode parameter <br>"; $schedule = ""; }
51 51
                     }
52
-                    else {echo "$iRow --> The schedule mode parameter is not set <br>"; $schedule="";}
52
+                    else {echo "$iRow --> The schedule mode parameter is not set <br>"; $schedule = ""; }
53 53
                     
54
-                    if ($schedule=="") {$iRow++; continue;}
54
+                    if ($schedule=="") {$iRow++; continue; }
55 55
                     
56 56
                     if (isset($rows[9])) {
57 57
                         if (AddressBookLocation::validateScheduleEnable($rows[9])) { 
58
-                            $schedule.='"enabled":'.$rows[9].',';
58
+                            $schedule .= '"enabled":'.$rows[9].',';
59 59
                         }
60
-                        else {echo "$iRow --> The schedule enabled parameter is not set <br>"; $schedule="";}
60
+                        else {echo "$iRow --> The schedule enabled parameter is not set <br>"; $schedule = ""; }
61 61
                     }
62 62
                     
63
-                    if ($schedule=="") {$iRow++; continue;}
63
+                    if ($schedule=="") {$iRow++; continue; }
64 64
                     
65 65
                     if (isset($rows[10])) {
66 66
                         if (AddressBookLocation::validateScheduleEvery($rows[10])) {
67
-                            $schedule.='"'.$mode.'":{'.'"every":'.$rows[10].','; 
67
+                            $schedule .= '"'.$mode.'":{'.'"every":'.$rows[10].','; 
68 68
                             if ($mode=='daily') {
69
-                                $schedule=trim($schedule,',');
70
-                                $schedule.='}';
69
+                                $schedule = trim($schedule, ',');
70
+                                $schedule .= '}';
71 71
                             }
72 72
                         }
73
-                        else {echo "$iRow --> The parameter sched_every is not set <br>"; $schedule=""; }
73
+                        else {echo "$iRow --> The parameter sched_every is not set <br>"; $schedule = ""; }
74 74
                     }
75 75
                     
76
-                    if ($schedule=="") {$iRow++; continue;}
76
+                    if ($schedule=="") {$iRow++; continue; }
77 77
                     
78 78
                     if ($mode!='daily') {
79 79
                         switch ($mode) {
80 80
                             case 'weekly':
81 81
                                 if (isset($rows[11])) {
82 82
                                     if (AddressBookLocation::validateScheduleWeekDays($rows[11])) {
83
-                                         $schedule.='"weekdays":['.$rows[11].']}';
83
+                                         $schedule .= '"weekdays":['.$rows[11].']}';
84 84
                                     }
85
-                                    else {echo "$iRow --> Wrong weekdays <br>";$schedule="";}
85
+                                    else {echo "$iRow --> Wrong weekdays <br>"; $schedule = ""; }
86 86
                                 }
87
-                                else {echo "$iRow --> The parameters sched_weekdays is not set <br>"; $schedule="";}
87
+                                else {echo "$iRow --> The parameters sched_weekdays is not set <br>"; $schedule = ""; }
88 88
                                 break;
89 89
                             case 'monthly':
90
-                                $monthlyMode="";
90
+                                $monthlyMode = "";
91 91
                                 if (isset($rows[12])) {
92 92
                                     if (AddressBookLocation::validateScheduleMonthlyMode($rows[12])) {
93
-                                         $monthlyMode=$rows[12];
94
-                                         $schedule.='"mode": "'.$rows[12].'",';
93
+                                         $monthlyMode = $rows[12];
94
+                                         $schedule .= '"mode": "'.$rows[12].'",';
95 95
                                     }
96
-                                    else {echo "$iRow --> Wrong monthly mode <br>"; $schedule="";}
96
+                                    else {echo "$iRow --> Wrong monthly mode <br>"; $schedule = ""; }
97 97
                                 }
98
-                                else {echo "$iRow --> The parameter sched_monthly_mode is not set <br>"; $schedule="";}
98
+                                else {echo "$iRow --> The parameter sched_monthly_mode is not set <br>"; $schedule = ""; }
99 99
                                 
100 100
                                 if ($monthlyMode!="") {
101 101
                                     switch ($monthlyMode) {
102 102
                                         case 'dates':
103 103
                                             if (isset($rows[13])) {
104 104
                                                 if (AddressBookLocation::validateScheduleMonthlyDates($rows[13])) {
105
-                                                     $schedule.='"dates":['.$rows[13].']}';
105
+                                                     $schedule .= '"dates":['.$rows[13].']}';
106 106
                                                 }
107
-                                                else {echo "$iRow --> Wrong monthly dates <br>"; $schedule="";}
107
+                                                else {echo "$iRow --> Wrong monthly dates <br>"; $schedule = ""; }
108 108
                                             }
109 109
                                             break;
110 110
                                         case 'nth':
111 111
                                             if (isset($rows[16])) {
112 112
                                                 if (AddressBookLocation::validateScheduleNthN($rows[16])) {
113
-                                                     $schedule.='"nth":{"n":'.$rows[16].',';
113
+                                                     $schedule .= '"nth":{"n":'.$rows[16].',';
114 114
                                                 }
115
-                                                else {echo "$iRow --> Wrong parameter sched_nth_n <br>"; $schedule="";}
115
+                                                else {echo "$iRow --> Wrong parameter sched_nth_n <br>"; $schedule = ""; }
116 116
                                             }
117
-                                            else {echo "$iRow --> The parameter sched_nth_n is not set <br>"; $schedule="";}
117
+                                            else {echo "$iRow --> The parameter sched_nth_n is not set <br>"; $schedule = ""; }
118 118
                                             
119 119
                                             if ($schedule!="") {
120 120
                                                 if (isset($rows[17])) {
121 121
                                                     if (AddressBookLocation::validateScheduleNthWhat($rows[17])) {
122
-                                                         $schedule.='"what":'.$rows[17].'}}';
122
+                                                         $schedule .= '"what":'.$rows[17].'}}';
123 123
                                                     }
124
-                                                    else {echo "$iRow --> Wrong parameter sched_nth_what <br>"; $schedule="";}
124
+                                                    else {echo "$iRow --> Wrong parameter sched_nth_what <br>"; $schedule = ""; }
125 125
                                                 }
126
-                                                else {echo "$iRow --> The parameter sched_nth_what is not set <br>"; $schedule="";}
126
+                                                else {echo "$iRow --> The parameter sched_nth_what is not set <br>"; $schedule = ""; }
127 127
                                             }
128 128
                                             
129 129
                                             break;
@@ -137,18 +137,18 @@  discard block
 block discarded – undo
137 137
                         
138 138
                     }
139 139
                     
140
-                    if ($schedule=="") {$iRow++; continue;}
140
+                    if ($schedule=="") {$iRow++; continue; }
141 141
                     
142
-                    $schedule=strtolower($schedule);
142
+                    $schedule = strtolower($schedule);
143 143
                     
144
-                    $schedule='[{'.$schedule.'}]';
144
+                    $schedule = '[{'.$schedule.'}]';
145 145
 
146 146
                     //echo "$iRow --> ".$schedule."<br>";
147
-                    $oSchedule= json_decode($schedule,TRUE);
147
+                    $oSchedule = json_decode($schedule, TRUE);
148 148
                     
149 149
                     //echo "<br>"; var_dump($oSchedule); echo "<br>";
150 150
                     
151
-                    $AdressBookLocationParameters=AddressBookLocation::fromArray(array(
151
+                    $AdressBookLocationParameters = AddressBookLocation::fromArray(array(
152 152
                         "cached_lat"    => $rows[0],
153 153
                         "cached_lng"    => $rows[1],
154 154
                         "address_alias"     => $rows[2],
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
                         "schedule" => isset($oSchedule) ? $oSchedule : null,
161 161
                     ));
162 162
                     
163
-                    $abContacts=new AddressBookLocation();
163
+                    $abContacts = new AddressBookLocation();
164 164
     
165
-                    $abcResults=$abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry
165
+                    $abcResults = $abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry
166 166
                     
167 167
                     echo "The schedule location with address_id = ".strval($abcResults["address_id"])." added successfuly <br>"; //temporarry
168 168
               }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
 /* Get Hybrid Optimization */
175 175
 
176
-    $ep = time()+604800;
176
+    $ep = time() + 604800;
177 177
     $sched_date = date("Y-m-d", $ep);
178 178
 
179 179
     $hybridParams = array(
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
             /* Add depots to the Hybrid Optimization */
195 195
             $depotfile = "depots.csv";
196 196
             
197
-            if (($handle = fopen("$depotfile", "r")) !== FALSE) {
197
+            if (($handle = fopen("$depotfile", "r"))!==FALSE) {
198 198
                 
199 199
                 $columns = fgetcsv($handle, $max_line_length, $delemietr);
200 200
                 
@@ -208,15 +208,15 @@  discard block
 block discarded – undo
208 208
                     'delete_old_depots'  => true,
209 209
                 );
210 210
                 
211
-                $iRow=1;
211
+                $iRow = 1;
212 212
                 $depotAddresses = array();
213 213
                 
214
-                while (($rows = fgetcsv($handle, $max_line_length, $delemietr)) !== false) {
215
-                    if ($rows[0] && $rows[1] && $rows[3] && array(null) !== $rows) {
216
-                        $depotAddress['lat']= $rows[0];
217
-                        $depotAddress['lng']= $rows[1];
218
-                        $depotAddress['address']= $rows[3];   
219
-                        array_push($depotAddresses,$depotAddress);
214
+                while (($rows = fgetcsv($handle, $max_line_length, $delemietr))!==false) {
215
+                    if ($rows[0] && $rows[1] && $rows[3] && array(null)!==$rows) {
216
+                        $depotAddress['lat'] = $rows[0];
217
+                        $depotAddress['lng'] = $rows[1];
218
+                        $depotAddress['address'] = $rows[3];   
219
+                        array_push($depotAddresses, $depotAddress);
220 220
                     }
221 221
                 }
222 222
                 
Please login to merge, or discard this patch.
Braces   +15 added lines, -27 removed lines patch added patch discarded remove patch
@@ -46,18 +46,15 @@  discard block
 block discarded – undo
46 46
                         if (AddressBookLocation::validateScheduleMode($rows[8])) {
47 47
                             $schedule='"mode":"'.$rows[8].'",'; 
48 48
                             $mode=$rows[8];
49
-                        }
50
-                        else {echo "$iRow --> Wrong schedule mode parameter <br>"; $schedule="";}
51
-                    }
52
-                    else {echo "$iRow --> The schedule mode parameter is not set <br>"; $schedule="";}
49
+                        } else {echo "$iRow --> Wrong schedule mode parameter <br>"; $schedule="";}
50
+                    } else {echo "$iRow --> The schedule mode parameter is not set <br>"; $schedule="";}
53 51
                     
54 52
                     if ($schedule=="") {$iRow++; continue;}
55 53
                     
56 54
                     if (isset($rows[9])) {
57 55
                         if (AddressBookLocation::validateScheduleEnable($rows[9])) { 
58 56
                             $schedule.='"enabled":'.$rows[9].',';
59
-                        }
60
-                        else {echo "$iRow --> The schedule enabled parameter is not set <br>"; $schedule="";}
57
+                        } else {echo "$iRow --> The schedule enabled parameter is not set <br>"; $schedule="";}
61 58
                     }
62 59
                     
63 60
                     if ($schedule=="") {$iRow++; continue;}
@@ -69,8 +66,7 @@  discard block
 block discarded – undo
69 66
                                 $schedule=trim($schedule,',');
70 67
                                 $schedule.='}';
71 68
                             }
72
-                        }
73
-                        else {echo "$iRow --> The parameter sched_every is not set <br>"; $schedule=""; }
69
+                        } else {echo "$iRow --> The parameter sched_every is not set <br>"; $schedule=""; }
74 70
                     }
75 71
                     
76 72
                     if ($schedule=="") {$iRow++; continue;}
@@ -81,10 +77,8 @@  discard block
 block discarded – undo
81 77
                                 if (isset($rows[11])) {
82 78
                                     if (AddressBookLocation::validateScheduleWeekDays($rows[11])) {
83 79
                                          $schedule.='"weekdays":['.$rows[11].']}';
84
-                                    }
85
-                                    else {echo "$iRow --> Wrong weekdays <br>";$schedule="";}
86
-                                }
87
-                                else {echo "$iRow --> The parameters sched_weekdays is not set <br>"; $schedule="";}
80
+                                    } else {echo "$iRow --> Wrong weekdays <br>";$schedule="";}
81
+                                } else {echo "$iRow --> The parameters sched_weekdays is not set <br>"; $schedule="";}
88 82
                                 break;
89 83
                             case 'monthly':
90 84
                                 $monthlyMode="";
@@ -92,10 +86,8 @@  discard block
 block discarded – undo
92 86
                                     if (AddressBookLocation::validateScheduleMonthlyMode($rows[12])) {
93 87
                                          $monthlyMode=$rows[12];
94 88
                                          $schedule.='"mode": "'.$rows[12].'",';
95
-                                    }
96
-                                    else {echo "$iRow --> Wrong monthly mode <br>"; $schedule="";}
97
-                                }
98
-                                else {echo "$iRow --> The parameter sched_monthly_mode is not set <br>"; $schedule="";}
89
+                                    } else {echo "$iRow --> Wrong monthly mode <br>"; $schedule="";}
90
+                                } else {echo "$iRow --> The parameter sched_monthly_mode is not set <br>"; $schedule="";}
99 91
                                 
100 92
                                 if ($monthlyMode!="") {
101 93
                                     switch ($monthlyMode) {
@@ -103,27 +95,22 @@  discard block
 block discarded – undo
103 95
                                             if (isset($rows[13])) {
104 96
                                                 if (AddressBookLocation::validateScheduleMonthlyDates($rows[13])) {
105 97
                                                      $schedule.='"dates":['.$rows[13].']}';
106
-                                                }
107
-                                                else {echo "$iRow --> Wrong monthly dates <br>"; $schedule="";}
98
+                                                } else {echo "$iRow --> Wrong monthly dates <br>"; $schedule="";}
108 99
                                             }
109 100
                                             break;
110 101
                                         case 'nth':
111 102
                                             if (isset($rows[16])) {
112 103
                                                 if (AddressBookLocation::validateScheduleNthN($rows[16])) {
113 104
                                                      $schedule.='"nth":{"n":'.$rows[16].',';
114
-                                                }
115
-                                                else {echo "$iRow --> Wrong parameter sched_nth_n <br>"; $schedule="";}
116
-                                            }
117
-                                            else {echo "$iRow --> The parameter sched_nth_n is not set <br>"; $schedule="";}
105
+                                                } else {echo "$iRow --> Wrong parameter sched_nth_n <br>"; $schedule="";}
106
+                                            } else {echo "$iRow --> The parameter sched_nth_n is not set <br>"; $schedule="";}
118 107
                                             
119 108
                                             if ($schedule!="") {
120 109
                                                 if (isset($rows[17])) {
121 110
                                                     if (AddressBookLocation::validateScheduleNthWhat($rows[17])) {
122 111
                                                          $schedule.='"what":'.$rows[17].'}}';
123
-                                                    }
124
-                                                    else {echo "$iRow --> Wrong parameter sched_nth_what <br>"; $schedule="";}
125
-                                                }
126
-                                                else {echo "$iRow --> The parameter sched_nth_what is not set <br>"; $schedule="";}
112
+                                                    } else {echo "$iRow --> Wrong parameter sched_nth_what <br>"; $schedule="";}
113
+                                                } else {echo "$iRow --> The parameter sched_nth_what is not set <br>"; $schedule="";}
127 114
                                             }
128 115
                                             
129 116
                                             break;
@@ -165,8 +152,9 @@  discard block
 block discarded – undo
165 152
                     $abcResults=$abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry
166 153
                     
167 154
                     echo "The schedule location with address_id = ".strval($abcResults["address_id"])." added successfuly <br>"; //temporarry
155
+              } else {
156
+              	echo "$iRow --> Wrong Address or latitude or longitude <br>";
168 157
               }
169
-              else echo "$iRow --> Wrong Address or latitude or longitude <br>";
170 158
               $iRow++;
171 159
             }
172 160
     }
Please login to merge, or discard this patch.
src/Route4Me/AddressBookLocation.php 3 patches
Indentation   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
 		public $address_zip;
24 24
 		public $cached_lat;
25 25
 		public $cached_lng;
26
-        public $curbside_lat;
27
-        public $curbside_lng;
26
+		public $curbside_lat;
27
+		public $curbside_lng;
28 28
 		public $color;
29
-        public $address_custom_data;
30
-        public $schedule;
29
+		public $address_custom_data;
30
+		public $schedule;
31 31
 		
32 32
 		//public $offset;
33 33
 		//public $limit;
@@ -36,242 +36,242 @@  discard block
 block discarded – undo
36 36
 		
37 37
 		public static function fromArray(array $params) {
38 38
 			$addressbooklocation = new AddressBookLocation();
39
-	        foreach($params as $key => $value) {
40
-	            if (property_exists($addressbooklocation, $key)) {
41
-	                $addressbooklocation->{$key} = $value;
42
-	            }
39
+			foreach($params as $key => $value) {
40
+				if (property_exists($addressbooklocation, $key)) {
41
+					$addressbooklocation->{$key} = $value;
42
+				}
43 43
 			}
44 44
 			
45 45
 			return $addressbooklocation;
46 46
 		}
47 47
 		
48 48
 		public static function getAddressBookLocation($addressId)
49
-	    {
50
-	    	$ablocations = Route4Me::makeRequst(array(
51
-	            'url'    => self::$apiUrl,
52
-	            'method' => 'GET',
53
-	            'query'  => array(
54
-	                'query' => $addressId,
55
-	                'limit' => 30
56
-	            )
57
-	        ));
49
+		{
50
+			$ablocations = Route4Me::makeRequst(array(
51
+				'url'    => self::$apiUrl,
52
+				'method' => 'GET',
53
+				'query'  => array(
54
+					'query' => $addressId,
55
+					'limit' => 30
56
+				)
57
+			));
58 58
 
59 59
 			return $ablocations;
60 60
 		}
61 61
 		
62 62
 		public static function searchRoutedLocation($params)
63
-	    {
64
-	    	$result= Route4Me::makeRequst(array(
65
-	            'url'    => self::$apiUrl,
66
-	            'method' => 'GET',
67
-	            'query'  => array(
68
-	                'display' => isset($params['display']) ? $params['display']: null,
69
-	                'query' => isset($params['query']) ? $params['query']: null,
70
-	                'fields' => isset($params['fields']) ? $params['fields']: null,
71
-	                'limit' => isset($params['limit']) ? $params['limit']: null,
72
-	                'offset' => isset($params['offset']) ? $params['offset'] : null,
73
-	            )
74
-	        ));
63
+		{
64
+			$result= Route4Me::makeRequst(array(
65
+				'url'    => self::$apiUrl,
66
+				'method' => 'GET',
67
+				'query'  => array(
68
+					'display' => isset($params['display']) ? $params['display']: null,
69
+					'query' => isset($params['query']) ? $params['query']: null,
70
+					'fields' => isset($params['fields']) ? $params['fields']: null,
71
+					'limit' => isset($params['limit']) ? $params['limit']: null,
72
+					'offset' => isset($params['offset']) ? $params['offset'] : null,
73
+				)
74
+			));
75 75
 
76 76
 			return $result;
77 77
 		}
78 78
 		
79 79
 		public static function getAddressBookLocations($params)
80
-	    {
81
-	    	$ablocations = Route4Me::makeRequst(array(
82
-	            'url'    => self::$apiUrl,
83
-	            'method' => 'GET',
84
-	            'query'  => array(
85
-	                'limit' => isset($params->limit) ? $params->limit: null,
86
-	                'offset' => isset($params->offset) ? $params->offset : null,
87
-	            )
88
-	        ));
80
+		{
81
+			$ablocations = Route4Me::makeRequst(array(
82
+				'url'    => self::$apiUrl,
83
+				'method' => 'GET',
84
+				'query'  => array(
85
+					'limit' => isset($params->limit) ? $params->limit: null,
86
+					'offset' => isset($params->offset) ? $params->offset : null,
87
+				)
88
+			));
89 89
 
90 90
 			return $ablocations;
91 91
 		}
92 92
 		
93 93
 		public static function getAddressBookLocationsByIds($ids)
94
-	    {
95
-	    	$ablocations = Route4Me::makeRequst(array(
96
-	            'url'    => self::$apiUrl,
97
-	            'method' => 'GET',
98
-	            'query'  => array(
99
-	                'address_id' => $ids
100
-	            )
101
-	        ));
94
+		{
95
+			$ablocations = Route4Me::makeRequst(array(
96
+				'url'    => self::$apiUrl,
97
+				'method' => 'GET',
98
+				'query'  => array(
99
+					'address_id' => $ids
100
+				)
101
+			));
102 102
 
103 103
 			return $ablocations;
104 104
 		}
105 105
 		
106 106
 		public static function addAdressBookLocation($params)
107
-	    {
108
-	    	$ablocations = Route4Me::makeRequst(array(
109
-	            'url'    => self::$apiUrl,
110
-	            'method' => 'POST',
111
-	            'body'  => array(
112
-	            	'address_1' => 	isset($params->address_1) ? $params->address_1: null,
113
-	            	'address_2' =>    isset($params->address_2) ? $params->address_2: null,
114
-	            	'address_alias' =>    isset($params->address_alias) ? $params->address_alias: null,
115
-	                'first_name' => isset($params->first_name) ? $params->first_name : null,
116
-	                'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null,
117
-	                'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null,
118
-	                'curbside_lat' => isset($params->curbside_lat) ? $params->curbside_lat : null,
119
-                    'curbside_lng' => isset($params->curbside_lng) ? $params->curbside_lng : null,
120
-	                'address_phone_number' =>    isset($params->address_phone_number) ? $params->address_phone_number: null,
121
-	                'address_group' =>    isset($params->address_group) ? $params->address_group: null,
122
-	                'first_name' =>    isset($params->first_name) ? $params->first_name: null,
123
-	                'last_name' =>    isset($params->last_name) ? $params->last_name: null,
124
-                    'local_time_window_start' =>    isset($params->local_time_window_start) ? $params->local_time_window_start: null,
125
-                    'local_time_window_end' =>    isset($params->local_time_window_end) ? $params->local_time_window_end: null,
126
-                    'local_time_window_start_2' =>    isset($params->local_time_window_start_2) ? $params->local_time_window_start_2: null,
127
-                    'local_time_window_end_2' =>    isset($params->local_time_window_end_2) ? $params->local_time_window_end_2: null,
128
-	                'address_email' =>    isset($params->address_email) ? $params->address_email: null,
129
-	                'address_city' =>    isset($params->address_city) ? $params->address_city: null,
130
-	                'address_state_id' =>    isset($params->address_state_id) ? $params->address_state_id: null,
131
-	                'address_country_id' =>    isset($params->address_country_id) ? $params->address_country_id: null,
132
-	                'address_zip' =>    isset($params->address_zip) ? $params->address_zip: null,
133
-	                'address_custom_data' =>    isset($params->address_custom_data) ? $params->address_custom_data: null,
134
-	                'schedule' =>    isset($params->schedule) ? $params->schedule: null,
135
-	                'schedule_blacklist' =>    isset($params->schedule_blacklist) ? $params->schedule_blacklist: null,
136
-	                'service_time' =>    isset($params->service_time) ? $params->service_time: null,
137
-	                'local_timezone_string' =>    isset($params->local_timezone_string) ? $params->local_timezone_string: null,
138
-	                'color' =>    isset($params->color) ? $params->color: null,
139
-	                'address_icon' =>    isset($params->address_icon) ? $params->address_icon: null,
140
-	                'address_stop_type' =>    isset($params->address_stop_type) ? $params->address_stop_type: null,
141
-	                'address_cube' =>    isset($params->address_cube) ? $params->address_cube: null,
142
-	                'address_pieces' =>    isset($params->address_pieces) ? $params->address_pieces: null,
143
-	                'address_reference_no' =>    isset($params->address_reference_no) ? $params->address_reference_no: null,
144
-	                'address_revenue' =>    isset($params->address_revenue) ? $params->address_revenue: null,
145
-	                'address_weight' =>    isset($params->address_weight) ? $params->address_weight: null,
146
-	                'address_priority' =>    isset($params->address_priority) ? $params->address_priority: null,
147
-	                'address_customer_po' =>    isset($params->address_customer_po) ? $params->address_customer_po: null,
148
-	            )
149
-	        ));
107
+		{
108
+			$ablocations = Route4Me::makeRequst(array(
109
+				'url'    => self::$apiUrl,
110
+				'method' => 'POST',
111
+				'body'  => array(
112
+					'address_1' => 	isset($params->address_1) ? $params->address_1: null,
113
+					'address_2' =>    isset($params->address_2) ? $params->address_2: null,
114
+					'address_alias' =>    isset($params->address_alias) ? $params->address_alias: null,
115
+					'first_name' => isset($params->first_name) ? $params->first_name : null,
116
+					'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null,
117
+					'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null,
118
+					'curbside_lat' => isset($params->curbside_lat) ? $params->curbside_lat : null,
119
+					'curbside_lng' => isset($params->curbside_lng) ? $params->curbside_lng : null,
120
+					'address_phone_number' =>    isset($params->address_phone_number) ? $params->address_phone_number: null,
121
+					'address_group' =>    isset($params->address_group) ? $params->address_group: null,
122
+					'first_name' =>    isset($params->first_name) ? $params->first_name: null,
123
+					'last_name' =>    isset($params->last_name) ? $params->last_name: null,
124
+					'local_time_window_start' =>    isset($params->local_time_window_start) ? $params->local_time_window_start: null,
125
+					'local_time_window_end' =>    isset($params->local_time_window_end) ? $params->local_time_window_end: null,
126
+					'local_time_window_start_2' =>    isset($params->local_time_window_start_2) ? $params->local_time_window_start_2: null,
127
+					'local_time_window_end_2' =>    isset($params->local_time_window_end_2) ? $params->local_time_window_end_2: null,
128
+					'address_email' =>    isset($params->address_email) ? $params->address_email: null,
129
+					'address_city' =>    isset($params->address_city) ? $params->address_city: null,
130
+					'address_state_id' =>    isset($params->address_state_id) ? $params->address_state_id: null,
131
+					'address_country_id' =>    isset($params->address_country_id) ? $params->address_country_id: null,
132
+					'address_zip' =>    isset($params->address_zip) ? $params->address_zip: null,
133
+					'address_custom_data' =>    isset($params->address_custom_data) ? $params->address_custom_data: null,
134
+					'schedule' =>    isset($params->schedule) ? $params->schedule: null,
135
+					'schedule_blacklist' =>    isset($params->schedule_blacklist) ? $params->schedule_blacklist: null,
136
+					'service_time' =>    isset($params->service_time) ? $params->service_time: null,
137
+					'local_timezone_string' =>    isset($params->local_timezone_string) ? $params->local_timezone_string: null,
138
+					'color' =>    isset($params->color) ? $params->color: null,
139
+					'address_icon' =>    isset($params->address_icon) ? $params->address_icon: null,
140
+					'address_stop_type' =>    isset($params->address_stop_type) ? $params->address_stop_type: null,
141
+					'address_cube' =>    isset($params->address_cube) ? $params->address_cube: null,
142
+					'address_pieces' =>    isset($params->address_pieces) ? $params->address_pieces: null,
143
+					'address_reference_no' =>    isset($params->address_reference_no) ? $params->address_reference_no: null,
144
+					'address_revenue' =>    isset($params->address_revenue) ? $params->address_revenue: null,
145
+					'address_weight' =>    isset($params->address_weight) ? $params->address_weight: null,
146
+					'address_priority' =>    isset($params->address_priority) ? $params->address_priority: null,
147
+					'address_customer_po' =>    isset($params->address_customer_po) ? $params->address_customer_po: null,
148
+				)
149
+			));
150 150
 
151 151
 			return $ablocations;
152 152
 		}
153 153
 		
154 154
 		public function deleteAdressBookLocation($address_ids)
155
-	    {
156
-	        $address = Route4Me::makeRequst(array(
157
-	            'url'    => self::$apiUrl,
158
-	            'method' => 'DELETEARRAY',
159
-	            'query'  => array(
160
-	                'address_ids'     => $address_ids
161
-	            )
162
-	        ));
155
+		{
156
+			$address = Route4Me::makeRequst(array(
157
+				'url'    => self::$apiUrl,
158
+				'method' => 'DELETEARRAY',
159
+				'query'  => array(
160
+					'address_ids'     => $address_ids
161
+				)
162
+			));
163 163
 	
164
-	        return $address;
165
-	    }
164
+			return $address;
165
+		}
166 166
 		
167 167
 		public function updateAdressBookLocation($params)
168
-	    {
169
-	    	//echo "address_id --> ".$params["address_id"]."<br";
170
-	        $address = Route4Me::makeRequst(array(
171
-	            'url'    => self::$apiUrl,
172
-	            'method' => 'PUT',
173
-	            'query'   => $params,
168
+		{
169
+			//echo "address_id --> ".$params["address_id"]."<br";
170
+			$address = Route4Me::makeRequst(array(
171
+				'url'    => self::$apiUrl,
172
+				'method' => 'PUT',
173
+				'query'   => $params,
174 174
 
175
-	        ));
175
+			));
176 176
 	
177
-	        return $address;
178
-	    }
177
+			return $address;
178
+		}
179 179
 			
180 180
 		public static function get($params)
181
-	    {
182
-	    	$ablocations = Route4Me::makeRequst(array(
183
-	            'url'    => self::$apiUrl,
184
-	            'method' => 'ADD',
185
-	            'query'  => array(
186
-	                'first_name' => isset($params->first_name) ? $params->first_name : null,
187
-	                'address_1' => isset($params->address_1) ? $params->address_1: null,
188
-	                'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null,
189
-	                'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null,
190
-	            )
191
-	        ));
181
+		{
182
+			$ablocations = Route4Me::makeRequst(array(
183
+				'url'    => self::$apiUrl,
184
+				'method' => 'ADD',
185
+				'query'  => array(
186
+					'first_name' => isset($params->first_name) ? $params->first_name : null,
187
+					'address_1' => isset($params->address_1) ? $params->address_1: null,
188
+					'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null,
189
+					'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null,
190
+				)
191
+			));
192 192
 
193 193
 			return $ablocations;
194 194
 		}
195 195
         
196
-        public static function validateScheduleMode($scheduleMode)
197
-        {
198
-            $schedMmodes=array("daily","weekly","monthly","annually");
196
+		public static function validateScheduleMode($scheduleMode)
197
+		{
198
+			$schedMmodes=array("daily","weekly","monthly","annually");
199 199
             
200
-            if (in_array($scheduleMode, $schedMmodes)) return TRUE; else return FALSE;
201
-        }
200
+			if (in_array($scheduleMode, $schedMmodes)) return TRUE; else return FALSE;
201
+		}
202 202
         
203
-        public static function validateScheduleEnable($scheduleEnabled)
204
-        {
205
-            $schedEnambles=array(TRUE,FALSE);
203
+		public static function validateScheduleEnable($scheduleEnabled)
204
+		{
205
+			$schedEnambles=array(TRUE,FALSE);
206 206
             
207
-            if (in_array($scheduleEnabled, $schedEnambles)) return TRUE; else return FALSE;
208
-        }
207
+			if (in_array($scheduleEnabled, $schedEnambles)) return TRUE; else return FALSE;
208
+		}
209 209
         
210
-        public static function validateScheduleEvery($scheduleEvery)
211
-        {
212
-            if (is_numeric($scheduleEvery)) return TRUE; else return FALSE;
213
-        }
210
+		public static function validateScheduleEvery($scheduleEvery)
211
+		{
212
+			if (is_numeric($scheduleEvery)) return TRUE; else return FALSE;
213
+		}
214 214
         
215
-        public static function validateScheduleWeekDays($scheduleWeekDays)
216
-        {
217
-            $weekdays = explode(',', $scheduleWeekDays);
215
+		public static function validateScheduleWeekDays($scheduleWeekDays)
216
+		{
217
+			$weekdays = explode(',', $scheduleWeekDays);
218 218
             
219
-            if (sizeof($weekdays)<1) return FALSE;
219
+			if (sizeof($weekdays)<1) return FALSE;
220 220
             
221
-            $isValid=TRUE;
221
+			$isValid=TRUE;
222 222
             
223
-            for ($i=0; $i < sizeof($weekdays); $i++) { 
224
-                if (is_numeric($weekdays[$i])) {
225
-                    $wday=intval($weekdays[$i]);
226
-                    if ($wday<1 || $wday>7) $isValid=FALSE;
227
-                }
228
-                else $isValid=FALSE;
229
-            }
230
-            //echo $scheduleWeekDays.' --- '. $isValid."<br>";
231
-            return $isValid;
232
-        }
223
+			for ($i=0; $i < sizeof($weekdays); $i++) { 
224
+				if (is_numeric($weekdays[$i])) {
225
+					$wday=intval($weekdays[$i]);
226
+					if ($wday<1 || $wday>7) $isValid=FALSE;
227
+				}
228
+				else $isValid=FALSE;
229
+			}
230
+			//echo $scheduleWeekDays.' --- '. $isValid."<br>";
231
+			return $isValid;
232
+		}
233 233
         
234
-        public static function validateScheduleMonthlyMode($scheduleMonthlyMode)
235
-        {
236
-            $schedMonthlyMmodes=array("dates","nth");
234
+		public static function validateScheduleMonthlyMode($scheduleMonthlyMode)
235
+		{
236
+			$schedMonthlyMmodes=array("dates","nth");
237 237
             
238
-            if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes)) return TRUE; else return FALSE;
239
-        }
238
+			if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes)) return TRUE; else return FALSE;
239
+		}
240 240
         
241
-        public static function validateScheduleMonthlyDates($scheduleMonthlyDates)
242
-        {
243
-            $monthlyDates = explode(',', $scheduleMonthlyDates);
241
+		public static function validateScheduleMonthlyDates($scheduleMonthlyDates)
242
+		{
243
+			$monthlyDates = explode(',', $scheduleMonthlyDates);
244 244
             
245
-            if (sizeof($monthlyDates)<1) return FALSE;
245
+			if (sizeof($monthlyDates)<1) return FALSE;
246 246
             
247
-            $isValid=TRUE;
247
+			$isValid=TRUE;
248 248
             
249
-            for ($i=0; $i < sizeof($monthlyDates); $i++) { 
250
-                if (is_numeric($monthlyDates[$i])) {
251
-                    $mday=intval($monthlyDates[$i]);
252
-                    if ($mday<1 || $mday>31) $isValid=FALSE;
253
-                }
254
-                else $isValid=FALSE;
255
-            }
256
-            //echo $scheduleMonthlyDates.' --- '. $isValid."<br>";
257
-            return $isValid;
258
-        }
249
+			for ($i=0; $i < sizeof($monthlyDates); $i++) { 
250
+				if (is_numeric($monthlyDates[$i])) {
251
+					$mday=intval($monthlyDates[$i]);
252
+					if ($mday<1 || $mday>31) $isValid=FALSE;
253
+				}
254
+				else $isValid=FALSE;
255
+			}
256
+			//echo $scheduleMonthlyDates.' --- '. $isValid."<br>";
257
+			return $isValid;
258
+		}
259 259
         
260
-        public static function validateScheduleNthN($scheduleNthN)
261
-        {
262
-            if (!is_numeric($scheduleNthN)) return FALSE;
260
+		public static function validateScheduleNthN($scheduleNthN)
261
+		{
262
+			if (!is_numeric($scheduleNthN)) return FALSE;
263 263
             
264
-            $schedNthNs=array(1,2,3,4,5,-1);
265
-            if (in_array($scheduleNthN, $schedNthNs)) return TRUE; else return FALSE;
266
-        }
264
+			$schedNthNs=array(1,2,3,4,5,-1);
265
+			if (in_array($scheduleNthN, $schedNthNs)) return TRUE; else return FALSE;
266
+		}
267 267
         
268
-        public static function validateScheduleNthWhat($scheduleNthWhat)
269
-        {
270
-            if (!is_numeric($scheduleNthWhat)) return FALSE;
268
+		public static function validateScheduleNthWhat($scheduleNthWhat)
269
+		{
270
+			if (!is_numeric($scheduleNthWhat)) return FALSE;
271 271
             
272
-            $schedNthWhats=array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
273
-            if (in_array($scheduleNthWhat, $schedNthWhats)) return TRUE; else return FALSE;
274
-        }
272
+			$schedNthWhats=array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
273
+			if (in_array($scheduleNthWhat, $schedNthWhats)) return TRUE; else return FALSE;
274
+		}
275 275
 	}
276 276
 	
277 277
 ?>
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 		//public $offset;
33 33
 		//public $limit;
34 34
 		
35
-		public function __construct () {  }
35
+		public function __construct() {  }
36 36
 		
37 37
 		public static function fromArray(array $params) {
38 38
 			$addressbooklocation = new AddressBookLocation();
39
-	        foreach($params as $key => $value) {
39
+	        foreach ($params as $key => $value) {
40 40
 	            if (property_exists($addressbooklocation, $key)) {
41 41
 	                $addressbooklocation->{$key} = $value;
42 42
 	            }
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
 		
62 62
 		public static function searchRoutedLocation($params)
63 63
 	    {
64
-	    	$result= Route4Me::makeRequst(array(
64
+	    	$result = Route4Me::makeRequst(array(
65 65
 	            'url'    => self::$apiUrl,
66 66
 	            'method' => 'GET',
67 67
 	            'query'  => array(
68
-	                'display' => isset($params['display']) ? $params['display']: null,
69
-	                'query' => isset($params['query']) ? $params['query']: null,
70
-	                'fields' => isset($params['fields']) ? $params['fields']: null,
71
-	                'limit' => isset($params['limit']) ? $params['limit']: null,
68
+	                'display' => isset($params['display']) ? $params['display'] : null,
69
+	                'query' => isset($params['query']) ? $params['query'] : null,
70
+	                'fields' => isset($params['fields']) ? $params['fields'] : null,
71
+	                'limit' => isset($params['limit']) ? $params['limit'] : null,
72 72
 	                'offset' => isset($params['offset']) ? $params['offset'] : null,
73 73
 	            )
74 74
 	        ));
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	            'url'    => self::$apiUrl,
83 83
 	            'method' => 'GET',
84 84
 	            'query'  => array(
85
-	                'limit' => isset($params->limit) ? $params->limit: null,
85
+	                'limit' => isset($params->limit) ? $params->limit : null,
86 86
 	                'offset' => isset($params->offset) ? $params->offset : null,
87 87
 	            )
88 88
 	        ));
@@ -109,42 +109,42 @@  discard block
 block discarded – undo
109 109
 	            'url'    => self::$apiUrl,
110 110
 	            'method' => 'POST',
111 111
 	            'body'  => array(
112
-	            	'address_1' => 	isset($params->address_1) ? $params->address_1: null,
113
-	            	'address_2' =>    isset($params->address_2) ? $params->address_2: null,
114
-	            	'address_alias' =>    isset($params->address_alias) ? $params->address_alias: null,
112
+	            	'address_1' => 	isset($params->address_1) ? $params->address_1 : null,
113
+	            	'address_2' =>    isset($params->address_2) ? $params->address_2 : null,
114
+	            	'address_alias' =>    isset($params->address_alias) ? $params->address_alias : null,
115 115
 	                'first_name' => isset($params->first_name) ? $params->first_name : null,
116 116
 	                'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null,
117 117
 	                'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null,
118 118
 	                'curbside_lat' => isset($params->curbside_lat) ? $params->curbside_lat : null,
119 119
                     'curbside_lng' => isset($params->curbside_lng) ? $params->curbside_lng : null,
120
-	                'address_phone_number' =>    isset($params->address_phone_number) ? $params->address_phone_number: null,
121
-	                'address_group' =>    isset($params->address_group) ? $params->address_group: null,
122
-	                'first_name' =>    isset($params->first_name) ? $params->first_name: null,
123
-	                'last_name' =>    isset($params->last_name) ? $params->last_name: null,
124
-                    'local_time_window_start' =>    isset($params->local_time_window_start) ? $params->local_time_window_start: null,
125
-                    'local_time_window_end' =>    isset($params->local_time_window_end) ? $params->local_time_window_end: null,
126
-                    'local_time_window_start_2' =>    isset($params->local_time_window_start_2) ? $params->local_time_window_start_2: null,
127
-                    'local_time_window_end_2' =>    isset($params->local_time_window_end_2) ? $params->local_time_window_end_2: null,
128
-	                'address_email' =>    isset($params->address_email) ? $params->address_email: null,
129
-	                'address_city' =>    isset($params->address_city) ? $params->address_city: null,
130
-	                'address_state_id' =>    isset($params->address_state_id) ? $params->address_state_id: null,
131
-	                'address_country_id' =>    isset($params->address_country_id) ? $params->address_country_id: null,
132
-	                'address_zip' =>    isset($params->address_zip) ? $params->address_zip: null,
133
-	                'address_custom_data' =>    isset($params->address_custom_data) ? $params->address_custom_data: null,
134
-	                'schedule' =>    isset($params->schedule) ? $params->schedule: null,
135
-	                'schedule_blacklist' =>    isset($params->schedule_blacklist) ? $params->schedule_blacklist: null,
136
-	                'service_time' =>    isset($params->service_time) ? $params->service_time: null,
137
-	                'local_timezone_string' =>    isset($params->local_timezone_string) ? $params->local_timezone_string: null,
138
-	                'color' =>    isset($params->color) ? $params->color: null,
139
-	                'address_icon' =>    isset($params->address_icon) ? $params->address_icon: null,
140
-	                'address_stop_type' =>    isset($params->address_stop_type) ? $params->address_stop_type: null,
141
-	                'address_cube' =>    isset($params->address_cube) ? $params->address_cube: null,
142
-	                'address_pieces' =>    isset($params->address_pieces) ? $params->address_pieces: null,
143
-	                'address_reference_no' =>    isset($params->address_reference_no) ? $params->address_reference_no: null,
144
-	                'address_revenue' =>    isset($params->address_revenue) ? $params->address_revenue: null,
145
-	                'address_weight' =>    isset($params->address_weight) ? $params->address_weight: null,
146
-	                'address_priority' =>    isset($params->address_priority) ? $params->address_priority: null,
147
-	                'address_customer_po' =>    isset($params->address_customer_po) ? $params->address_customer_po: null,
120
+	                'address_phone_number' =>    isset($params->address_phone_number) ? $params->address_phone_number : null,
121
+	                'address_group' =>    isset($params->address_group) ? $params->address_group : null,
122
+	                'first_name' =>    isset($params->first_name) ? $params->first_name : null,
123
+	                'last_name' =>    isset($params->last_name) ? $params->last_name : null,
124
+                    'local_time_window_start' =>    isset($params->local_time_window_start) ? $params->local_time_window_start : null,
125
+                    'local_time_window_end' =>    isset($params->local_time_window_end) ? $params->local_time_window_end : null,
126
+                    'local_time_window_start_2' =>    isset($params->local_time_window_start_2) ? $params->local_time_window_start_2 : null,
127
+                    'local_time_window_end_2' =>    isset($params->local_time_window_end_2) ? $params->local_time_window_end_2 : null,
128
+	                'address_email' =>    isset($params->address_email) ? $params->address_email : null,
129
+	                'address_city' =>    isset($params->address_city) ? $params->address_city : null,
130
+	                'address_state_id' =>    isset($params->address_state_id) ? $params->address_state_id : null,
131
+	                'address_country_id' =>    isset($params->address_country_id) ? $params->address_country_id : null,
132
+	                'address_zip' =>    isset($params->address_zip) ? $params->address_zip : null,
133
+	                'address_custom_data' =>    isset($params->address_custom_data) ? $params->address_custom_data : null,
134
+	                'schedule' =>    isset($params->schedule) ? $params->schedule : null,
135
+	                'schedule_blacklist' =>    isset($params->schedule_blacklist) ? $params->schedule_blacklist : null,
136
+	                'service_time' =>    isset($params->service_time) ? $params->service_time : null,
137
+	                'local_timezone_string' =>    isset($params->local_timezone_string) ? $params->local_timezone_string : null,
138
+	                'color' =>    isset($params->color) ? $params->color : null,
139
+	                'address_icon' =>    isset($params->address_icon) ? $params->address_icon : null,
140
+	                'address_stop_type' =>    isset($params->address_stop_type) ? $params->address_stop_type : null,
141
+	                'address_cube' =>    isset($params->address_cube) ? $params->address_cube : null,
142
+	                'address_pieces' =>    isset($params->address_pieces) ? $params->address_pieces : null,
143
+	                'address_reference_no' =>    isset($params->address_reference_no) ? $params->address_reference_no : null,
144
+	                'address_revenue' =>    isset($params->address_revenue) ? $params->address_revenue : null,
145
+	                'address_weight' =>    isset($params->address_weight) ? $params->address_weight : null,
146
+	                'address_priority' =>    isset($params->address_priority) ? $params->address_priority : null,
147
+	                'address_customer_po' =>    isset($params->address_customer_po) ? $params->address_customer_po : null,
148 148
 	            )
149 149
 	        ));
150 150
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	            'method' => 'ADD',
185 185
 	            'query'  => array(
186 186
 	                'first_name' => isset($params->first_name) ? $params->first_name : null,
187
-	                'address_1' => isset($params->address_1) ? $params->address_1: null,
187
+	                'address_1' => isset($params->address_1) ? $params->address_1 : null,
188 188
 	                'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null,
189 189
 	                'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null,
190 190
 	            )
@@ -195,14 +195,14 @@  discard block
 block discarded – undo
195 195
         
196 196
         public static function validateScheduleMode($scheduleMode)
197 197
         {
198
-            $schedMmodes=array("daily","weekly","monthly","annually");
198
+            $schedMmodes = array("daily", "weekly", "monthly", "annually");
199 199
             
200 200
             if (in_array($scheduleMode, $schedMmodes)) return TRUE; else return FALSE;
201 201
         }
202 202
         
203 203
         public static function validateScheduleEnable($scheduleEnabled)
204 204
         {
205
-            $schedEnambles=array(TRUE,FALSE);
205
+            $schedEnambles = array(TRUE, FALSE);
206 206
             
207 207
             if (in_array($scheduleEnabled, $schedEnambles)) return TRUE; else return FALSE;
208 208
         }
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
             
219 219
             if (sizeof($weekdays)<1) return FALSE;
220 220
             
221
-            $isValid=TRUE;
221
+            $isValid = TRUE;
222 222
             
223
-            for ($i=0; $i < sizeof($weekdays); $i++) { 
223
+            for ($i = 0; $i<sizeof($weekdays); $i++) { 
224 224
                 if (is_numeric($weekdays[$i])) {
225
-                    $wday=intval($weekdays[$i]);
226
-                    if ($wday<1 || $wday>7) $isValid=FALSE;
225
+                    $wday = intval($weekdays[$i]);
226
+                    if ($wday<1 || $wday>7) $isValid = FALSE;
227 227
                 }
228
-                else $isValid=FALSE;
228
+                else $isValid = FALSE;
229 229
             }
230 230
             //echo $scheduleWeekDays.' --- '. $isValid."<br>";
231 231
             return $isValid;
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
         
234 234
         public static function validateScheduleMonthlyMode($scheduleMonthlyMode)
235 235
         {
236
-            $schedMonthlyMmodes=array("dates","nth");
236
+            $schedMonthlyMmodes = array("dates", "nth");
237 237
             
238 238
             if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes)) return TRUE; else return FALSE;
239 239
         }
@@ -244,14 +244,14 @@  discard block
 block discarded – undo
244 244
             
245 245
             if (sizeof($monthlyDates)<1) return FALSE;
246 246
             
247
-            $isValid=TRUE;
247
+            $isValid = TRUE;
248 248
             
249
-            for ($i=0; $i < sizeof($monthlyDates); $i++) { 
249
+            for ($i = 0; $i<sizeof($monthlyDates); $i++) { 
250 250
                 if (is_numeric($monthlyDates[$i])) {
251
-                    $mday=intval($monthlyDates[$i]);
252
-                    if ($mday<1 || $mday>31) $isValid=FALSE;
251
+                    $mday = intval($monthlyDates[$i]);
252
+                    if ($mday<1 || $mday>31) $isValid = FALSE;
253 253
                 }
254
-                else $isValid=FALSE;
254
+                else $isValid = FALSE;
255 255
             }
256 256
             //echo $scheduleMonthlyDates.' --- '. $isValid."<br>";
257 257
             return $isValid;
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         {
262 262
             if (!is_numeric($scheduleNthN)) return FALSE;
263 263
             
264
-            $schedNthNs=array(1,2,3,4,5,-1);
264
+            $schedNthNs = array(1, 2, 3, 4, 5, -1);
265 265
             if (in_array($scheduleNthN, $schedNthNs)) return TRUE; else return FALSE;
266 266
         }
267 267
         
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
         {
270 270
             if (!is_numeric($scheduleNthWhat)) return FALSE;
271 271
             
272
-            $schedNthWhats=array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
272
+            $schedNthWhats = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
273 273
             if (in_array($scheduleNthWhat, $schedNthWhats)) return TRUE; else return FALSE;
274 274
         }
275 275
 	}
Please login to merge, or discard this patch.
Braces   +52 added lines, -14 removed lines patch added patch discarded remove patch
@@ -197,35 +197,52 @@  discard block
 block discarded – undo
197 197
         {
198 198
             $schedMmodes=array("daily","weekly","monthly","annually");
199 199
             
200
-            if (in_array($scheduleMode, $schedMmodes)) return TRUE; else return FALSE;
200
+            if (in_array($scheduleMode, $schedMmodes)) {
201
+            	return TRUE;
202
+            } else {
203
+            	return FALSE;
204
+            }
201 205
         }
202 206
         
203 207
         public static function validateScheduleEnable($scheduleEnabled)
204 208
         {
205 209
             $schedEnambles=array(TRUE,FALSE);
206 210
             
207
-            if (in_array($scheduleEnabled, $schedEnambles)) return TRUE; else return FALSE;
211
+            if (in_array($scheduleEnabled, $schedEnambles)) {
212
+            	return TRUE;
213
+            } else {
214
+            	return FALSE;
215
+            }
208 216
         }
209 217
         
210 218
         public static function validateScheduleEvery($scheduleEvery)
211 219
         {
212
-            if (is_numeric($scheduleEvery)) return TRUE; else return FALSE;
220
+            if (is_numeric($scheduleEvery)) {
221
+            	return TRUE;
222
+            } else {
223
+            	return FALSE;
224
+            }
213 225
         }
214 226
         
215 227
         public static function validateScheduleWeekDays($scheduleWeekDays)
216 228
         {
217 229
             $weekdays = explode(',', $scheduleWeekDays);
218 230
             
219
-            if (sizeof($weekdays)<1) return FALSE;
231
+            if (sizeof($weekdays)<1) {
232
+            	return FALSE;
233
+            }
220 234
             
221 235
             $isValid=TRUE;
222 236
             
223 237
             for ($i=0; $i < sizeof($weekdays); $i++) { 
224 238
                 if (is_numeric($weekdays[$i])) {
225 239
                     $wday=intval($weekdays[$i]);
226
-                    if ($wday<1 || $wday>7) $isValid=FALSE;
240
+                    if ($wday<1 || $wday>7) {
241
+                    	$isValid=FALSE;
242
+                    }
243
+                } else {
244
+                	$isValid=FALSE;
227 245
                 }
228
-                else $isValid=FALSE;
229 246
             }
230 247
             //echo $scheduleWeekDays.' --- '. $isValid."<br>";
231 248
             return $isValid;
@@ -235,23 +252,32 @@  discard block
 block discarded – undo
235 252
         {
236 253
             $schedMonthlyMmodes=array("dates","nth");
237 254
             
238
-            if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes)) return TRUE; else return FALSE;
255
+            if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes)) {
256
+            	return TRUE;
257
+            } else {
258
+            	return FALSE;
259
+            }
239 260
         }
240 261
         
241 262
         public static function validateScheduleMonthlyDates($scheduleMonthlyDates)
242 263
         {
243 264
             $monthlyDates = explode(',', $scheduleMonthlyDates);
244 265
             
245
-            if (sizeof($monthlyDates)<1) return FALSE;
266
+            if (sizeof($monthlyDates)<1) {
267
+            	return FALSE;
268
+            }
246 269
             
247 270
             $isValid=TRUE;
248 271
             
249 272
             for ($i=0; $i < sizeof($monthlyDates); $i++) { 
250 273
                 if (is_numeric($monthlyDates[$i])) {
251 274
                     $mday=intval($monthlyDates[$i]);
252
-                    if ($mday<1 || $mday>31) $isValid=FALSE;
275
+                    if ($mday<1 || $mday>31) {
276
+                    	$isValid=FALSE;
277
+                    }
278
+                } else {
279
+                	$isValid=FALSE;
253 280
                 }
254
-                else $isValid=FALSE;
255 281
             }
256 282
             //echo $scheduleMonthlyDates.' --- '. $isValid."<br>";
257 283
             return $isValid;
@@ -259,18 +285,30 @@  discard block
 block discarded – undo
259 285
         
260 286
         public static function validateScheduleNthN($scheduleNthN)
261 287
         {
262
-            if (!is_numeric($scheduleNthN)) return FALSE;
288
+            if (!is_numeric($scheduleNthN)) {
289
+            	return FALSE;
290
+            }
263 291
             
264 292
             $schedNthNs=array(1,2,3,4,5,-1);
265
-            if (in_array($scheduleNthN, $schedNthNs)) return TRUE; else return FALSE;
293
+            if (in_array($scheduleNthN, $schedNthNs)) {
294
+            	return TRUE;
295
+            } else {
296
+            	return FALSE;
297
+            }
266 298
         }
267 299
         
268 300
         public static function validateScheduleNthWhat($scheduleNthWhat)
269 301
         {
270
-            if (!is_numeric($scheduleNthWhat)) return FALSE;
302
+            if (!is_numeric($scheduleNthWhat)) {
303
+            	return FALSE;
304
+            }
271 305
             
272 306
             $schedNthWhats=array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
273
-            if (in_array($scheduleNthWhat, $schedNthWhats)) return TRUE; else return FALSE;
307
+            if (in_array($scheduleNthWhat, $schedNthWhats)) {
308
+            	return TRUE;
309
+            } else {
310
+            	return FALSE;
311
+            }
274 312
         }
275 313
 	}
276 314
 	
Please login to merge, or discard this patch.