GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Branch Editing-Fixing (c4d168)
by Igor
03:30
created
src/Route4Me/AddressBookLocation.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -143,6 +143,9 @@
 block discarded – undo
143 143
         return null;
144 144
     }
145 145
     
146
+    /**
147
+     * @param AddressBookLocation $params
148
+     */
146 149
     public static function addAdressBookLocation($params)
147 150
     {
148 151
         $body = array();
Please login to merge, or discard this patch.
Indentation   +470 added lines, -470 removed lines patch added patch discarded remove patch
@@ -6,549 +6,549 @@
 block discarded – undo
6 6
 
7 7
 class AddressBookLocation extends Common
8 8
 {
9
-    public $address_id;
10
-    public $address_group;
11
-    public $address_alias;
12
-    public $address_1;
13
-    public $address_2;
14
-    public $first_name;
15
-    public $last_name;
16
-    public $address_email;
17
-    public $address_phone_number;
18
-    public $address_city;
19
-    public $address_state_id;
20
-    public $address_country_id;
21
-    public $address_zip;
22
-    public $cached_lat;
23
-    public $cached_lng;
24
-    public $curbside_lat;
25
-    public $curbside_lng;
26
-    public $color;
27
-    public $address_custom_data;
28
-    public $schedule;
9
+	public $address_id;
10
+	public $address_group;
11
+	public $address_alias;
12
+	public $address_1;
13
+	public $address_2;
14
+	public $first_name;
15
+	public $last_name;
16
+	public $address_email;
17
+	public $address_phone_number;
18
+	public $address_city;
19
+	public $address_state_id;
20
+	public $address_country_id;
21
+	public $address_zip;
22
+	public $cached_lat;
23
+	public $cached_lng;
24
+	public $curbside_lat;
25
+	public $curbside_lng;
26
+	public $color;
27
+	public $address_custom_data;
28
+	public $schedule;
29 29
     
30
-    public $created_timestamp;
31
-    public $member_id;
32
-    public $schedule_blacklist;
33
-    public $in_route_count;
34
-    public $last_visited_timestamp;
35
-    public $last_routed_timestamp;
36
-    public $local_time_window_start;
37
-    public $local_time_window_end;
38
-    public $local_time_window_start_2;
39
-    public $local_time_window_end_2;
40
-    public $service_time;
41
-    public $local_timezone_string;
42
-    public $address_icon;
43
-    public $address_stop_type;
44
-    public $address_cube;
45
-    public $address_pieces;
46
-    public $address_reference_no;
47
-    public $address_revenue;
48
-    public $address_weight;
49
-    public $address_priority;
50
-    public $address_customer_po;
30
+	public $created_timestamp;
31
+	public $member_id;
32
+	public $schedule_blacklist;
33
+	public $in_route_count;
34
+	public $last_visited_timestamp;
35
+	public $last_routed_timestamp;
36
+	public $local_time_window_start;
37
+	public $local_time_window_end;
38
+	public $local_time_window_start_2;
39
+	public $local_time_window_end_2;
40
+	public $service_time;
41
+	public $local_timezone_string;
42
+	public $address_icon;
43
+	public $address_stop_type;
44
+	public $address_cube;
45
+	public $address_pieces;
46
+	public $address_reference_no;
47
+	public $address_revenue;
48
+	public $address_weight;
49
+	public $address_priority;
50
+	public $address_customer_po;
51 51
     
52
-    public static function fromArray(array $params)
53
-    {
54
-        $addressbooklocation = new AddressBookLocation();
52
+	public static function fromArray(array $params)
53
+	{
54
+		$addressbooklocation = new AddressBookLocation();
55 55
         
56
-        foreach($params as $key => $value) {
57
-            if (property_exists($addressbooklocation, $key)) {
58
-                $addressbooklocation->{$key} = $value;
59
-            }
60
-        }
56
+		foreach($params as $key => $value) {
57
+			if (property_exists($addressbooklocation, $key)) {
58
+				$addressbooklocation->{$key} = $value;
59
+			}
60
+		}
61 61
         
62
-        return $addressbooklocation;
63
-    }
62
+		return $addressbooklocation;
63
+	}
64 64
     
65
-    public static function getAddressBookLocation($addressId)
66
-    {
67
-        $ablocations = Route4Me::makeRequst(array(
68
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
69
-            'method' => 'GET',
70
-            'query'  => array(
71
-                'query' => $addressId,
72
-                'limit' => 30
73
-            )
74
-        ));
65
+	public static function getAddressBookLocation($addressId)
66
+	{
67
+		$ablocations = Route4Me::makeRequst(array(
68
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
69
+			'method' => 'GET',
70
+			'query'  => array(
71
+				'query' => $addressId,
72
+				'limit' => 30
73
+			)
74
+		));
75 75
 
76
-        return $ablocations;
77
-    }
76
+		return $ablocations;
77
+	}
78 78
     
79
-    public static function searchRoutedLocation($params)
80
-    {
81
-        $result= Route4Me::makeRequst(array(
82
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
83
-            'method' => 'GET',
84
-            'query'  => array(
85
-                'display' => isset($params['display']) ? $params['display'] : null,
86
-                'query'   => isset($params['query']) ? $params['query'] : null,
87
-                'fields'  => isset($params['fields']) ? $params['fields'] : null,
88
-                'limit'   => isset($params['limit']) ? $params['limit'] : null,
89
-                'offset'  => isset($params['offset']) ? $params['offset'] : null,
90
-            )
91
-        ));
79
+	public static function searchRoutedLocation($params)
80
+	{
81
+		$result= Route4Me::makeRequst(array(
82
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
83
+			'method' => 'GET',
84
+			'query'  => array(
85
+				'display' => isset($params['display']) ? $params['display'] : null,
86
+				'query'   => isset($params['query']) ? $params['query'] : null,
87
+				'fields'  => isset($params['fields']) ? $params['fields'] : null,
88
+				'limit'   => isset($params['limit']) ? $params['limit'] : null,
89
+				'offset'  => isset($params['offset']) ? $params['offset'] : null,
90
+			)
91
+		));
92 92
 
93
-        return $result;
94
-    }
93
+		return $result;
94
+	}
95 95
     
96
-    public static function getAddressBookLocations($params)
97
-    {
98
-        $ablocations = Route4Me::makeRequst(array(
99
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
100
-            'method' => 'GET',
101
-            'query'  => array(
102
-                'limit'  => isset($params['limit']) ? $params['limit'] : null,
103
-                'offset' => isset($params['offset']) ? $params['offset'] : null,
104
-            )
105
-        ));
96
+	public static function getAddressBookLocations($params)
97
+	{
98
+		$ablocations = Route4Me::makeRequst(array(
99
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
100
+			'method' => 'GET',
101
+			'query'  => array(
102
+				'limit'  => isset($params['limit']) ? $params['limit'] : null,
103
+				'offset' => isset($params['offset']) ? $params['offset'] : null,
104
+			)
105
+		));
106 106
 
107
-        return $ablocations;
108
-    }
107
+		return $ablocations;
108
+	}
109 109
     
110
-    public static function getAddressBookLocationsByIDs($ids)
111
-    {
112
-        $ablocations = Route4Me::makeRequst(array(
113
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
114
-            'method' => 'GET',
115
-            'query'  => array(
116
-                'address_id' => $ids
117
-            )
118
-        ));
110
+	public static function getAddressBookLocationsByIDs($ids)
111
+	{
112
+		$ablocations = Route4Me::makeRequst(array(
113
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
114
+			'method' => 'GET',
115
+			'query'  => array(
116
+				'address_id' => $ids
117
+			)
118
+		));
119 119
 
120
-        return $ablocations;
121
-    }
120
+		return $ablocations;
121
+	}
122 122
     
123
-    public static function getRandomAddressBookLocation($params)
124
-    {
125
-        $ablocations = Route4Me::makeRequst(array(
126
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
127
-            'method' => 'GET',
128
-            'query'  => array(
129
-                'limit'  => isset($params['limit']) ? $params['limit'] : 0,
130
-                'offset' => isset($params['offset']) ? $params['offset'] : 10,
131
-            )
132
-        ));
123
+	public static function getRandomAddressBookLocation($params)
124
+	{
125
+		$ablocations = Route4Me::makeRequst(array(
126
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
127
+			'method' => 'GET',
128
+			'query'  => array(
129
+				'limit'  => isset($params['limit']) ? $params['limit'] : 0,
130
+				'offset' => isset($params['offset']) ? $params['offset'] : 10,
131
+			)
132
+		));
133 133
         
134
-        if (isset($ablocations["results"])) {
135
-            $locationsSize = sizeof($ablocations["results"]);
134
+		if (isset($ablocations["results"])) {
135
+			$locationsSize = sizeof($ablocations["results"]);
136 136
             
137
-            if ($locationsSize > 0) {
138
-                $randomLocationIndex = rand(0, $locationsSize - 1);
139
-                return $ablocations["results"][$randomLocationIndex];
140
-            } 
141
-        } 
137
+			if ($locationsSize > 0) {
138
+				$randomLocationIndex = rand(0, $locationsSize - 1);
139
+				return $ablocations["results"][$randomLocationIndex];
140
+			} 
141
+		} 
142 142
 
143
-        return null;
144
-    }
143
+		return null;
144
+	}
145 145
     
146
-    public static function addAdressBookLocation($params)
147
-    {
148
-        $body = array();
149
-        $abLocations = new AddressBookLocation();
146
+	public static function addAdressBookLocation($params)
147
+	{
148
+		$body = array();
149
+		$abLocations = new AddressBookLocation();
150 150
         
151
-        foreach($params as $key => $value) {
152
-            if ($key == "address_id") continue; 
153
-            if (property_exists($abLocations, $key)) {
154
-                if (isset($params->{$key})) {
155
-                    $body[$key] = $params->{$key};
156
-                } 
157
-            }
158
-        }
151
+		foreach($params as $key => $value) {
152
+			if ($key == "address_id") continue; 
153
+			if (property_exists($abLocations, $key)) {
154
+				if (isset($params->{$key})) {
155
+					$body[$key] = $params->{$key};
156
+				} 
157
+			}
158
+		}
159 159
         
160
-        $response = Route4Me::makeRequst(array(
161
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
162
-            'method' => 'POST',
163
-            'body'   => $body
164
-        ));
160
+		$response = Route4Me::makeRequst(array(
161
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
162
+			'method' => 'POST',
163
+			'body'   => $body
164
+		));
165 165
 
166
-        return $response;
167
-    }
166
+		return $response;
167
+	}
168 168
     
169
-    public function deleteAdressBookLocation($address_ids)
170
-    {
171
-        $result = Route4Me::makeRequst(array(
172
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
173
-            'method' => 'DELETEARRAY',
174
-            'query'  => array(
175
-                'address_ids' => $address_ids
176
-            )
177
-        ));
169
+	public function deleteAdressBookLocation($address_ids)
170
+	{
171
+		$result = Route4Me::makeRequst(array(
172
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
173
+			'method' => 'DELETEARRAY',
174
+			'query'  => array(
175
+				'address_ids' => $address_ids
176
+			)
177
+		));
178 178
 
179
-        return $result;
180
-    }
179
+		return $result;
180
+	}
181 181
     
182
-    public function updateAdressBookLocation($params)
183
-    {
184
-        $body = array();
185
-        $abLocations = new AddressBookLocation();
182
+	public function updateAdressBookLocation($params)
183
+	{
184
+		$body = array();
185
+		$abLocations = new AddressBookLocation();
186 186
         
187
-        foreach($params as $key => $value) {
188
-            if (property_exists($abLocations, $key)) {
189
-                if (isset($params->{$key})) {
190
-                    $body[$key] = $params->{$key};
191
-                } 
192
-            }
193
-        }
187
+		foreach($params as $key => $value) {
188
+			if (property_exists($abLocations, $key)) {
189
+				if (isset($params->{$key})) {
190
+					$body[$key] = $params->{$key};
191
+				} 
192
+			}
193
+		}
194 194
 
195
-        $response = Route4Me::makeRequst(array(
196
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
197
-            'method' => 'PUT',
198
-            'body'   => $body,
199
-        ));
195
+		$response = Route4Me::makeRequst(array(
196
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
197
+			'method' => 'PUT',
198
+			'body'   => $body,
199
+		));
200 200
 
201
-        return $response;
202
-    }
201
+		return $response;
202
+	}
203 203
         
204
-    public static function get($params)
205
-    {
206
-        $ablocations = Route4Me::makeRequst(array(
207
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
208
-            'method' => 'ADD',
209
-            'query'  => array(
210
-                'first_name' => isset($params->first_name) ? $params->first_name : null,
211
-                'address_1'  => isset($params->address_1) ? $params->address_1 : null,
212
-                'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null,
213
-                'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null,
214
-            )
215
-        ));
204
+	public static function get($params)
205
+	{
206
+		$ablocations = Route4Me::makeRequst(array(
207
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
208
+			'method' => 'ADD',
209
+			'query'  => array(
210
+				'first_name' => isset($params->first_name) ? $params->first_name : null,
211
+				'address_1'  => isset($params->address_1) ? $params->address_1 : null,
212
+				'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null,
213
+				'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null,
214
+			)
215
+		));
216 216
 
217
-        return $ablocations;
218
-    }
217
+		return $ablocations;
218
+	}
219 219
     
220
-    public static function validateScheduleMode($scheduleMode)
221
-    {
222
-        $schedMmodes = array("daily","weekly","monthly","annually");
220
+	public static function validateScheduleMode($scheduleMode)
221
+	{
222
+		$schedMmodes = array("daily","weekly","monthly","annually");
223 223
         
224
-        if (in_array($scheduleMode, $schedMmodes)) 
225
-            return TRUE; 
226
-        else 
227
-            return FALSE;
228
-    }
224
+		if (in_array($scheduleMode, $schedMmodes)) 
225
+			return TRUE; 
226
+		else 
227
+			return FALSE;
228
+	}
229 229
     
230
-    public static function validateScheduleEnable($scheduleEnabled)
231
-    {
232
-        $schedEnambles = array(TRUE,FALSE);
230
+	public static function validateScheduleEnable($scheduleEnabled)
231
+	{
232
+		$schedEnambles = array(TRUE,FALSE);
233 233
         
234
-        if (in_array($scheduleEnabled, $schedEnambles))
235
-            return TRUE;
236
-        else
237
-            return FALSE;
238
-    }
234
+		if (in_array($scheduleEnabled, $schedEnambles))
235
+			return TRUE;
236
+		else
237
+			return FALSE;
238
+	}
239 239
     
240
-    public static function validateScheduleEvery($scheduleEvery)
241
-    {
242
-        if (is_numeric($scheduleEvery))
243
-            return TRUE;
244
-        else
245
-            return FALSE;
246
-    }
240
+	public static function validateScheduleEvery($scheduleEvery)
241
+	{
242
+		if (is_numeric($scheduleEvery))
243
+			return TRUE;
244
+		else
245
+			return FALSE;
246
+	}
247 247
     
248
-    public static function validateScheduleWeekDays($scheduleWeekDays)
249
-    {
250
-        $weekdays = explode(',', $scheduleWeekDays);
248
+	public static function validateScheduleWeekDays($scheduleWeekDays)
249
+	{
250
+		$weekdays = explode(',', $scheduleWeekDays);
251 251
         
252
-        if (sizeof($weekdays) < 1) return FALSE;
252
+		if (sizeof($weekdays) < 1) return FALSE;
253 253
         
254
-        $isValid = TRUE;
254
+		$isValid = TRUE;
255 255
         
256
-        for ($i=0; $i < sizeof($weekdays); $i++) { 
257
-            if (is_numeric($weekdays[$i])) {
258
-                $wday = intval($weekdays[$i]);
259
-                if ($wday < 1 || $wday > 7) $isValid = FALSE;
260
-            }
261
-            else $isValid = FALSE;
262
-        }
256
+		for ($i=0; $i < sizeof($weekdays); $i++) { 
257
+			if (is_numeric($weekdays[$i])) {
258
+				$wday = intval($weekdays[$i]);
259
+				if ($wday < 1 || $wday > 7) $isValid = FALSE;
260
+			}
261
+			else $isValid = FALSE;
262
+		}
263 263
         
264
-        return $isValid;
265
-    }
264
+		return $isValid;
265
+	}
266 266
     
267
-    public static function validateScheduleMonthlyMode($scheduleMonthlyMode)
268
-    {
269
-        $schedMonthlyMmodes = array("dates","nth");
267
+	public static function validateScheduleMonthlyMode($scheduleMonthlyMode)
268
+	{
269
+		$schedMonthlyMmodes = array("dates","nth");
270 270
         
271
-        if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes))
272
-            return TRUE;
273
-        else
274
-            return FALSE;
275
-    }
271
+		if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes))
272
+			return TRUE;
273
+		else
274
+			return FALSE;
275
+	}
276 276
     
277
-    public static function validateScheduleMonthlyDates($scheduleMonthlyDates)
278
-    {
279
-        $monthlyDates = explode(',', $scheduleMonthlyDates);
277
+	public static function validateScheduleMonthlyDates($scheduleMonthlyDates)
278
+	{
279
+		$monthlyDates = explode(',', $scheduleMonthlyDates);
280 280
         
281
-        if (sizeof($monthlyDates) <1) return FALSE;
281
+		if (sizeof($monthlyDates) <1) return FALSE;
282 282
         
283
-        $isValid = TRUE;
283
+		$isValid = TRUE;
284 284
         
285
-        for ($i=0; $i < sizeof($monthlyDates); $i++) { 
286
-            if (is_numeric($monthlyDates[$i])) {
287
-                $mday = intval($monthlyDates[$i]);
288
-                if ($mday <1 || $mday > 31) $isValid = FALSE;
289
-            }
290
-            else $isValid = FALSE;
291
-        }
285
+		for ($i=0; $i < sizeof($monthlyDates); $i++) { 
286
+			if (is_numeric($monthlyDates[$i])) {
287
+				$mday = intval($monthlyDates[$i]);
288
+				if ($mday <1 || $mday > 31) $isValid = FALSE;
289
+			}
290
+			else $isValid = FALSE;
291
+		}
292 292
 
293
-        return $isValid;
294
-    }
293
+		return $isValid;
294
+	}
295 295
     
296
-    public static function validateScheduleNthN($scheduleNthN)
297
-    {
298
-        if (!is_numeric($scheduleNthN)) return FALSE;
296
+	public static function validateScheduleNthN($scheduleNthN)
297
+	{
298
+		if (!is_numeric($scheduleNthN)) return FALSE;
299 299
         
300
-        $schedNthNs = array(1,2,3,4,5,-1);
300
+		$schedNthNs = array(1,2,3,4,5,-1);
301 301
         
302
-        if (in_array($scheduleNthN, $schedNthNs))
303
-            return TRUE;
304
-        else
305
-            return FALSE;
306
-    }
302
+		if (in_array($scheduleNthN, $schedNthNs))
303
+			return TRUE;
304
+		else
305
+			return FALSE;
306
+	}
307 307
     
308
-    public static function validateScheduleNthWhat($scheduleNthWhat)
309
-    {
310
-        if (!is_numeric($scheduleNthWhat)) return FALSE;
308
+	public static function validateScheduleNthWhat($scheduleNthWhat)
309
+	{
310
+		if (!is_numeric($scheduleNthWhat)) return FALSE;
311 311
         
312
-        $schedNthWhats = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
312
+		$schedNthWhats = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
313 313
         
314
-        if (in_array($scheduleNthWhat, $schedNthWhats))
315
-            return TRUE;
316
-        else
317
-            return FALSE;
318
-    }
314
+		if (in_array($scheduleNthWhat, $schedNthWhats))
315
+			return TRUE;
316
+		else
317
+			return FALSE;
318
+	}
319 319
     
320
-    /* Function adds the locations (with/without schedule) from the CSV file. 
320
+	/* Function adds the locations (with/without schedule) from the CSV file. 
321 321
      * $csvFileHandle - a file handler.
322 322
      * Returns array $results which contains two arrays: fail and succes.
323 323
      */
324
-    public function addLocationsFromCsvFile($csvFileHandle, $locationsFieldsMapping)
325
-    {
326
-        $max_line_length = 512;
327
-        $delemietr = ',';
324
+	public function addLocationsFromCsvFile($csvFileHandle, $locationsFieldsMapping)
325
+	{
326
+		$max_line_length = 512;
327
+		$delemietr = ',';
328 328
         
329
-        $results = array();
330
-        $results['fail'] = array();
331
-        $results['success'] = array();
329
+		$results = array();
330
+		$results['fail'] = array();
331
+		$results['success'] = array();
332 332
         
333
-        $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
333
+		$columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
334 334
 
335
-        if (empty($columns)) {
336
-            array_push($results['fail'],'Empty CSV table');
337
-            return ($results);
338
-        }
335
+		if (empty($columns)) {
336
+			array_push($results['fail'],'Empty CSV table');
337
+			return ($results);
338
+		}
339 339
 
340
-        $iRow = 1;
340
+		$iRow = 1;
341 341
         
342
-        while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr)) !== false) {
343
-            if ($rows[$locationsFieldsMapping['cached_lat']] 
344
-                  && $rows[$locationsFieldsMapping['cached_lng']] 
345
-                  && $rows[$locationsFieldsMapping['address_1']] 
346
-                  && array(null) !== $rows) {
347
-                $curSchedule = "";
348
-                $mode = "";
342
+		while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr)) !== false) {
343
+			if ($rows[$locationsFieldsMapping['cached_lat']] 
344
+				  && $rows[$locationsFieldsMapping['cached_lng']] 
345
+				  && $rows[$locationsFieldsMapping['address_1']] 
346
+				  && array(null) !== $rows) {
347
+				$curSchedule = "";
348
+				$mode = "";
349 349
                 
350
-                if (isset($rows[$locationsFieldsMapping['schedule_mode']])) {
351
-                    if ($this->validateScheduleMode($rows[$locationsFieldsMapping['schedule_mode']])) {
352
-                        $curSchedule = '"mode":"'.$rows[$locationsFieldsMapping['schedule_mode']].'",'; 
353
-                        $mode = $rows[$locationsFieldsMapping['schedule_mode']];
354
-                    } else {
355
-                        array_push($results['fail'],"$iRow --> Wrong schedule mode parameter"); 
356
-                        $curSchedule = "";
357
-                    }
358
-                } else {
359
-                    array_push($results['fail'],"$iRow --> The schedule mode parameter is not set"); 
360
-                    $curSchedule = "";
361
-                }
350
+				if (isset($rows[$locationsFieldsMapping['schedule_mode']])) {
351
+					if ($this->validateScheduleMode($rows[$locationsFieldsMapping['schedule_mode']])) {
352
+						$curSchedule = '"mode":"'.$rows[$locationsFieldsMapping['schedule_mode']].'",'; 
353
+						$mode = $rows[$locationsFieldsMapping['schedule_mode']];
354
+					} else {
355
+						array_push($results['fail'],"$iRow --> Wrong schedule mode parameter"); 
356
+						$curSchedule = "";
357
+					}
358
+				} else {
359
+					array_push($results['fail'],"$iRow --> The schedule mode parameter is not set"); 
360
+					$curSchedule = "";
361
+				}
362 362
                 
363
-                if (isset($rows[$locationsFieldsMapping['schedule_enabled']])) {
364
-                    if ($this->validateScheduleEnable($rows[$locationsFieldsMapping['schedule_enabled']])) { 
365
-                        $curSchedule.='"enabled":'.$rows[$locationsFieldsMapping['schedule_enabled']].',';
366
-                    } else {
367
-                        array_push($results['fail'],"$iRow --> The schedule enabled parameter is not set ");  
368
-                        $curSchedule = "";
369
-                    }
370
-                }
363
+				if (isset($rows[$locationsFieldsMapping['schedule_enabled']])) {
364
+					if ($this->validateScheduleEnable($rows[$locationsFieldsMapping['schedule_enabled']])) { 
365
+						$curSchedule.='"enabled":'.$rows[$locationsFieldsMapping['schedule_enabled']].',';
366
+					} else {
367
+						array_push($results['fail'],"$iRow --> The schedule enabled parameter is not set ");  
368
+						$curSchedule = "";
369
+					}
370
+				}
371 371
                 
372
-                if (isset($rows[$locationsFieldsMapping['schedule_every']])) {
373
-                    if ($this->validateScheduleEvery($rows[$locationsFieldsMapping['schedule_every']])) {
374
-                        $curSchedule.='"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; 
375
-                        if ($mode == 'daily') {
376
-                            $curSchedule = trim($curSchedule,',');
377
-                            $curSchedule.='}';
378
-                        }
379
-                    } else {
380
-                        array_push($results['fail'],"$iRow --> The parameter sched_every is not set"); 
381
-                        $curSchedule = ""; 
382
-                    }
383
-                }
372
+				if (isset($rows[$locationsFieldsMapping['schedule_every']])) {
373
+					if ($this->validateScheduleEvery($rows[$locationsFieldsMapping['schedule_every']])) {
374
+						$curSchedule.='"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; 
375
+						if ($mode == 'daily') {
376
+							$curSchedule = trim($curSchedule,',');
377
+							$curSchedule.='}';
378
+						}
379
+					} else {
380
+						array_push($results['fail'],"$iRow --> The parameter sched_every is not set"); 
381
+						$curSchedule = ""; 
382
+					}
383
+				}
384 384
                 
385
-                if ($mode!='daily') {
386
-                    switch ($mode) {
387
-                        case 'weekly':
388
-                            if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) {
389
-                                if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) {
390
-                                     $curSchedule.='"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}';
391
-                                } else {
392
-                                    array_push($results['fail'],"$iRow --> Wrong weekdays"); 
393
-                                    $curSchedule = "";
394
-                                }
395
-                            } else {
396
-                                array_push($results['fail'],"$iRow --> The parameters sched_weekdays is not set"); 
397
-                                $curSchedule = "";
398
-                            }
399
-                            break;
400
-                        case 'monthly':
401
-                            $monthlyMode = "";
402
-                            if (isset($rows[$locationsFieldsMapping['monthly_mode']])) {
403
-                                if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) {
404
-                                     $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']];
405
-                                     $curSchedule.='"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",';
406
-                                } else {
407
-                                    array_push($results['fail'],"$iRow --> Wrong monthly mode"); 
408
-                                    $curSchedule = "";
409
-                                }
410
-                            } else {
411
-                                array_push($results['fail'],"$iRow --> The parameter sched_monthly_mode is not set"); 
412
-                                $curSchedule = "";
413
-                            }
385
+				if ($mode!='daily') {
386
+					switch ($mode) {
387
+						case 'weekly':
388
+							if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) {
389
+								if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) {
390
+									 $curSchedule.='"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}';
391
+								} else {
392
+									array_push($results['fail'],"$iRow --> Wrong weekdays"); 
393
+									$curSchedule = "";
394
+								}
395
+							} else {
396
+								array_push($results['fail'],"$iRow --> The parameters sched_weekdays is not set"); 
397
+								$curSchedule = "";
398
+							}
399
+							break;
400
+						case 'monthly':
401
+							$monthlyMode = "";
402
+							if (isset($rows[$locationsFieldsMapping['monthly_mode']])) {
403
+								if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) {
404
+									 $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']];
405
+									 $curSchedule.='"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",';
406
+								} else {
407
+									array_push($results['fail'],"$iRow --> Wrong monthly mode"); 
408
+									$curSchedule = "";
409
+								}
410
+							} else {
411
+								array_push($results['fail'],"$iRow --> The parameter sched_monthly_mode is not set"); 
412
+								$curSchedule = "";
413
+							}
414 414
                             
415
-                            if ($monthlyMode != "") {
416
-                                switch ($monthlyMode) {
417
-                                    case 'dates':
418
-                                        if (isset($rows[$locationsFieldsMapping['monthly_dates']])) {
419
-                                            if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) {
420
-                                                 $curSchedule.='"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}';
421
-                                            } else {
422
-                                                array_push($results['fail'],"$iRow --> Wrong monthly dates"); 
423
-                                                $curSchedule = "";
424
-                                            }
425
-                                        }
426
-                                        break;
427
-                                    case 'nth':
428
-                                        if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) {
429
-                                            if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) {
430
-                                                 $curSchedule.='"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].',';
431
-                                            } else {
432
-                                                array_push($results['fail'],"$iRow --> Wrong parameter sched_nth_n"); 
433
-                                                $curSchedule = "";
434
-                                            }
435
-                                        } else {
436
-                                            array_push($results['fail'],"$iRow --> The parameter sched_nth_n is not set"); 
437
-                                            $curSchedule = "";
438
-                                        }
415
+							if ($monthlyMode != "") {
416
+								switch ($monthlyMode) {
417
+									case 'dates':
418
+										if (isset($rows[$locationsFieldsMapping['monthly_dates']])) {
419
+											if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) {
420
+												 $curSchedule.='"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}';
421
+											} else {
422
+												array_push($results['fail'],"$iRow --> Wrong monthly dates"); 
423
+												$curSchedule = "";
424
+											}
425
+										}
426
+										break;
427
+									case 'nth':
428
+										if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) {
429
+											if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) {
430
+												 $curSchedule.='"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].',';
431
+											} else {
432
+												array_push($results['fail'],"$iRow --> Wrong parameter sched_nth_n"); 
433
+												$curSchedule = "";
434
+											}
435
+										} else {
436
+											array_push($results['fail'],"$iRow --> The parameter sched_nth_n is not set"); 
437
+											$curSchedule = "";
438
+										}
439 439
                                         
440
-                                        if ($curSchedule != "") {
441
-                                            if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
442
-                                                if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
443
-                                                     $curSchedule.='"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}';
444
-                                                } else {
445
-                                                    array_push($results['fail'],"$iRow --> Wrong parameter sched_nth_what"); 
446
-                                                    $curSchedule = "";
447
-                                                }
448
-                                            } else {
449
-                                                array_push($results['fail'],"$iRow --> The parameter sched_nth_what is not set"); 
450
-                                                $curSchedule = "";
451
-                                            }
452
-                                        }
453
-                                        break;
454
-                                }
455
-                            }
456
-                            break;
457
-                        default:
458
-                            $curSchedule = "";
459
-                            break;
460
-                    }
461
-                }
440
+										if ($curSchedule != "") {
441
+											if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
442
+												if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
443
+													 $curSchedule.='"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}';
444
+												} else {
445
+													array_push($results['fail'],"$iRow --> Wrong parameter sched_nth_what"); 
446
+													$curSchedule = "";
447
+												}
448
+											} else {
449
+												array_push($results['fail'],"$iRow --> The parameter sched_nth_what is not set"); 
450
+												$curSchedule = "";
451
+											}
452
+										}
453
+										break;
454
+								}
455
+							}
456
+							break;
457
+						default:
458
+							$curSchedule = "";
459
+							break;
460
+					}
461
+				}
462 462
 
463
-                if (($mode == 'daily' || $mode == 'weekly' || $mode == 'monthy') && $curSchedule == "") {
464
-                    $iRow++; 
465
-                    continue;
466
-                }
463
+				if (($mode == 'daily' || $mode == 'weekly' || $mode == 'monthy') && $curSchedule == "") {
464
+					$iRow++; 
465
+					continue;
466
+				}
467 467
                 
468
-                $curSchedule =strtolower($curSchedule);
468
+				$curSchedule =strtolower($curSchedule);
469 469
                 
470
-                $curSchedule = '[{'.$curSchedule.'}]';
470
+				$curSchedule = '[{'.$curSchedule.'}]';
471 471
 
472
-                $oSchedule = json_decode($curSchedule,TRUE);
472
+				$oSchedule = json_decode($curSchedule,TRUE);
473 473
                 
474
-                $AdressBookLocationParameters = AddressBookLocation::fromArray(array(
475
-                    "cached_lat"                 => $rows[$locationsFieldsMapping['cached_lat']],
476
-                    "cached_lng"                 => $rows[$locationsFieldsMapping['cached_lng']],
477
-                    "curbside_lat"               => isset($locationsFieldsMapping['curbside_lat'])
478
-                                                     ? $rows[$locationsFieldsMapping['curbside_lat']] : null,
479
-                    "curbside_lng"               => isset($locationsFieldsMapping['curbside_lng'])
480
-                                                     ? $rows[$locationsFieldsMapping['curbside_lng']] : null,
481
-                    "address_alias"              => isset($locationsFieldsMapping['address_alias'])
482
-                                                     ? $rows[$locationsFieldsMapping['address_alias']] : null,
483
-                    "address_1"                  => $rows[$locationsFieldsMapping['address_1']],
484
-                    "address_2"                  => isset($locationsFieldsMapping['address_2'])
485
-                                                     ? $rows[$locationsFieldsMapping['address_2']] : null,
486
-                    "address_city"               => isset($locationsFieldsMapping['address_city'])
487
-                                                      ? $rows[$locationsFieldsMapping['address_city']] : null,
488
-                    "address_state_id"           => isset($locationsFieldsMapping['address_state_id'])
489
-                                                      ? $rows[$locationsFieldsMapping['address_state_id']] : null,
490
-                    "address_zip"                => isset($locationsFieldsMapping['address_zip'])
491
-                                                      ? $rows[$locationsFieldsMapping['address_zip']] : null,
492
-                    "address_phone_number"       => isset($locationsFieldsMapping['address_phone_number'])
493
-                                                      ? $rows[$locationsFieldsMapping['address_phone_number']] : null,
494
-                    "schedule"                   => isset($oSchedule) ? $oSchedule : null,
495
-                    "address_group"              => isset($locationsFieldsMapping['address_group']) 
496
-                                                      ? $rows[$locationsFieldsMapping['address_group']] : null,
497
-                    "first_name"                 => isset($locationsFieldsMapping['first_name']) 
498
-                                                      ? $rows[$locationsFieldsMapping['first_name']] : null,
499
-                    "last_name"                  => isset($locationsFieldsMapping['last_name']) 
500
-                                                      ? $rows[$locationsFieldsMapping['last_name']] : null,
501
-                    "local_time_window_start"    => isset($locationsFieldsMapping['local_time_window_start'])
502
-                                                      ? $rows[$locationsFieldsMapping['local_time_window_start']] : null,
503
-                    "local_time_window_end"      => isset($locationsFieldsMapping['local_time_window_end'])
504
-                                                      ? $rows[$locationsFieldsMapping['local_time_window_end']] : null,
505
-                    "local_time_window_start_2"  => isset($locationsFieldsMapping['local_time_window_start_2'])
506
-                                                      ? $rows[$locationsFieldsMapping['local_time_window_start_2']] : null,
507
-                    "local_time_window_end_2"    => isset($locationsFieldsMapping['local_time_window_end_2'])
508
-                                                      ? $rows[$locationsFieldsMapping['local_time_window_end_2']] : null,
509
-                    "address_email"              => isset($locationsFieldsMapping['address_email'])
510
-                                                      ? $rows[$locationsFieldsMapping['address_email']] : null,
511
-                    "address_country_id"         => isset($locationsFieldsMapping['address_country_id'])
512
-                                                      ? $rows[$locationsFieldsMapping['address_country_id']] : null,
513
-                    "address_custom_data"        => isset($locationsFieldsMapping['address_custom_data'])
514
-                                                      ? $rows[$locationsFieldsMapping['address_custom_data']] : null,
515
-                    "schedule_blacklist"         => isset($locationsFieldsMapping['schedule_blacklist'])
516
-                                                      ? $rows[$locationsFieldsMapping['schedule_blacklist']] : null,
517
-                    "service_time"               => isset($locationsFieldsMapping['service_time'])
518
-                                                      ? $rows[$locationsFieldsMapping['service_time']] : null,
519
-                    "local_timezone_string"      => isset($locationsFieldsMapping['local_timezone_string'])
520
-                                                      ? $rows[$locationsFieldsMapping['local_timezone_string']] : null,
521
-                    "color"                      => isset($locationsFieldsMapping['color'])
522
-                                                      ? $rows[$locationsFieldsMapping['color']] : null,
523
-                    "address_icon"               => isset($locationsFieldsMapping['address_icon'])
524
-                                                      ? $rows[$locationsFieldsMapping['address_icon']] : null,
525
-                    "address_stop_type"          => isset($locationsFieldsMapping['address_stop_type'])
526
-                                                      ? $rows[$locationsFieldsMapping['address_stop_type']] : null,
527
-                    "address_cube"               => isset($locationsFieldsMapping['address_cube'])
528
-                                                      ? $rows[$locationsFieldsMapping['address_cube']] : null,
529
-                    "address_pieces"             => isset($locationsFieldsMapping['address_pieces'])
530
-                                                      ? $rows[$locationsFieldsMapping['address_pieces']] : null,
531
-                    "address_reference_no"       => isset($locationsFieldsMapping['address_reference_no'])
532
-                                                      ? $rows[$locationsFieldsMapping['address_reference_no']] : null,
533
-                    "address_revenue"            => isset($locationsFieldsMapping['address_revenue'])
534
-                                                      ? $rows[$locationsFieldsMapping['address_revenue']] : null,
535
-                    "address_weight"             => isset($locationsFieldsMapping['address_weight'])
536
-                                                      ? $rows[$locationsFieldsMapping['address_weight']] : null,
537
-                    "address_priority"           => isset($locationsFieldsMapping['address_priority'])
538
-                                                      ? $rows[$locationsFieldsMapping['address_priority']] : null,
539
-                    "address_customer_po"        => isset($locationsFieldsMapping['address_customer_po'])
540
-                                                      ? $rows[$locationsFieldsMapping['address_customer_po']] : null,
541
-                ));
474
+				$AdressBookLocationParameters = AddressBookLocation::fromArray(array(
475
+					"cached_lat"                 => $rows[$locationsFieldsMapping['cached_lat']],
476
+					"cached_lng"                 => $rows[$locationsFieldsMapping['cached_lng']],
477
+					"curbside_lat"               => isset($locationsFieldsMapping['curbside_lat'])
478
+													 ? $rows[$locationsFieldsMapping['curbside_lat']] : null,
479
+					"curbside_lng"               => isset($locationsFieldsMapping['curbside_lng'])
480
+													 ? $rows[$locationsFieldsMapping['curbside_lng']] : null,
481
+					"address_alias"              => isset($locationsFieldsMapping['address_alias'])
482
+													 ? $rows[$locationsFieldsMapping['address_alias']] : null,
483
+					"address_1"                  => $rows[$locationsFieldsMapping['address_1']],
484
+					"address_2"                  => isset($locationsFieldsMapping['address_2'])
485
+													 ? $rows[$locationsFieldsMapping['address_2']] : null,
486
+					"address_city"               => isset($locationsFieldsMapping['address_city'])
487
+													  ? $rows[$locationsFieldsMapping['address_city']] : null,
488
+					"address_state_id"           => isset($locationsFieldsMapping['address_state_id'])
489
+													  ? $rows[$locationsFieldsMapping['address_state_id']] : null,
490
+					"address_zip"                => isset($locationsFieldsMapping['address_zip'])
491
+													  ? $rows[$locationsFieldsMapping['address_zip']] : null,
492
+					"address_phone_number"       => isset($locationsFieldsMapping['address_phone_number'])
493
+													  ? $rows[$locationsFieldsMapping['address_phone_number']] : null,
494
+					"schedule"                   => isset($oSchedule) ? $oSchedule : null,
495
+					"address_group"              => isset($locationsFieldsMapping['address_group']) 
496
+													  ? $rows[$locationsFieldsMapping['address_group']] : null,
497
+					"first_name"                 => isset($locationsFieldsMapping['first_name']) 
498
+													  ? $rows[$locationsFieldsMapping['first_name']] : null,
499
+					"last_name"                  => isset($locationsFieldsMapping['last_name']) 
500
+													  ? $rows[$locationsFieldsMapping['last_name']] : null,
501
+					"local_time_window_start"    => isset($locationsFieldsMapping['local_time_window_start'])
502
+													  ? $rows[$locationsFieldsMapping['local_time_window_start']] : null,
503
+					"local_time_window_end"      => isset($locationsFieldsMapping['local_time_window_end'])
504
+													  ? $rows[$locationsFieldsMapping['local_time_window_end']] : null,
505
+					"local_time_window_start_2"  => isset($locationsFieldsMapping['local_time_window_start_2'])
506
+													  ? $rows[$locationsFieldsMapping['local_time_window_start_2']] : null,
507
+					"local_time_window_end_2"    => isset($locationsFieldsMapping['local_time_window_end_2'])
508
+													  ? $rows[$locationsFieldsMapping['local_time_window_end_2']] : null,
509
+					"address_email"              => isset($locationsFieldsMapping['address_email'])
510
+													  ? $rows[$locationsFieldsMapping['address_email']] : null,
511
+					"address_country_id"         => isset($locationsFieldsMapping['address_country_id'])
512
+													  ? $rows[$locationsFieldsMapping['address_country_id']] : null,
513
+					"address_custom_data"        => isset($locationsFieldsMapping['address_custom_data'])
514
+													  ? $rows[$locationsFieldsMapping['address_custom_data']] : null,
515
+					"schedule_blacklist"         => isset($locationsFieldsMapping['schedule_blacklist'])
516
+													  ? $rows[$locationsFieldsMapping['schedule_blacklist']] : null,
517
+					"service_time"               => isset($locationsFieldsMapping['service_time'])
518
+													  ? $rows[$locationsFieldsMapping['service_time']] : null,
519
+					"local_timezone_string"      => isset($locationsFieldsMapping['local_timezone_string'])
520
+													  ? $rows[$locationsFieldsMapping['local_timezone_string']] : null,
521
+					"color"                      => isset($locationsFieldsMapping['color'])
522
+													  ? $rows[$locationsFieldsMapping['color']] : null,
523
+					"address_icon"               => isset($locationsFieldsMapping['address_icon'])
524
+													  ? $rows[$locationsFieldsMapping['address_icon']] : null,
525
+					"address_stop_type"          => isset($locationsFieldsMapping['address_stop_type'])
526
+													  ? $rows[$locationsFieldsMapping['address_stop_type']] : null,
527
+					"address_cube"               => isset($locationsFieldsMapping['address_cube'])
528
+													  ? $rows[$locationsFieldsMapping['address_cube']] : null,
529
+					"address_pieces"             => isset($locationsFieldsMapping['address_pieces'])
530
+													  ? $rows[$locationsFieldsMapping['address_pieces']] : null,
531
+					"address_reference_no"       => isset($locationsFieldsMapping['address_reference_no'])
532
+													  ? $rows[$locationsFieldsMapping['address_reference_no']] : null,
533
+					"address_revenue"            => isset($locationsFieldsMapping['address_revenue'])
534
+													  ? $rows[$locationsFieldsMapping['address_revenue']] : null,
535
+					"address_weight"             => isset($locationsFieldsMapping['address_weight'])
536
+													  ? $rows[$locationsFieldsMapping['address_weight']] : null,
537
+					"address_priority"           => isset($locationsFieldsMapping['address_priority'])
538
+													  ? $rows[$locationsFieldsMapping['address_priority']] : null,
539
+					"address_customer_po"        => isset($locationsFieldsMapping['address_customer_po'])
540
+													  ? $rows[$locationsFieldsMapping['address_customer_po']] : null,
541
+				));
542 542
                 
543
-                $abContacts = new AddressBookLocation();
543
+				$abContacts = new AddressBookLocation();
544 544
 
545
-                $abcResults = $abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry
545
+				$abcResults = $abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry
546 546
                 
547
-                array_push($results['success'],"The schedule location with address_id = ".strval($abcResults["address_id"])." added successfuly.");
548
-            }
549
-        }
547
+				array_push($results['success'],"The schedule location with address_id = ".strval($abcResults["address_id"])." added successfuly.");
548
+			}
549
+		}
550 550
 
551
-        return $results;
552
-    }
551
+		return $results;
552
+	}
553 553
  }
554
-    
555 554
\ No newline at end of file
555
+	
556 556
\ No newline at end of file
Please login to merge, or discard this patch.
src/Route4Me/Order.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -71,6 +71,9 @@
 block discarded – undo
71 71
         return $order;
72 72
     }
73 73
     
74
+    /**
75
+     * @param Order $params
76
+     */
74 77
     public static function addOrder($params)
75 78
     {
76 79
         $response = Route4Me::makeRequst(array(
Please login to merge, or discard this patch.
Indentation   +315 added lines, -315 removed lines patch added patch discarded remove patch
@@ -6,380 +6,380 @@
 block discarded – undo
6 6
 
7 7
 class Order extends Common
8 8
 {
9
-    public $address_1;
10
-    public $address_2;
11
-    public $cached_lat;
12
-    public $cached_lng;
13
-    public $curbside_lat;
14
-    public $curbside_lng;
15
-    public $address_alias;
16
-    public $address_city;
17
-    public $EXT_FIELD_first_name;
18
-    public $EXT_FIELD_last_name;
19
-    public $EXT_FIELD_email;
20
-    public $EXT_FIELD_phone;
21
-    public $EXT_FIELD_custom_data;
9
+	public $address_1;
10
+	public $address_2;
11
+	public $cached_lat;
12
+	public $cached_lng;
13
+	public $curbside_lat;
14
+	public $curbside_lng;
15
+	public $address_alias;
16
+	public $address_city;
17
+	public $EXT_FIELD_first_name;
18
+	public $EXT_FIELD_last_name;
19
+	public $EXT_FIELD_email;
20
+	public $EXT_FIELD_phone;
21
+	public $EXT_FIELD_custom_data;
22 22
     
23
-    public $color;
24
-    public $order_icon;
25
-    public $local_time_window_start;
26
-    public $local_time_window_end;
27
-    public $local_time_window_start_2;
28
-    public $local_time_window_end_2;
29
-    public $service_time;
23
+	public $color;
24
+	public $order_icon;
25
+	public $local_time_window_start;
26
+	public $local_time_window_end;
27
+	public $local_time_window_start_2;
28
+	public $local_time_window_end_2;
29
+	public $service_time;
30 30
     
31
-    public $day_scheduled_for_YYMMDD;
31
+	public $day_scheduled_for_YYMMDD;
32 32
     
33
-    public $route_id;
34
-    public $redirect;
35
-    public $optimization_problem_id;
36
-    public $order_id;
37
-    public $order_ids;
33
+	public $route_id;
34
+	public $redirect;
35
+	public $optimization_problem_id;
36
+	public $order_id;
37
+	public $order_ids;
38 38
     
39
-    public $day_added_YYMMDD;
40
-    public $scheduled_for_YYMMDD;
41
-    public $fields;
42
-    public $offset;
43
-    public $limit;
44
-    public $query;
39
+	public $day_added_YYMMDD;
40
+	public $scheduled_for_YYMMDD;
41
+	public $fields;
42
+	public $offset;
43
+	public $limit;
44
+	public $query;
45 45
     
46
-    public $created_timestamp;
47
-    public $order_status_id;
48
-    public $member_id;
49
-    public $address_state_id;
50
-    public $address_country_id;
51
-    public $address_zip;
52
-    public $in_route_count;
53
-    public $last_visited_timestamp;
54
-    public $last_routed_timestamp;
55
-    public $local_timezone_string;
56
-    public $is_validated;
57
-    public $is_pending;
58
-    public $is_accepted;
59
-    public $is_started;
60
-    public $is_completed;
61
-    public $custom_user_fields;
46
+	public $created_timestamp;
47
+	public $order_status_id;
48
+	public $member_id;
49
+	public $address_state_id;
50
+	public $address_country_id;
51
+	public $address_zip;
52
+	public $in_route_count;
53
+	public $last_visited_timestamp;
54
+	public $last_routed_timestamp;
55
+	public $local_timezone_string;
56
+	public $is_validated;
57
+	public $is_pending;
58
+	public $is_accepted;
59
+	public $is_started;
60
+	public $is_completed;
61
+	public $custom_user_fields;
62 62
     
63
-    public static function fromArray(array $params) {
64
-        $order= new Order();
65
-        foreach($params as $key => $value) {
66
-            if (property_exists($order, $key)) {
67
-                $order->{$key} = $value;
68
-            }
69
-        }
63
+	public static function fromArray(array $params) {
64
+		$order= new Order();
65
+		foreach($params as $key => $value) {
66
+			if (property_exists($order, $key)) {
67
+				$order->{$key} = $value;
68
+			}
69
+		}
70 70
         
71
-        return $order;
72
-    }
71
+		return $order;
72
+	}
73 73
     
74
-    public static function addOrder($params)
75
-    {
76
-        $response = Route4Me::makeRequst(array(
77
-            'url'    => Endpoint::ORDER_V4,
78
-            'method' => 'POST',
79
-            'body'   => array(
80
-                'address_1'                 =>  isset($params->address_1) ? $params->address_1: null,
81
-                'address_2'                 =>  isset($params->address_2) ? $params->address_2: null,
82
-                'member_id'                 =>  isset($params->member_id) ? $params->member_id: null,
83
-                'cached_lat'                =>  isset($params->cached_lat) ? $params->cached_lat : null,
84
-                'cached_lng'                =>  isset($params->cached_lng) ? $params->cached_lng : null,
85
-                'curbside_lat'              =>  isset($params->curbside_lat) ? $params->curbside_lat : null,
86
-                'curbside_lng'              =>  isset($params->curbside_lng) ? $params->curbside_lng : null,
87
-                'color'                     =>  isset($params->color) ? $params->color : null,
88
-                'order_icon'                =>  isset($params->order_icon) ? $params->order_icon : null,
89
-                'day_scheduled_for_YYMMDD'  =>  isset($params->day_scheduled_for_YYMMDD) ? $params->day_scheduled_for_YYMMDD : null,
90
-                'address_alias'             =>  isset($params->address_alias) ? $params->address_alias : null,
91
-                'address_city'              =>  isset($params->address_city) ? $params->address_city: null,
92
-                'address_state_id'          =>  isset($params->address_state_id) ? $params->address_state_id: null,
93
-                'address_country_id'        =>  isset($params->address_country_id) ? $params->address_country_id: null,
94
-                'address_zip'               =>  isset($params->address_zip) ? $params->address_zip: null,
95
-                'local_time_window_start'   =>  isset($params->local_time_window_start) ? $params->local_time_window_start: null,
96
-                'local_time_window_end'     =>  isset($params->local_time_window_end) ? $params->local_time_window_end: null,
97
-                'local_time_window_start_2' =>  isset($params->local_time_window_start_2) ? $params->local_time_window_start_2: null,
98
-                'local_time_window_end_2'   =>  isset($params->local_time_window_end_2) ? $params->local_time_window_end_2: null,
99
-                'service_time'              =>  isset($params->service_time) ? $params->service_time: null,
100
-                'local_timezone_string'     =>  isset($params->local_timezone_string) ? $params->local_timezone_string: null,
101
-                'EXT_FIELD_first_name'      =>  isset($params->EXT_FIELD_first_name) ? $params->EXT_FIELD_first_name: null,
102
-                'EXT_FIELD_last_name'       =>  isset($params->EXT_FIELD_last_name) ? $params->EXT_FIELD_last_name: null,
103
-                'EXT_FIELD_email'           =>  isset($params->EXT_FIELD_email) ? $params->EXT_FIELD_email: null,
104
-                'EXT_FIELD_phone'           =>  isset($params->EXT_FIELD_phone) ? $params->EXT_FIELD_phone: null,
105
-                'EXT_FIELD_custom_data'     =>  isset($params->EXT_FIELD_custom_data) ? $params->EXT_FIELD_custom_data: null,
106
-                'is_validated'              =>  isset($params->is_validated) ? $params->is_validated: null,
107
-                'is_pending'                =>  isset($params->is_pending) ? $params->is_pending: null,
108
-                'is_accepted'               =>  isset($params->is_accepted) ? $params->is_accepted: null,
109
-                'is_started'                =>  isset($params->is_started) ? $params->is_started: null,
110
-                'is_completed'              =>  isset($params->is_completed) ? $params->is_completed: null,
111
-                'custom_user_fields'        =>  isset($params->custom_user_fields) ? $params->custom_user_fields: null
112
-            )
113
-        ));
74
+	public static function addOrder($params)
75
+	{
76
+		$response = Route4Me::makeRequst(array(
77
+			'url'    => Endpoint::ORDER_V4,
78
+			'method' => 'POST',
79
+			'body'   => array(
80
+				'address_1'                 =>  isset($params->address_1) ? $params->address_1: null,
81
+				'address_2'                 =>  isset($params->address_2) ? $params->address_2: null,
82
+				'member_id'                 =>  isset($params->member_id) ? $params->member_id: null,
83
+				'cached_lat'                =>  isset($params->cached_lat) ? $params->cached_lat : null,
84
+				'cached_lng'                =>  isset($params->cached_lng) ? $params->cached_lng : null,
85
+				'curbside_lat'              =>  isset($params->curbside_lat) ? $params->curbside_lat : null,
86
+				'curbside_lng'              =>  isset($params->curbside_lng) ? $params->curbside_lng : null,
87
+				'color'                     =>  isset($params->color) ? $params->color : null,
88
+				'order_icon'                =>  isset($params->order_icon) ? $params->order_icon : null,
89
+				'day_scheduled_for_YYMMDD'  =>  isset($params->day_scheduled_for_YYMMDD) ? $params->day_scheduled_for_YYMMDD : null,
90
+				'address_alias'             =>  isset($params->address_alias) ? $params->address_alias : null,
91
+				'address_city'              =>  isset($params->address_city) ? $params->address_city: null,
92
+				'address_state_id'          =>  isset($params->address_state_id) ? $params->address_state_id: null,
93
+				'address_country_id'        =>  isset($params->address_country_id) ? $params->address_country_id: null,
94
+				'address_zip'               =>  isset($params->address_zip) ? $params->address_zip: null,
95
+				'local_time_window_start'   =>  isset($params->local_time_window_start) ? $params->local_time_window_start: null,
96
+				'local_time_window_end'     =>  isset($params->local_time_window_end) ? $params->local_time_window_end: null,
97
+				'local_time_window_start_2' =>  isset($params->local_time_window_start_2) ? $params->local_time_window_start_2: null,
98
+				'local_time_window_end_2'   =>  isset($params->local_time_window_end_2) ? $params->local_time_window_end_2: null,
99
+				'service_time'              =>  isset($params->service_time) ? $params->service_time: null,
100
+				'local_timezone_string'     =>  isset($params->local_timezone_string) ? $params->local_timezone_string: null,
101
+				'EXT_FIELD_first_name'      =>  isset($params->EXT_FIELD_first_name) ? $params->EXT_FIELD_first_name: null,
102
+				'EXT_FIELD_last_name'       =>  isset($params->EXT_FIELD_last_name) ? $params->EXT_FIELD_last_name: null,
103
+				'EXT_FIELD_email'           =>  isset($params->EXT_FIELD_email) ? $params->EXT_FIELD_email: null,
104
+				'EXT_FIELD_phone'           =>  isset($params->EXT_FIELD_phone) ? $params->EXT_FIELD_phone: null,
105
+				'EXT_FIELD_custom_data'     =>  isset($params->EXT_FIELD_custom_data) ? $params->EXT_FIELD_custom_data: null,
106
+				'is_validated'              =>  isset($params->is_validated) ? $params->is_validated: null,
107
+				'is_pending'                =>  isset($params->is_pending) ? $params->is_pending: null,
108
+				'is_accepted'               =>  isset($params->is_accepted) ? $params->is_accepted: null,
109
+				'is_started'                =>  isset($params->is_started) ? $params->is_started: null,
110
+				'is_completed'              =>  isset($params->is_completed) ? $params->is_completed: null,
111
+				'custom_user_fields'        =>  isset($params->custom_user_fields) ? $params->custom_user_fields: null
112
+			)
113
+		));
114 114
 
115
-        return $response;
116
-    }
115
+		return $response;
116
+	}
117 117
 
118
-    public static function addOrder2Route($params,$body)
119
-    {
120
-        $response = Route4Me::makeRequst(array(
121
-            'url'    => Endpoint::ROUTE_V4,
122
-            'method' => 'PUT',
123
-            'query'  => array(
124
-                'route_id' => isset($params->route_id) ? $params->route_id: null,
125
-                'redirect' => isset($params->redirect) ? $params->redirect : null
126
-            ),
127
-            'body' => (array)$body
128
-        ));
118
+	public static function addOrder2Route($params,$body)
119
+	{
120
+		$response = Route4Me::makeRequst(array(
121
+			'url'    => Endpoint::ROUTE_V4,
122
+			'method' => 'PUT',
123
+			'query'  => array(
124
+				'route_id' => isset($params->route_id) ? $params->route_id: null,
125
+				'redirect' => isset($params->redirect) ? $params->redirect : null
126
+			),
127
+			'body' => (array)$body
128
+		));
129 129
 
130
-        return $response;
131
-    }
130
+		return $response;
131
+	}
132 132
     
133
-    public static function addOrder2Optimization($params,$body)
134
-    {
135
-        $response = Route4Me::makeRequst(array(
136
-            'url'    => Endpoint::OPTIMIZATION_PROBLEM,
137
-            'method' => 'PUT',
138
-            'query'  => array(
139
-                'optimization_problem_id' =>  isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
140
-                'redirect'                => isset($params['redirect']) ? $params['redirect'] : null,
141
-                'device_type'             => isset($params['device_type']) ? $params['device_type'] : null
142
-            ),
143
-            'body'  => (array)$body
144
-        ));
133
+	public static function addOrder2Optimization($params,$body)
134
+	{
135
+		$response = Route4Me::makeRequst(array(
136
+			'url'    => Endpoint::OPTIMIZATION_PROBLEM,
137
+			'method' => 'PUT',
138
+			'query'  => array(
139
+				'optimization_problem_id' =>  isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
140
+				'redirect'                => isset($params['redirect']) ? $params['redirect'] : null,
141
+				'device_type'             => isset($params['device_type']) ? $params['device_type'] : null
142
+			),
143
+			'body'  => (array)$body
144
+		));
145 145
 
146
-        return $response;
147
-    }
146
+		return $response;
147
+	}
148 148
     
149
-    public static function getOrder($params)
150
-    {
151
-        $response = Route4Me::makeRequst(array(
152
-            'url'    => Endpoint::ORDER_V4,
153
-            'method' => 'GET',
154
-            'query'  => array(
155
-                'order_id'             => isset($params->order_id) ? $params->order_id: null,
156
-                'fields'               => isset($params->fields) ? $params->fields: null,
157
-                'day_added_YYMMDD'     => isset($params->day_added_YYMMDD) ? $params->day_added_YYMMDD: null,
158
-                'scheduled_for_YYMMDD' => isset($params->scheduled_for_YYMMDD) ? $params->scheduled_for_YYMMDD: null,
159
-                'query'                => isset($params->query) ? $params->query: null,
160
-                'offset'               => isset($params->offset) ? $params->offset: null,
161
-                'limit'                => isset($params->limit) ? $params->limit: null
162
-            )
163
-        ));
149
+	public static function getOrder($params)
150
+	{
151
+		$response = Route4Me::makeRequst(array(
152
+			'url'    => Endpoint::ORDER_V4,
153
+			'method' => 'GET',
154
+			'query'  => array(
155
+				'order_id'             => isset($params->order_id) ? $params->order_id: null,
156
+				'fields'               => isset($params->fields) ? $params->fields: null,
157
+				'day_added_YYMMDD'     => isset($params->day_added_YYMMDD) ? $params->day_added_YYMMDD: null,
158
+				'scheduled_for_YYMMDD' => isset($params->scheduled_for_YYMMDD) ? $params->scheduled_for_YYMMDD: null,
159
+				'query'                => isset($params->query) ? $params->query: null,
160
+				'offset'               => isset($params->offset) ? $params->offset: null,
161
+				'limit'                => isset($params->limit) ? $params->limit: null
162
+			)
163
+		));
164 164
 
165
-        return $response;
166
-    }
165
+		return $response;
166
+	}
167 167
     
168
-    public static function getOrders($params)
169
-    {
170
-        $response = Route4Me::makeRequst(array(
171
-            'url'    => Endpoint::ORDER_V4,
172
-            'method' => 'GET',
173
-            'query'  => array(
174
-                'offset' => isset($params->offset) ? $params->offset: null,
175
-                'limit'  => isset($params->limit) ? $params->limit: null
176
-            )
177
-        ));
168
+	public static function getOrders($params)
169
+	{
170
+		$response = Route4Me::makeRequst(array(
171
+			'url'    => Endpoint::ORDER_V4,
172
+			'method' => 'GET',
173
+			'query'  => array(
174
+				'offset' => isset($params->offset) ? $params->offset: null,
175
+				'limit'  => isset($params->limit) ? $params->limit: null
176
+			)
177
+		));
178 178
 
179
-        return $response;
180
-    }
179
+		return $response;
180
+	}
181 181
     
182
-    public function getRandomOrderId($offset,$limit)
183
-    {
184
-        $params = array('offset' => $offset, 'limit' => $limit);
182
+	public function getRandomOrderId($offset,$limit)
183
+	{
184
+		$params = array('offset' => $offset, 'limit' => $limit);
185 185
         
186
-        $orders = self::getOrders($params);
186
+		$orders = self::getOrders($params);
187 187
         
188
-        if (is_null($orders)) return null;
189
-        if (!isset($orders['results'])) return null;
188
+		if (is_null($orders)) return null;
189
+		if (!isset($orders['results'])) return null;
190 190
         
191
-        $randomIndex = rand(0, sizeof($orders['results'])-1);
191
+		$randomIndex = rand(0, sizeof($orders['results'])-1);
192 192
         
193
-        $order = $orders['results'][$randomIndex];
193
+		$order = $orders['results'][$randomIndex];
194 194
         
195
-        return $order['order_id'];
196
-    }
195
+		return $order['order_id'];
196
+	}
197 197
     
198
-    public function getRandomOrder($offset,$limit)
199
-    {
200
-        $params = array('offset' => $offset, 'limit' => $limit);
198
+	public function getRandomOrder($offset,$limit)
199
+	{
200
+		$params = array('offset' => $offset, 'limit' => $limit);
201 201
         
202
-        $orders = self::getOrders($params);
202
+		$orders = self::getOrders($params);
203 203
         
204
-        if (is_null($orders)) return null;
205
-        if (!isset($orders['results'])) return null;
204
+		if (is_null($orders)) return null;
205
+		if (!isset($orders['results'])) return null;
206 206
         
207
-        $randomIndex = rand(0, sizeof($orders['results'])-1);
207
+		$randomIndex = rand(0, sizeof($orders['results'])-1);
208 208
         
209
-        $order = $orders['results'][$randomIndex];
209
+		$order = $orders['results'][$randomIndex];
210 210
         
211
-        return $order;
212
-    }
211
+		return $order;
212
+	}
213 213
     
214
-    public static function removeOrder($params)
215
-    {
216
-        $response = Route4Me::makeRequst(array(
217
-            'url'    => Endpoint::ORDER_V4,
218
-            'method' => 'DELETE',
219
-            'body'   => array(
220
-                'order_ids' =>  isset($params->order_ids) ? $params->order_ids: null
221
-            )
222
-        ));
214
+	public static function removeOrder($params)
215
+	{
216
+		$response = Route4Me::makeRequst(array(
217
+			'url'    => Endpoint::ORDER_V4,
218
+			'method' => 'DELETE',
219
+			'body'   => array(
220
+				'order_ids' =>  isset($params->order_ids) ? $params->order_ids: null
221
+			)
222
+		));
223 223
 
224
-        return $response;
225
-    }
224
+		return $response;
225
+	}
226 226
     
227
-    public static function updateOrder($body)
228
-    {
229
-        $response = Route4Me::makeRequst(array(
230
-            'url'    => Endpoint::ORDER_V4,
231
-            'method' => 'PUT',
232
-            'body'   => (array)$body
233
-        ));
227
+	public static function updateOrder($body)
228
+	{
229
+		$response = Route4Me::makeRequst(array(
230
+			'url'    => Endpoint::ORDER_V4,
231
+			'method' => 'PUT',
232
+			'body'   => (array)$body
233
+		));
234 234
 
235
-        return $response;
236
-    }
235
+		return $response;
236
+	}
237 237
     
238
-    public static function searchOrder($params)
239
-    {
240
-        $response = Route4Me::makeRequst(array(
241
-            'url'    => Endpoint::ORDER_V4,
242
-            'method' => 'GET',
243
-            'query'  => array(
244
-                'day_added_YYMMDD'     =>  isset($params->day_added_YYMMDD) ? $params->day_added_YYMMDD: null,
245
-                'scheduled_for_YYMMDD' =>  isset($params->scheduled_for_YYMMDD) ? $params->scheduled_for_YYMMDD: null,
246
-                'fields'               =>  isset($params->fields) ? $params->fields: null,
247
-                'offset'               =>  isset($params->offset) ? $params->offset: null,
248
-                'limit'                =>  isset($params->limit) ? $params->limit: null,
249
-                'query'                =>  isset($params->query) ? $params->query: null,
250
-            )
251
-        ));
238
+	public static function searchOrder($params)
239
+	{
240
+		$response = Route4Me::makeRequst(array(
241
+			'url'    => Endpoint::ORDER_V4,
242
+			'method' => 'GET',
243
+			'query'  => array(
244
+				'day_added_YYMMDD'     =>  isset($params->day_added_YYMMDD) ? $params->day_added_YYMMDD: null,
245
+				'scheduled_for_YYMMDD' =>  isset($params->scheduled_for_YYMMDD) ? $params->scheduled_for_YYMMDD: null,
246
+				'fields'               =>  isset($params->fields) ? $params->fields: null,
247
+				'offset'               =>  isset($params->offset) ? $params->offset: null,
248
+				'limit'                =>  isset($params->limit) ? $params->limit: null,
249
+				'query'                =>  isset($params->query) ? $params->query: null,
250
+			)
251
+		));
252 252
 
253
-        return $response;
254
-    }
253
+		return $response;
254
+	}
255 255
     
256
-    public static function validateLatitude($lat)
257
-    {
258
-        if (!is_numeric($lat)) return false;
256
+	public static function validateLatitude($lat)
257
+	{
258
+		if (!is_numeric($lat)) return false;
259 259
         
260
-        if ($lat>90 || $lat<-90) return false;
260
+		if ($lat>90 || $lat<-90) return false;
261 261
         
262
-        return true;
263
-    }
262
+		return true;
263
+	}
264 264
     
265
-    public static function validateLongitude($lng)
266
-    {
267
-        if (!is_numeric($lng)) return false;
265
+	public static function validateLongitude($lng)
266
+	{
267
+		if (!is_numeric($lng)) return false;
268 268
         
269
-        if ($lng>180 || $lng<-180) return false;
269
+		if ($lng>180 || $lng<-180) return false;
270 270
         
271
-        return true;
272
-    }
271
+		return true;
272
+	}
273 273
     
274
-    public function addOrdersFromCsvFile($csvFileHandle, $ordersFieldsMapping)
275
-    {
276
-        $max_line_length = 512;
277
-        $delemietr = ',';
274
+	public function addOrdersFromCsvFile($csvFileHandle, $ordersFieldsMapping)
275
+	{
276
+		$max_line_length = 512;
277
+		$delemietr = ',';
278 278
         
279
-        $results = array();
280
-        $results['fail'] = array();
281
-        $results['success'] = array();
279
+		$results = array();
280
+		$results['fail'] = array();
281
+		$results['success'] = array();
282 282
         
283
-        $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
283
+		$columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
284 284
         
285
-        if (!empty($columns)) {
286
-             array_push($results['fail'],'Empty CSV table');
287
-             return ($results);
288
-        }
285
+		if (!empty($columns)) {
286
+			 array_push($results['fail'],'Empty CSV table');
287
+			 return ($results);
288
+		}
289 289
                  
290
-        $iRow=1;
290
+		$iRow=1;
291 291
         
292
-        while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr)) !== false) {
293
-            if ($rows[$ordersFieldsMapping['cached_lat']] && $rows[$ordersFieldsMapping['cached_lng']] && $rows[$ordersFieldsMapping['address_1']] && array(null) !== $rows) {
292
+		while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr)) !== false) {
293
+			if ($rows[$ordersFieldsMapping['cached_lat']] && $rows[$ordersFieldsMapping['cached_lng']] && $rows[$ordersFieldsMapping['address_1']] && array(null) !== $rows) {
294 294
                 
295
-                $cached_lat = 0.000;
295
+				$cached_lat = 0.000;
296 296
                 
297
-                if (!$this->validateLatitude($rows[$ordersFieldsMapping['cached_lat']])) {
298
-                    array_push($results['fail'],"$iRow --> Wrong cached_lat"); 
299
-                    $iRow++;
300
-                    continue;
301
-                }
302
-                else $cached_lat = doubleval($rows[$ordersFieldsMapping['cached_lat']]);
297
+				if (!$this->validateLatitude($rows[$ordersFieldsMapping['cached_lat']])) {
298
+					array_push($results['fail'],"$iRow --> Wrong cached_lat"); 
299
+					$iRow++;
300
+					continue;
301
+				}
302
+				else $cached_lat = doubleval($rows[$ordersFieldsMapping['cached_lat']]);
303 303
                 
304
-                $cached_lng = 0.000;
304
+				$cached_lng = 0.000;
305 305
                 
306
-                if (!$this->validateLongitude($rows[$ordersFieldsMapping['cached_lng']])) {
307
-                    array_push($results['fail'],"$iRow --> Wrong cached_lng"); 
308
-                    $iRow++;
309
-                    continue;
310
-                }
311
-                else $cached_lng = doubleval($rows[$ordersFieldsMapping['cached_lng']]);
306
+				if (!$this->validateLongitude($rows[$ordersFieldsMapping['cached_lng']])) {
307
+					array_push($results['fail'],"$iRow --> Wrong cached_lng"); 
308
+					$iRow++;
309
+					continue;
310
+				}
311
+				else $cached_lng = doubleval($rows[$ordersFieldsMapping['cached_lng']]);
312 312
                 
313
-                if (isset($ordersFieldsMapping['curbside_lat'])) {
314
-                    if (!$this->validateLatitude($rows[$ordersFieldsMapping['curbside_lat']])) {
315
-                        array_push($results['fail'],"$iRow --> Wrong curbside_lat"); 
316
-                        $iRow++;
317
-                        continue;
318
-                    }
319
-                }
313
+				if (isset($ordersFieldsMapping['curbside_lat'])) {
314
+					if (!$this->validateLatitude($rows[$ordersFieldsMapping['curbside_lat']])) {
315
+						array_push($results['fail'],"$iRow --> Wrong curbside_lat"); 
316
+						$iRow++;
317
+						continue;
318
+					}
319
+				}
320 320
                 
321
-                if (isset($ordersFieldsMapping['curbside_lng'])) {
322
-                    if (!$this->validateLongitude($rows[$ordersFieldsMapping['curbside_lng']])) {
323
-                        array_push($results['fail'],"$iRow --> Wrong curbside_lng"); 
324
-                        $iRow++;
325
-                        continue;
326
-                    }
327
-                }
321
+				if (isset($ordersFieldsMapping['curbside_lng'])) {
322
+					if (!$this->validateLongitude($rows[$ordersFieldsMapping['curbside_lng']])) {
323
+						array_push($results['fail'],"$iRow --> Wrong curbside_lng"); 
324
+						$iRow++;
325
+						continue;
326
+					}
327
+				}
328 328
                 
329
-                $address = $rows[$ordersFieldsMapping['address_1']];
329
+				$address = $rows[$ordersFieldsMapping['address_1']];
330 330
                 
331
-                if (isset($ordersFieldsMapping['order_city'])) $address.=', '.$rows[$ordersFieldsMapping['order_city']];
332
-                if (isset($ordersFieldsMapping['order_state_id'])) $address.=', '.$rows[$ordersFieldsMapping['order_state_id']];
333
-                if (isset($ordersFieldsMapping['order_zip_code'])) $address.=', '.$rows[$ordersFieldsMapping['order_zip_code']];
334
-                if (isset($ordersFieldsMapping['order_country_id'])) $address.=', '.$rows[$ordersFieldsMapping['order_country_id']];
331
+				if (isset($ordersFieldsMapping['order_city'])) $address.=', '.$rows[$ordersFieldsMapping['order_city']];
332
+				if (isset($ordersFieldsMapping['order_state_id'])) $address.=', '.$rows[$ordersFieldsMapping['order_state_id']];
333
+				if (isset($ordersFieldsMapping['order_zip_code'])) $address.=', '.$rows[$ordersFieldsMapping['order_zip_code']];
334
+				if (isset($ordersFieldsMapping['order_country_id'])) $address.=', '.$rows[$ordersFieldsMapping['order_country_id']];
335 335
                 
336
-                echo "$iRow --> ".$ordersFieldsMapping['day_scheduled_for_YYMMDD'].", ".$rows[$ordersFieldsMapping['day_scheduled_for_YYMMDD']]."<br>";
336
+				echo "$iRow --> ".$ordersFieldsMapping['day_scheduled_for_YYMMDD'].", ".$rows[$ordersFieldsMapping['day_scheduled_for_YYMMDD']]."<br>";
337 337
                 
338
-                $orderParameters = Order::fromArray(array(
339
-                    "cached_lat"                => $cached_lat,
340
-                    "cached_lng"                => $cached_lng,
341
-                    "curbside_lat"              => isset($ordersFieldsMapping['curbside_lat']) ? $rows[$ordersFieldsMapping['curbside_lat']] : null,
342
-                    "curbside_lng"              => isset($ordersFieldsMapping['curbside_lng']) ? $rows[$ordersFieldsMapping['curbside_lng']] : null,
343
-                    "color"                     => isset($ordersFieldsMapping['color']) ? $rows[$ordersFieldsMapping['color']] : null,
344
-                    "day_scheduled_for_YYMMDD"  => isset($ordersFieldsMapping['day_scheduled_for_YYMMDD'])
345
-                                                      ? $rows[$ordersFieldsMapping['day_scheduled_for_YYMMDD']] : null,
346
-                    "address_alias"             => isset($ordersFieldsMapping['address_alias']) ? $rows[$ordersFieldsMapping['address_alias']] : null,
347
-                    "address_1"                 => $address,
348
-                    "address_2"                 => isset($ordersFieldsMapping['address_2']) ? $rows[$ordersFieldsMapping['address_2']] : null,
349
-                    "local_time_window_start"   => isset($ordersFieldsMapping['local_time_window_start'])
350
-                                                      ? $rows[$ordersFieldsMapping['local_time_window_start']] : null,
351
-                    "local_time_window_end"     => isset($ordersFieldsMapping['local_time_window_end'])
352
-                                                      ? $rows[$ordersFieldsMapping['local_time_window_end']] : null,
353
-                    "local_time_window_start_2" => isset($ordersFieldsMapping['local_time_window_start_2'])
354
-                                                      ? $rows[$ordersFieldsMapping['local_time_window_start_2']] : null,
355
-                    "local_time_window_end_2"   => isset($ordersFieldsMapping['local_time_window_end_2'])
356
-                                                      ? $rows[$ordersFieldsMapping['local_time_window_end_2']] : null,
357
-                    "service_time"              => isset($ordersFieldsMapping['service_time'])
358
-                                                      ? $rows[$ordersFieldsMapping['service_time']] : null,
359
-                    "EXT_FIELD_first_name"      => isset($ordersFieldsMapping['EXT_FIELD_first_name'])
360
-                                                      ? $rows[$ordersFieldsMapping['EXT_FIELD_first_name']] : null,
361
-                    "EXT_FIELD_last_name"       => isset($ordersFieldsMapping['EXT_FIELD_last_name'])
362
-                                                      ? $rows[$ordersFieldsMapping['EXT_FIELD_last_name']] : null,
363
-                    "EXT_FIELD_email"           => isset($ordersFieldsMapping['EXT_FIELD_email'])
364
-                                                      ? $rows[$ordersFieldsMapping['EXT_FIELD_email']] : null,
365
-                    "EXT_FIELD_phone"           => isset($ordersFieldsMapping['EXT_FIELD_phone'])
366
-                                                      ? $rows[$ordersFieldsMapping['EXT_FIELD_phone']] : null,
367
-                    "EXT_FIELD_custom_data"     => isset($ordersFieldsMapping['EXT_FIELD_custom_data'])
368
-                                                      ? $rows[$ordersFieldsMapping['EXT_FIELD_custom_data']] : null,
369
-                    "order_icon"                => isset($ordersFieldsMapping['order_icon']) ? $rows[$ordersFieldsMapping['order_icon']] : null,
370
-                ));
338
+				$orderParameters = Order::fromArray(array(
339
+					"cached_lat"                => $cached_lat,
340
+					"cached_lng"                => $cached_lng,
341
+					"curbside_lat"              => isset($ordersFieldsMapping['curbside_lat']) ? $rows[$ordersFieldsMapping['curbside_lat']] : null,
342
+					"curbside_lng"              => isset($ordersFieldsMapping['curbside_lng']) ? $rows[$ordersFieldsMapping['curbside_lng']] : null,
343
+					"color"                     => isset($ordersFieldsMapping['color']) ? $rows[$ordersFieldsMapping['color']] : null,
344
+					"day_scheduled_for_YYMMDD"  => isset($ordersFieldsMapping['day_scheduled_for_YYMMDD'])
345
+													  ? $rows[$ordersFieldsMapping['day_scheduled_for_YYMMDD']] : null,
346
+					"address_alias"             => isset($ordersFieldsMapping['address_alias']) ? $rows[$ordersFieldsMapping['address_alias']] : null,
347
+					"address_1"                 => $address,
348
+					"address_2"                 => isset($ordersFieldsMapping['address_2']) ? $rows[$ordersFieldsMapping['address_2']] : null,
349
+					"local_time_window_start"   => isset($ordersFieldsMapping['local_time_window_start'])
350
+													  ? $rows[$ordersFieldsMapping['local_time_window_start']] : null,
351
+					"local_time_window_end"     => isset($ordersFieldsMapping['local_time_window_end'])
352
+													  ? $rows[$ordersFieldsMapping['local_time_window_end']] : null,
353
+					"local_time_window_start_2" => isset($ordersFieldsMapping['local_time_window_start_2'])
354
+													  ? $rows[$ordersFieldsMapping['local_time_window_start_2']] : null,
355
+					"local_time_window_end_2"   => isset($ordersFieldsMapping['local_time_window_end_2'])
356
+													  ? $rows[$ordersFieldsMapping['local_time_window_end_2']] : null,
357
+					"service_time"              => isset($ordersFieldsMapping['service_time'])
358
+													  ? $rows[$ordersFieldsMapping['service_time']] : null,
359
+					"EXT_FIELD_first_name"      => isset($ordersFieldsMapping['EXT_FIELD_first_name'])
360
+													  ? $rows[$ordersFieldsMapping['EXT_FIELD_first_name']] : null,
361
+					"EXT_FIELD_last_name"       => isset($ordersFieldsMapping['EXT_FIELD_last_name'])
362
+													  ? $rows[$ordersFieldsMapping['EXT_FIELD_last_name']] : null,
363
+					"EXT_FIELD_email"           => isset($ordersFieldsMapping['EXT_FIELD_email'])
364
+													  ? $rows[$ordersFieldsMapping['EXT_FIELD_email']] : null,
365
+					"EXT_FIELD_phone"           => isset($ordersFieldsMapping['EXT_FIELD_phone'])
366
+													  ? $rows[$ordersFieldsMapping['EXT_FIELD_phone']] : null,
367
+					"EXT_FIELD_custom_data"     => isset($ordersFieldsMapping['EXT_FIELD_custom_data'])
368
+													  ? $rows[$ordersFieldsMapping['EXT_FIELD_custom_data']] : null,
369
+					"order_icon"                => isset($ordersFieldsMapping['order_icon']) ? $rows[$ordersFieldsMapping['order_icon']] : null,
370
+				));
371 371
                 
372
-                $order = new Order();
372
+				$order = new Order();
373 373
                 
374
-                $orderResults = $order->addOrder($orderParameters);
374
+				$orderResults = $order->addOrder($orderParameters);
375 375
                 
376
-                array_push($results['success'],"The order with order_id = ".strval($orderResults["order_id"])." added successfuly.");
377
-            }
378
-            else {
379
-                array_push($results['fail'],"$iRow --> one of the parameters cached_lat, cached_lng, address_1 is not set"); 
380
-            }
376
+				array_push($results['success'],"The order with order_id = ".strval($orderResults["order_id"])." added successfuly.");
377
+			}
378
+			else {
379
+				array_push($results['fail'],"$iRow --> one of the parameters cached_lat, cached_lng, address_1 is not set"); 
380
+			}
381 381
             
382
-            $iRow++;
383
-        }
384
-    }
382
+			$iRow++;
383
+		}
384
+	}
385 385
 }
Please login to merge, or discard this patch.
src/Route4Me/Route4Me.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -200,6 +200,9 @@
 block discarded – undo
200 200
         }
201 201
     }
202 202
 
203
+    /**
204
+     * @param \SimpleXMLElement $object
205
+     */
203 206
     public static function object2array($object)
204 207
     {
205 208
         return @json_decode(@json_encode($object),1);
Please login to merge, or discard this patch.
Indentation   +282 added lines, -282 removed lines patch added patch discarded remove patch
@@ -7,341 +7,341 @@
 block discarded – undo
7 7
 
8 8
 class Route4Me
9 9
 {
10
-    static public $apiKey;
11
-    static public $baseUrl = Endpoint::BASE_URL;
10
+	static public $apiKey;
11
+	static public $baseUrl = Endpoint::BASE_URL;
12 12
 
13
-    public static function setApiKey($apiKey)
14
-    {
15
-        self::$apiKey = $apiKey;
16
-    }
13
+	public static function setApiKey($apiKey)
14
+	{
15
+		self::$apiKey = $apiKey;
16
+	}
17 17
 
18
-    public static function getApiKey()
19
-    {
20
-        return self::$apiKey;
21
-    }
18
+	public static function getApiKey()
19
+	{
20
+		return self::$apiKey;
21
+	}
22 22
 
23
-    public static function setBaseUrl($baseUrl)
24
-    {
25
-        self::$baseUrl = $baseUrl;
26
-    }
23
+	public static function setBaseUrl($baseUrl)
24
+	{
25
+		self::$baseUrl = $baseUrl;
26
+	}
27 27
 
28
-    public static function getBaseUrl()
29
-    {
30
-        return self::$baseUrl;
31
-    }
28
+	public static function getBaseUrl()
29
+	{
30
+		return self::$baseUrl;
31
+	}
32 32
     
33
-    public static function fileUploadRequest($options) {
34
-        $query = isset($options['query']) ?
35
-            array_filter($options['query']) : array();
33
+	public static function fileUploadRequest($options) {
34
+		$query = isset($options['query']) ?
35
+			array_filter($options['query']) : array();
36 36
 
37
-        if (sizeof($query)==0) return null;
37
+		if (sizeof($query)==0) return null;
38 38
 
39
-        $body = isset($options['body']) ?
40
-            array_filter($options['body']) : null;
39
+		$body = isset($options['body']) ?
40
+			array_filter($options['body']) : null;
41 41
             
42
-        $fname = isset($body['strFilename']) ? $body['strFilename'] : '';
43
-        if ($fname=='') return null;
42
+		$fname = isset($body['strFilename']) ? $body['strFilename'] : '';
43
+		if ($fname=='') return null;
44 44
 
45
-        $rpath = function_exists('curl_file_create') ? curl_file_create(realpath($fname)) : '@'.realpath($fname);
45
+		$rpath = function_exists('curl_file_create') ? curl_file_create(realpath($fname)) : '@'.realpath($fname);
46 46
         
47
-        $url = self::$baseUrl.$options['url'] . '?' . http_build_query(array_merge(
48
-            array( 'api_key' => self::getApiKey()), $query)
49
-        );
47
+		$url = self::$baseUrl.$options['url'] . '?' . http_build_query(array_merge(
48
+			array( 'api_key' => self::getApiKey()), $query)
49
+		);
50 50
         
51
-        $ch = curl_init($url);
51
+		$ch = curl_init($url);
52 52
         
53
-        $curlOpts = array(
54
-            CURLOPT_POST => true,
55
-            CURLOPT_RETURNTRANSFER => false,
56
-            CURLOPT_TIMEOUT        => 60,
57
-            CURLOPT_FOLLOWLOCATION => true,
58
-            CURLOPT_SSL_VERIFYHOST => FALSE,
59
-            CURLOPT_SSL_VERIFYPEER => FALSE
60
-        );
53
+		$curlOpts = array(
54
+			CURLOPT_POST => true,
55
+			CURLOPT_RETURNTRANSFER => false,
56
+			CURLOPT_TIMEOUT        => 60,
57
+			CURLOPT_FOLLOWLOCATION => true,
58
+			CURLOPT_SSL_VERIFYHOST => FALSE,
59
+			CURLOPT_SSL_VERIFYPEER => FALSE
60
+		);
61 61
         
62
-        curl_setopt_array($ch, $curlOpts);
62
+		curl_setopt_array($ch, $curlOpts);
63 63
         
64
-        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
64
+		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
65 65
         
66
-        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
67
-            "Content-Type: multipart/form-data",
68
-            'Content-Disposition: form-data; name="strFilename"'
69
-        ));
70
-        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
71
-        curl_setopt($ch, CURLOPT_POSTFIELDS, array('strFilename' => $rpath)); 
66
+		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
67
+			"Content-Type: multipart/form-data",
68
+			'Content-Disposition: form-data; name="strFilename"'
69
+		));
70
+		curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
71
+		curl_setopt($ch, CURLOPT_POSTFIELDS, array('strFilename' => $rpath)); 
72 72
         
73
-        $result = curl_exec($ch);
73
+		$result = curl_exec($ch);
74 74
 
75
-        $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
76
-        curl_close($ch);
75
+		$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
76
+		curl_close($ch);
77 77
 
78
-        $json = json_decode($result, true);
78
+		$json = json_decode($result, true);
79 79
         
80
-        if (200 == $code) {
81
-            return $json;
82
-        } elseif (isset($json['errors'])) {
83
-            throw new ApiError(implode(', ', $json['errors']));
84
-        } else {
85
-            throw new ApiError('Something wrong');
86
-        }
87
-    }
80
+		if (200 == $code) {
81
+			return $json;
82
+		} elseif (isset($json['errors'])) {
83
+			throw new ApiError(implode(', ', $json['errors']));
84
+		} else {
85
+			throw new ApiError('Something wrong');
86
+		}
87
+	}
88 88
 
89
-    public static function makeRequst($options) {
90
-        $errorHandler = new myErrorHandler();
89
+	public static function makeRequst($options) {
90
+		$errorHandler = new myErrorHandler();
91 91
         
92
-        $old_error_handler = set_error_handler(array( $errorHandler, "proc_error"));
93
-        $method = isset($options['method']) ? $options['method'] : 'GET';
94
-        $query = isset($options['query']) ?
95
-            array_filter($options['query'], function($x) { return !is_null($x); } ) : array();
92
+		$old_error_handler = set_error_handler(array( $errorHandler, "proc_error"));
93
+		$method = isset($options['method']) ? $options['method'] : 'GET';
94
+		$query = isset($options['query']) ?
95
+			array_filter($options['query'], function($x) { return !is_null($x); } ) : array();
96 96
 
97
-        $body = isset($options['body']) ? $options['body'] : null;
98
-        $file = isset($options['FILE']) ? $options['FILE'] : null;
99
-        $headers = array(
100
-            "User-Agent: Route4Me php-sdk"
101
-        );
97
+		$body = isset($options['body']) ? $options['body'] : null;
98
+		$file = isset($options['FILE']) ? $options['FILE'] : null;
99
+		$headers = array(
100
+			"User-Agent: Route4Me php-sdk"
101
+		);
102 102
         
103
-        if (isset($options['HTTPHEADER'])) {
104
-            $headers[]=$options['HTTPHEADER'];
105
-        }
103
+		if (isset($options['HTTPHEADER'])) {
104
+			$headers[]=$options['HTTPHEADER'];
105
+		}
106 106
          
107
-        if (isset($options['HTTPHEADERS'])) {
108
-            foreach ($options['HTTPHEADERS'] As $header) $headers[]=$header;
109
-        }
107
+		if (isset($options['HTTPHEADERS'])) {
108
+			foreach ($options['HTTPHEADERS'] As $header) $headers[]=$header;
109
+		}
110 110
 
111
-        $ch = curl_init();
112
-        $url = $options['url'] . '?' . http_build_query(array_merge(
113
-            $query, array( 'api_key' => self::getApiKey())
114
-        ));
111
+		$ch = curl_init();
112
+		$url = $options['url'] . '?' . http_build_query(array_merge(
113
+			$query, array( 'api_key' => self::getApiKey())
114
+		));
115 115
 
116
-        $baseUrl=self::getBaseUrl();
116
+		$baseUrl=self::getBaseUrl();
117 117
 
118
-        $curlOpts = arraY(
119
-            CURLOPT_URL            => $baseUrl. $url,
120
-            CURLOPT_RETURNTRANSFER => true,
121
-            CURLOPT_TIMEOUT        => 80,
122
-            CURLOPT_FOLLOWLOCATION => true,
123
-            CURLOPT_SSL_VERIFYHOST => FALSE,
124
-            CURLOPT_SSL_VERIFYPEER => FALSE,
125
-            CURLOPT_HTTPHEADER     => $headers
126
-        );
118
+		$curlOpts = arraY(
119
+			CURLOPT_URL            => $baseUrl. $url,
120
+			CURLOPT_RETURNTRANSFER => true,
121
+			CURLOPT_TIMEOUT        => 80,
122
+			CURLOPT_FOLLOWLOCATION => true,
123
+			CURLOPT_SSL_VERIFYHOST => FALSE,
124
+			CURLOPT_SSL_VERIFYPEER => FALSE,
125
+			CURLOPT_HTTPHEADER     => $headers
126
+		);
127 127
         
128
-        curl_setopt_array($ch, $curlOpts);
128
+		curl_setopt_array($ch, $curlOpts);
129 129
         
130
-        if ($file !=null) {
131
-            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
132
-            $fp=fopen($file,'r');
133
-            curl_setopt($ch, CURLOPT_INFILE , $fp);
134
-            curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file));
135
-        }
130
+		if ($file !=null) {
131
+			curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
132
+			$fp=fopen($file,'r');
133
+			curl_setopt($ch, CURLOPT_INFILE , $fp);
134
+			curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file));
135
+		}
136 136
 
137
-        switch($method) {
138
-        case 'DELETE':
139
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
137
+		switch($method) {
138
+		case 'DELETE':
139
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
140 140
 
141
-            if (isset($body)) {
141
+			if (isset($body)) {
142 142
                 
143
-                curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
144
-            }
145
-            break;
146
-        case 'DELETEARRAY':
147
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
148
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
149
-            break;
150
-        case 'PUT':
151
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
143
+				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
144
+			}
145
+			break;
146
+		case 'DELETEARRAY':
147
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
148
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
149
+			break;
150
+		case 'PUT':
151
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
152 152
 
153
-            if (isset($body)) {
154
-                curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
155
-            }
156
-            break;
157
-        case 'POST':
158
-           if (isset($body)) {
159
-                $bodyData = json_encode($body);
160
-               if (isset($options['HTTPHEADER'])) {
161
-                  if (strpos($options['HTTPHEADER'], "multipart/form-data")>0) $bodyData = $body;
162
-               }
153
+			if (isset($body)) {
154
+				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
155
+			}
156
+			break;
157
+		case 'POST':
158
+		   if (isset($body)) {
159
+				$bodyData = json_encode($body);
160
+			   if (isset($options['HTTPHEADER'])) {
161
+				  if (strpos($options['HTTPHEADER'], "multipart/form-data")>0) $bodyData = $body;
162
+			   }
163 163
                
164
-               curl_setopt($ch, CURLOPT_POSTFIELDS, $bodyData); 
165
-            } 
166
-            break;
167
-        case 'ADD':
168
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
169
-        }
164
+			   curl_setopt($ch, CURLOPT_POSTFIELDS, $bodyData); 
165
+			} 
166
+			break;
167
+		case 'ADD':
168
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
169
+		}
170 170
 
171
-        $result = curl_exec($ch);
171
+		$result = curl_exec($ch);
172 172
         
173
-        $isxml=FALSE;
174
-        $jxml="";
175
-        if (strpos($result, '<?xml')>-1)
176
-        {
177
-            $xml = simplexml_load_string($result);
178
-            //$jxml = json_encode($xml);
179
-            $jxml=self::object2array($xml);
180
-            $isxml = TRUE;
181
-        }
173
+		$isxml=FALSE;
174
+		$jxml="";
175
+		if (strpos($result, '<?xml')>-1)
176
+		{
177
+			$xml = simplexml_load_string($result);
178
+			//$jxml = json_encode($xml);
179
+			$jxml=self::object2array($xml);
180
+			$isxml = TRUE;
181
+		}
182 182
         
183
-        $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
184
-        curl_close($ch);
183
+		$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
184
+		curl_close($ch);
185 185
         
186
-        if (200 == $code) {
187
-            if ($isxml) {
188
-                $json = $jxml;
189
-            } else $json = json_decode($result, true);
186
+		if (200 == $code) {
187
+			if ($isxml) {
188
+				$json = $jxml;
189
+			} else $json = json_decode($result, true);
190 190
             
191
-            if (isset($json['errors'])) {
192
-                throw new ApiError(implode(', ', $json['errors']));
193
-            } else {
194
-                return $json;
195
-            }
196
-        }  elseif (409 == $code) {
197
-            throw new ApiError('Wrong API key');
198
-        } else {
199
-            throw new ApiError('Something wrong');
200
-        }
201
-    }
191
+			if (isset($json['errors'])) {
192
+				throw new ApiError(implode(', ', $json['errors']));
193
+			} else {
194
+				return $json;
195
+			}
196
+		}  elseif (409 == $code) {
197
+			throw new ApiError('Wrong API key');
198
+		} else {
199
+			throw new ApiError('Something wrong');
200
+		}
201
+	}
202 202
 
203
-    public static function object2array($object)
204
-    {
205
-        return @json_decode(@json_encode($object),1);
206
-    }
203
+	public static function object2array($object)
204
+	{
205
+		return @json_decode(@json_encode($object),1);
206
+	}
207 207
 
208
-    public static function makeUrlRequst($url, $options) {
209
-        $method = isset($options['method']) ? $options['method'] : 'GET';
210
-        $query = isset($options['query']) ?
211
-            array_filter($options['query'], function($x) { return !is_null($x); } ) : array();
212
-        $body = isset($options['body']) ? $options['body'] : null;
213
-        $ch = curl_init();
208
+	public static function makeUrlRequst($url, $options) {
209
+		$method = isset($options['method']) ? $options['method'] : 'GET';
210
+		$query = isset($options['query']) ?
211
+			array_filter($options['query'], function($x) { return !is_null($x); } ) : array();
212
+		$body = isset($options['body']) ? $options['body'] : null;
213
+		$ch = curl_init();
214 214
         
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
-        );
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
+		);
226 226
         
227
-        curl_setopt_array($ch, $curlOpts);
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
-            if (isset($body)) {
234
-                curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
235
-            }
236
-            break;
237
-        case 'DELETEARRAY':
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");
243
-            if (isset($query)) {
244
-                curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
245
-            }
233
+			if (isset($body)) {
234
+				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
235
+			}
236
+			break;
237
+		case 'DELETEARRAY':
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");
243
+			if (isset($query)) {
244
+				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
245
+			}
246 246
 
247
-            if (isset($body)) {
248
-                curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
249
-            }
250
-            break;
251
-        case 'POST':
252
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); 
253
-            if (isset($query)) {
254
-                curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); 
255
-            }
247
+			if (isset($body)) {
248
+				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
249
+			}
250
+			break;
251
+		case 'POST':
252
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); 
253
+			if (isset($query)) {
254
+				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); 
255
+			}
256 256
 
257
-            if (isset($body)) {
258
-                curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
259
-            } 
260
-            break;
261
-        case 'ADD':
262
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
263
-        }
257
+			if (isset($body)) {
258
+				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
259
+			} 
260
+			break;
261
+		case 'ADD':
262
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
263
+		}
264 264
 
265
-        $result = curl_exec($ch);
265
+		$result = curl_exec($ch);
266 266
         
267
-        $isxml=FALSE;
268
-        $jxml="";
269
-        if (strpos($result, '<?xml')>-1)
270
-        {
271
-            $xml = simplexml_load_string($result);
272
-            $jxml = json_encode($xml);
273
-            $isxml = TRUE;
274
-        }
267
+		$isxml=FALSE;
268
+		$jxml="";
269
+		if (strpos($result, '<?xml')>-1)
270
+		{
271
+			$xml = simplexml_load_string($result);
272
+			$jxml = json_encode($xml);
273
+			$isxml = TRUE;
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
-        if ($isxml) {
280
-            $json = $jxml;
281
-        } else $json = json_decode($result, true);
279
+		if ($isxml) {
280
+			$json = $jxml;
281
+		} else $json = json_decode($result, true);
282 282
         
283
-        if (200 == $code) {
284
-            return $json;
285
-        } elseif (isset($json['errors'])) {
286
-            throw new ApiError(implode(', ', $json['errors']));
287
-        } else {
288
-            throw new ApiError('Something wrong');
289
-        }
290
-    }
283
+		if (200 == $code) {
284
+			return $json;
285
+		} elseif (isset($json['errors'])) {
286
+			throw new ApiError(implode(', ', $json['errors']));
287
+		} else {
288
+			throw new ApiError('Something wrong');
289
+		}
290
+	}
291 291
     
292
-    /**
293
-     * Prints on the screen main keys and values of the array 
294
-     *
295
-     */
296
-    public static function simplePrint($results, $deepPrinting=null)
297
-    {
298
-        if (isset($results)) {
299
-            if (is_array($results)) {
300
-                foreach ($results as $key=>$result) {
301
-                    if (is_array($result)) {
302
-                        foreach ($result as $key1=>$result1) {
303
-                            if (is_array($result1)) {
304
-                                  if ($deepPrinting) {
305
-                                      echo "<br>$key1 ------><br>";
306
-                                      Route4Me::simplePrint($result1,true);
307
-                                      echo "------<br>";
308
-                                  } else {
309
-                                      echo $key1." --> "."Array() <br>";
310
-                                  } 
311
-                            } else {
312
-                                if (is_object($result1)) {
313
-                                    if ($deepPrinting) {
314
-                                        echo "<br>$key1 ------><br>";
315
-                                        $oarray=(array)$result1;
316
-                                        Route4Me::simplePrint($oarray,true);
317
-                                        echo "------<br>";
318
-                                    } else {
319
-                                        echo $key1." --> "."Object <br>";
320
-                                    } 
321
-                                } else {
322
-                                    if (!is_null($result1)) echo $key1." --> ".$result1."<br>";    
323
-                                }
324
-                            }
325
-                        }
326
-                    } else {
327
-                        if (is_object($result)) {
328
-                            if ($deepPrinting) {
329
-                                echo "<br>$key ------><br>";
330
-                                $oarray=(array)$result;
331
-                                Route4Me::simplePrint($oarray,true);
332
-                                echo "------<br>";
333
-                            } else {
334
-                                echo $key." --> "."Object <br>";
335
-                            } 
336
-                        } else {
337
-                            if (!is_null($result)) echo $key." --> ".$result."<br>";
338
-                        }
292
+	/**
293
+	 * Prints on the screen main keys and values of the array 
294
+	 *
295
+	 */
296
+	public static function simplePrint($results, $deepPrinting=null)
297
+	{
298
+		if (isset($results)) {
299
+			if (is_array($results)) {
300
+				foreach ($results as $key=>$result) {
301
+					if (is_array($result)) {
302
+						foreach ($result as $key1=>$result1) {
303
+							if (is_array($result1)) {
304
+								  if ($deepPrinting) {
305
+									  echo "<br>$key1 ------><br>";
306
+									  Route4Me::simplePrint($result1,true);
307
+									  echo "------<br>";
308
+								  } else {
309
+									  echo $key1." --> "."Array() <br>";
310
+								  } 
311
+							} else {
312
+								if (is_object($result1)) {
313
+									if ($deepPrinting) {
314
+										echo "<br>$key1 ------><br>";
315
+										$oarray=(array)$result1;
316
+										Route4Me::simplePrint($oarray,true);
317
+										echo "------<br>";
318
+									} else {
319
+										echo $key1." --> "."Object <br>";
320
+									} 
321
+								} else {
322
+									if (!is_null($result1)) echo $key1." --> ".$result1."<br>";    
323
+								}
324
+							}
325
+						}
326
+					} else {
327
+						if (is_object($result)) {
328
+							if ($deepPrinting) {
329
+								echo "<br>$key ------><br>";
330
+								$oarray=(array)$result;
331
+								Route4Me::simplePrint($oarray,true);
332
+								echo "------<br>";
333
+							} else {
334
+								echo $key." --> "."Object <br>";
335
+							} 
336
+						} else {
337
+							if (!is_null($result)) echo $key." --> ".$result."<br>";
338
+						}
339 339
                         
340
-                    }
341
-                    //echo "<br>";
342
-                }
343
-            } 
344
-        }
345
-    }
340
+					}
341
+					//echo "<br>";
342
+				}
343
+			} 
344
+		}
345
+	}
346 346
 
347 347
 }
Please login to merge, or discard this patch.
examples/Activities/SearchActivities.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -17,19 +17,19 @@
 block discarded – undo
17 17
 
18 18
 // Itereate through all the existing activity types
19 19
 foreach ($activityTypes->getConstants() as $prop => $value) {
20
-    $activityParameters = ActivityParameters::fromArray(array(
21
-        "activity_type" => $value,
22
-        "limit"         => 2,
23
-        "offset"        => 0
24
-    ));
20
+	$activityParameters = ActivityParameters::fromArray(array(
21
+		"activity_type" => $value,
22
+		"limit"         => 2,
23
+		"offset"        => 0
24
+	));
25 25
     
26
-    $activities = new ActivityParameters();
27
-    $results = $activities->searcActivities($activityParameters);
26
+	$activities = new ActivityParameters();
27
+	$results = $activities->searcActivities($activityParameters);
28 28
     
29
-    foreach ($results as $key => $activity) {
30
-        Route4Me::simplePrint($activity);
31
-        echo "<br>";
32
-    }
29
+	foreach ($results as $key => $activity) {
30
+		Route4Me::simplePrint($activity);
31
+		echo "<br>";
32
+	}
33 33
     
34
-    echo "------------------- <br><br>";
34
+	echo "------------------- <br><br>";
35 35
 }
Please login to merge, or discard this patch.
examples/Activities/GetActivities.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
 Route4Me::setApiKey('11111111111111111111111111111111');
15 15
 
16 16
 $activityParameters = ActivityParameters::fromArray(array(
17
-    "limit" => 10,
18
-    "offset" => 0
17
+	"limit" => 10,
18
+	"offset" => 0
19 19
 ));
20 20
 
21 21
 $activities = new ActivityParameters();
@@ -23,6 +23,6 @@  discard block
 block discarded – undo
23 23
 $results = $activities->getValue($actresults, "results");
24 24
 
25 25
 foreach ($results as $result) {
26
-    Route4Me::simplePrint($result);
27
-    echo "<br>";
26
+	Route4Me::simplePrint($result);
27
+	echo "<br>";
28 28
 }
Please login to merge, or discard this patch.
examples/Activities/GetRouteActivities.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -21,20 +21,20 @@
 block discarded – undo
21 21
 
22 22
 // Itereate through all the existing activity types
23 23
 foreach ($activityTypes->getConstants() as $prop => $value) {
24
-    $activityParameters = ActivityParameters::fromArray(array(
25
-        "activity_type" => $value,
26
-        "limit"         => 2,
27
-        "offset"        => 0,
28
-        "route_id"      => $route_id
29
-    ));
24
+	$activityParameters = ActivityParameters::fromArray(array(
25
+		"activity_type" => $value,
26
+		"limit"         => 2,
27
+		"offset"        => 0,
28
+		"route_id"      => $route_id
29
+	));
30 30
     
31
-    $activities = new ActivityParameters();
32
-    $results = $activities->searcActivities($activityParameters);
31
+	$activities = new ActivityParameters();
32
+	$results = $activities->searcActivities($activityParameters);
33 33
     
34
-    foreach ($results as $key => $activity) {
35
-        Route4Me::simplePrint($activity);
36
-        echo "<br>";
37
-    }
34
+	foreach ($results as $key => $activity) {
35
+		Route4Me::simplePrint($activity);
36
+		echo "<br>";
37
+	}
38 38
     
39
-    echo "------------------- <br><br>";
39
+	echo "------------------- <br><br>";
40 40
 }
Please login to merge, or discard this patch.
examples/Activities/GetLastActivities.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
 Route4Me::setApiKey('11111111111111111111111111111111');
17 17
 
18 18
 $activityParameters = ActivityParameters::fromArray(array(
19
-    "limit" => 10,
20
-    "offset" => 0,
21
-    "start" => strtotime("-1 week")
19
+	"limit" => 10,
20
+	"offset" => 0,
21
+	"start" => strtotime("-1 week")
22 22
 ));
23 23
 
24 24
 $activities = new ActivityParameters();
@@ -26,6 +26,6 @@  discard block
 block discarded – undo
26 26
 $results = $activities->getValue($actresults, "results");
27 27
 
28 28
 foreach ($results as $result) {
29
-    Route4Me::simplePrint($result);
30
-    echo "<br>";
29
+	Route4Me::simplePrint($result);
30
+	echo "<br>";
31 31
 }
Please login to merge, or discard this patch.
examples/Activities/SendUserMessage.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@
 block discarded – undo
17 17
 $route_id = $route->getRandomRouteId(0, 10);
18 18
 
19 19
 $postParameters = ActivityParameters::fromArray(array(
20
-    "activity_type"     => "user_message",
21
-    "activity_message"  => "Hello - php!",
22
-    "route_id"          => $route_id
20
+	"activity_type"     => "user_message",
21
+	"activity_message"  => "Hello - php!",
22
+	"route_id"          => $route_id
23 23
 ));
24 24
 
25 25
 $activities = new ActivityParameters();
Please login to merge, or discard this patch.
examples/Activities/GetRouteTeamActivities.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 assert(!is_null($routeId), "can't retrieve random route_id");
21 21
 
22 22
 $activityParameters = ActivityParameters::fromArray(array(
23
-    "route_id"    => $routeId,
24
-    "team"        => "true"
23
+	"route_id"    => $routeId,
24
+	"team"        => "true"
25 25
 ));
26 26
 
27 27
 $activities = new ActivityParameters();
@@ -30,5 +30,5 @@  discard block
 block discarded – undo
30 30
 
31 31
 foreach ($results as $result) {
32 32
 	Route4Me::simplePrint($result);
33
-    echo "<br>";
33
+	echo "<br>";
34 34
 }
Please login to merge, or discard this patch.