GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( df61f9...6c209c )
by Oleg
03:05
created
src/Route4Me/AddressBookLocation.php 1 patch
Indentation   +370 added lines, -370 removed lines patch added patch discarded remove patch
@@ -6,449 +6,449 @@
 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 65
     
66
-    public static function getAddressBookLocation($addressId)
67
-    {
68
-        $ablocations = Route4Me::makeRequst(array(
69
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
70
-            'method' => 'GET',
71
-            'query'  => array(
72
-                'query' => $addressId,
73
-                'limit' => 30
74
-            )
75
-        ));
66
+	public static function getAddressBookLocation($addressId)
67
+	{
68
+		$ablocations = Route4Me::makeRequst(array(
69
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
70
+			'method' => 'GET',
71
+			'query'  => array(
72
+				'query' => $addressId,
73
+				'limit' => 30
74
+			)
75
+		));
76 76
 
77
-        return $ablocations;
78
-    }
77
+		return $ablocations;
78
+	}
79 79
     
80
-    public static function searchAddressBookLocations($params)
81
-    {
82
-        $allQueryFields = array('display', 'query', 'fields', 'limit', 'offset');
80
+	public static function searchAddressBookLocations($params)
81
+	{
82
+		$allQueryFields = array('display', 'query', 'fields', 'limit', 'offset');
83 83
         
84
-        $result = Route4Me::makeRequst(array(
85
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
86
-            'method' => 'GET',
87
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
88
-        ));
84
+		$result = Route4Me::makeRequst(array(
85
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
86
+			'method' => 'GET',
87
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
88
+		));
89 89
 
90
-        return $result;
91
-    }
90
+		return $result;
91
+	}
92 92
     
93
-    public static function getAddressBookLocations($params)
94
-    {
95
-        $allQueryFields = array('limit', 'offset', 'address_id');
93
+	public static function getAddressBookLocations($params)
94
+	{
95
+		$allQueryFields = array('limit', 'offset', 'address_id');
96 96
         
97
-        $ablocations = Route4Me::makeRequst(array(
98
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
99
-            'method' => 'GET',
100
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
101
-        ));
97
+		$ablocations = Route4Me::makeRequst(array(
98
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
99
+			'method' => 'GET',
100
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
101
+		));
102 102
 
103
-        return $ablocations;
104
-    }
103
+		return $ablocations;
104
+	}
105 105
     
106
-    public static function getRandomAddressBookLocation($params)
107
-    {
108
-        $ablocations = self::getAddressBookLocations($params);
106
+	public static function getRandomAddressBookLocation($params)
107
+	{
108
+		$ablocations = self::getAddressBookLocations($params);
109 109
         
110
-        if (isset($ablocations["results"])) {
111
-            $locationsSize = sizeof($ablocations["results"]);
110
+		if (isset($ablocations["results"])) {
111
+			$locationsSize = sizeof($ablocations["results"]);
112 112
             
113
-            if ($locationsSize>0) {
114
-                $randomLocationIndex = rand(0, $locationsSize - 1);
115
-                return $ablocations["results"][$randomLocationIndex];
116
-            } 
117
-        } 
113
+			if ($locationsSize>0) {
114
+				$randomLocationIndex = rand(0, $locationsSize - 1);
115
+				return $ablocations["results"][$randomLocationIndex];
116
+			} 
117
+		} 
118 118
 
119
-        return null;
120
-    }
119
+		return null;
120
+	}
121 121
     
122
-    /**
123
-     * @param AddressBookLocation $params
124
-    */
125
-    public static function addAdressBookLocation($params)
126
-    {
127
-        $allBodyFields = Route4Me::getObjectProperties(new AddressBookLocation(), array('address_id', 'in_route_count'));
122
+	/**
123
+	 * @param AddressBookLocation $params
124
+	 */
125
+	public static function addAdressBookLocation($params)
126
+	{
127
+		$allBodyFields = Route4Me::getObjectProperties(new AddressBookLocation(), array('address_id', 'in_route_count'));
128 128
         
129
-        $response = Route4Me::makeRequst(array(
130
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
131
-            'method' => 'POST',
132
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
133
-        ));
129
+		$response = Route4Me::makeRequst(array(
130
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
131
+			'method' => 'POST',
132
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
133
+		));
134 134
 
135
-        return $response;
136
-    }
135
+		return $response;
136
+	}
137 137
     
138
-    public function deleteAdressBookLocation($address_ids)
139
-    {
140
-        $result = Route4Me::makeRequst(array(
141
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
142
-            'method' => 'DELETEARRAY',
143
-            'query'  => array(
144
-                'address_ids' => $address_ids
145
-            )
146
-        ));
138
+	public function deleteAdressBookLocation($address_ids)
139
+	{
140
+		$result = Route4Me::makeRequst(array(
141
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
142
+			'method' => 'DELETEARRAY',
143
+			'query'  => array(
144
+				'address_ids' => $address_ids
145
+			)
146
+		));
147 147
 
148
-        return $result;
149
-    }
148
+		return $result;
149
+	}
150 150
     
151
-    public function updateAdressBookLocation($params)
152
-    {
153
-        $allBodyFields = Route4Me::getObjectProperties(new AddressBookLocation(), array('in_route_count'));
151
+	public function updateAdressBookLocation($params)
152
+	{
153
+		$allBodyFields = Route4Me::getObjectProperties(new AddressBookLocation(), array('in_route_count'));
154 154
 
155
-        $response = Route4Me::makeRequst(array(
156
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
157
-            'method' => 'PUT',
158
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
159
-        ));
155
+		$response = Route4Me::makeRequst(array(
156
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
157
+			'method' => 'PUT',
158
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
159
+		));
160 160
 
161
-        return $response;
162
-    }
161
+		return $response;
162
+	}
163 163
         
164
-    public static function validateScheduleMode($scheduleMode)
165
-    {
166
-        $schedMmodes = array("daily", "weekly", "monthly", "annually");
164
+	public static function validateScheduleMode($scheduleMode)
165
+	{
166
+		$schedMmodes = array("daily", "weekly", "monthly", "annually");
167 167
         
168
-        if (in_array($scheduleMode, $schedMmodes)) {
169
-            return TRUE; 
170
-        } else {
171
-            return FALSE;
172
-        }
173
-    }
168
+		if (in_array($scheduleMode, $schedMmodes)) {
169
+			return TRUE; 
170
+		} else {
171
+			return FALSE;
172
+		}
173
+	}
174 174
     
175
-    public static function validateScheduleEnable($scheduleEnabled)
176
-    {
177
-        $schedEnables = array(TRUE, FALSE);
175
+	public static function validateScheduleEnable($scheduleEnabled)
176
+	{
177
+		$schedEnables = array(TRUE, FALSE);
178 178
         
179
-        if (in_array($scheduleEnabled, $schedEnables)) {
180
-            return TRUE;
181
-        } else {
182
-            return FALSE;
183
-        }
184
-    }
179
+		if (in_array($scheduleEnabled, $schedEnables)) {
180
+			return TRUE;
181
+		} else {
182
+			return FALSE;
183
+		}
184
+	}
185 185
     
186
-    public static function validateScheduleEvery($scheduleEvery)
187
-    {
188
-        if (is_numeric($scheduleEvery)) {
189
-            return TRUE;
190
-        } else {
191
-            return FALSE;
192
-        }
193
-    }
186
+	public static function validateScheduleEvery($scheduleEvery)
187
+	{
188
+		if (is_numeric($scheduleEvery)) {
189
+			return TRUE;
190
+		} else {
191
+			return FALSE;
192
+		}
193
+	}
194 194
     
195
-    public static function validateScheduleWeekDays($scheduleWeekDays)
196
-    {
197
-        $weekdays = explode(',', $scheduleWeekDays);
198
-        $weekdaysSize = sizeof($weekdays);
195
+	public static function validateScheduleWeekDays($scheduleWeekDays)
196
+	{
197
+		$weekdays = explode(',', $scheduleWeekDays);
198
+		$weekdaysSize = sizeof($weekdays);
199 199
         
200
-        if ($weekdaysSize<1) {
201
-            return FALSE;
202
-        }
200
+		if ($weekdaysSize<1) {
201
+			return FALSE;
202
+		}
203 203
         
204
-        $isValid = TRUE;
204
+		$isValid = TRUE;
205 205
         
206
-        for ($i = 0; $i<$weekdaysSize; $i++) { 
207
-            if (is_numeric($weekdays[$i])) {
208
-                $wday = intval($weekdays[$i]);
209
-                if ($wday<1 || $wday>7) {
210
-                    $isValid = FALSE;
211
-                }
212
-            } else {
213
-                $isValid = FALSE;
214
-            }
215
-        }
206
+		for ($i = 0; $i<$weekdaysSize; $i++) { 
207
+			if (is_numeric($weekdays[$i])) {
208
+				$wday = intval($weekdays[$i]);
209
+				if ($wday<1 || $wday>7) {
210
+					$isValid = FALSE;
211
+				}
212
+			} else {
213
+				$isValid = FALSE;
214
+			}
215
+		}
216 216
         
217
-        return $isValid;
218
-    }
217
+		return $isValid;
218
+	}
219 219
     
220
-    public static function validateScheduleMonthlyMode($scheduleMonthlyMode)
221
-    {
222
-        $schedMonthlyMmodes = array("dates", "nth");
220
+	public static function validateScheduleMonthlyMode($scheduleMonthlyMode)
221
+	{
222
+		$schedMonthlyMmodes = array("dates", "nth");
223 223
         
224
-        if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes)) {
225
-            return TRUE;
226
-        } else {
227
-            return FALSE;
228
-        }
229
-    }
224
+		if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes)) {
225
+			return TRUE;
226
+		} else {
227
+			return FALSE;
228
+		}
229
+	}
230 230
     
231
-    public static function validateScheduleMonthlyDates($scheduleMonthlyDates)
232
-    {
233
-        $monthlyDates = explode(',', $scheduleMonthlyDates);
234
-        $monthlyDatesSize = sizeof($monthlyDates);
231
+	public static function validateScheduleMonthlyDates($scheduleMonthlyDates)
232
+	{
233
+		$monthlyDates = explode(',', $scheduleMonthlyDates);
234
+		$monthlyDatesSize = sizeof($monthlyDates);
235 235
         
236
-        if ($monthlyDatesSize<1) {
237
-            return FALSE;
238
-        }
236
+		if ($monthlyDatesSize<1) {
237
+			return FALSE;
238
+		}
239 239
         
240
-        $isValid = TRUE;
240
+		$isValid = TRUE;
241 241
         
242
-        for ($i = 0; $i<$monthlyDatesSize; $i++) { 
243
-            if (is_numeric($monthlyDates[$i])) {
244
-                $mday = intval($monthlyDates[$i]);
245
-                if ($mday<1 || $mday>31) {
246
-                    $isValid = FALSE;
247
-                }
248
-            } else {
249
-                $isValid = FALSE;
250
-            }
251
-        }
242
+		for ($i = 0; $i<$monthlyDatesSize; $i++) { 
243
+			if (is_numeric($monthlyDates[$i])) {
244
+				$mday = intval($monthlyDates[$i]);
245
+				if ($mday<1 || $mday>31) {
246
+					$isValid = FALSE;
247
+				}
248
+			} else {
249
+				$isValid = FALSE;
250
+			}
251
+		}
252 252
 
253
-        return $isValid;
254
-    }
253
+		return $isValid;
254
+	}
255 255
     
256
-    public static function validateScheduleNthN($scheduleNthN)
257
-    {
258
-        if (!is_numeric($scheduleNthN)) {
259
-            return FALSE;
260
-        }
256
+	public static function validateScheduleNthN($scheduleNthN)
257
+	{
258
+		if (!is_numeric($scheduleNthN)) {
259
+			return FALSE;
260
+		}
261 261
         
262
-        $schedNthNs = array(1, 2, 3, 4, 5, -1);
262
+		$schedNthNs = array(1, 2, 3, 4, 5, -1);
263 263
         
264
-        if (in_array($scheduleNthN, $schedNthNs)) {
265
-            return TRUE;
266
-        } else {
267
-            return FALSE;
268
-        }
269
-    }
264
+		if (in_array($scheduleNthN, $schedNthNs)) {
265
+			return TRUE;
266
+		} else {
267
+			return FALSE;
268
+		}
269
+	}
270 270
     
271
-    public static function validateScheduleNthWhat($scheduleNthWhat)
272
-    {
273
-        if (!is_numeric($scheduleNthWhat)) {
274
-            return FALSE;
275
-        }
271
+	public static function validateScheduleNthWhat($scheduleNthWhat)
272
+	{
273
+		if (!is_numeric($scheduleNthWhat)) {
274
+			return FALSE;
275
+		}
276 276
         
277
-        $schedNthWhats = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
277
+		$schedNthWhats = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
278 278
         
279
-        if (in_array($scheduleNthWhat, $schedNthWhats)) {
280
-            return TRUE;
281
-        } else {
282
-            return FALSE;
283
-        }
284
-    }
279
+		if (in_array($scheduleNthWhat, $schedNthWhats)) {
280
+			return TRUE;
281
+		} else {
282
+			return FALSE;
283
+		}
284
+	}
285 285
     
286
-    /** Function adds the locations (with/without schedule) from the CSV file. 
287
-     * $csvFileHandle - a file handler.
288
-     * Returns array $results which contains two arrays: fail and succes.
289
-     */
290
-    public function addLocationsFromCsvFile($csvFileHandle, $locationsFieldsMapping)
291
-    {
292
-        $max_line_length = 512;
293
-        $delemietr = ',';
286
+	/** Function adds the locations (with/without schedule) from the CSV file. 
287
+	 * $csvFileHandle - a file handler.
288
+	 * Returns array $results which contains two arrays: fail and succes.
289
+	 */
290
+	public function addLocationsFromCsvFile($csvFileHandle, $locationsFieldsMapping)
291
+	{
292
+		$max_line_length = 512;
293
+		$delemietr = ',';
294 294
         
295
-        $results = array();
296
-        $results['fail'] = array();
297
-        $results['success'] = array();
295
+		$results = array();
296
+		$results['fail'] = array();
297
+		$results['success'] = array();
298 298
         
299
-        $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
299
+		$columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
300 300
         
301
-        $addressBookFields = Route4Me::getObjectProperties(new AddressBookLocation(), array('address_id', 'in_route_count'));
301
+		$addressBookFields = Route4Me::getObjectProperties(new AddressBookLocation(), array('address_id', 'in_route_count'));
302 302
 
303
-        if (empty($columns)) {
304
-            array_push($results['fail'], 'Empty CSV table');
305
-            return ($results);
306
-        }
303
+		if (empty($columns)) {
304
+			array_push($results['fail'], 'Empty CSV table');
305
+			return ($results);
306
+		}
307 307
 
308
-        $iRow = 1;
308
+		$iRow = 1;
309 309
         
310
-        while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))!==false) {
311
-            if (!isset($rows[$locationsFieldsMapping['cached_lat']]) || !isset($rows[$locationsFieldsMapping['cached_lng']]) 
312
-                  || !isset($rows[$locationsFieldsMapping['address_1']]) || array(null)==$rows) {
313
-                continue;
314
-            }
310
+		while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))!==false) {
311
+			if (!isset($rows[$locationsFieldsMapping['cached_lat']]) || !isset($rows[$locationsFieldsMapping['cached_lng']]) 
312
+				  || !isset($rows[$locationsFieldsMapping['address_1']]) || array(null)==$rows) {
313
+				continue;
314
+			}
315 315
                       
316
-            $curSchedule = "";
317
-            $mode = "";
316
+			$curSchedule = "";
317
+			$mode = "";
318 318
             
319
-            $failCount = sizeof($results['fail']); 
319
+			$failCount = sizeof($results['fail']); 
320 320
             
321
-            if (isset($rows[$locationsFieldsMapping['schedule_mode']])) {
322
-                if ($this->validateScheduleMode($rows[$locationsFieldsMapping['schedule_mode']])) {
323
-                    $curSchedule = '"mode":"'.$rows[$locationsFieldsMapping['schedule_mode']].'",'; 
324
-                    $mode = $rows[$locationsFieldsMapping['schedule_mode']];
325
-                } else {
326
-                    array_push($results['fail'], "$iRow --> Wrong schedule mode parameter"); 
327
-                }
328
-            } else {
329
-                array_push($results['fail'], "$iRow --> The schedule mode parameter is not set"); 
330
-            }
321
+			if (isset($rows[$locationsFieldsMapping['schedule_mode']])) {
322
+				if ($this->validateScheduleMode($rows[$locationsFieldsMapping['schedule_mode']])) {
323
+					$curSchedule = '"mode":"'.$rows[$locationsFieldsMapping['schedule_mode']].'",'; 
324
+					$mode = $rows[$locationsFieldsMapping['schedule_mode']];
325
+				} else {
326
+					array_push($results['fail'], "$iRow --> Wrong schedule mode parameter"); 
327
+				}
328
+			} else {
329
+				array_push($results['fail'], "$iRow --> The schedule mode parameter is not set"); 
330
+			}
331 331
             
332
-            if (isset($rows[$locationsFieldsMapping['schedule_enabled']])) {
333
-                if ($this->validateScheduleEnable($rows[$locationsFieldsMapping['schedule_enabled']])) { 
334
-                    $curSchedule .= '"enabled":'.$rows[$locationsFieldsMapping['schedule_enabled']].',';
335
-                } else {
336
-                    array_push($results['fail'], "$iRow --> The schedule enabled parameter is not set ");  
337
-                }
338
-            }
332
+			if (isset($rows[$locationsFieldsMapping['schedule_enabled']])) {
333
+				if ($this->validateScheduleEnable($rows[$locationsFieldsMapping['schedule_enabled']])) { 
334
+					$curSchedule .= '"enabled":'.$rows[$locationsFieldsMapping['schedule_enabled']].',';
335
+				} else {
336
+					array_push($results['fail'], "$iRow --> The schedule enabled parameter is not set ");  
337
+				}
338
+			}
339 339
             
340
-            if (isset($rows[$locationsFieldsMapping['schedule_every']])) {
341
-                if ($this->validateScheduleEvery($rows[$locationsFieldsMapping['schedule_every']])) {
342
-                    $curSchedule .= '"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; 
343
-                    if ($mode=='daily') {
344
-                        $curSchedule = trim($curSchedule, ',');
345
-                        $curSchedule .= '}';
346
-                    }
347
-                } else {
348
-                    array_push($results['fail'], "$iRow --> The parameter sched_every is not set"); 
349
-                }
350
-            }
340
+			if (isset($rows[$locationsFieldsMapping['schedule_every']])) {
341
+				if ($this->validateScheduleEvery($rows[$locationsFieldsMapping['schedule_every']])) {
342
+					$curSchedule .= '"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; 
343
+					if ($mode=='daily') {
344
+						$curSchedule = trim($curSchedule, ',');
345
+						$curSchedule .= '}';
346
+					}
347
+				} else {
348
+					array_push($results['fail'], "$iRow --> The parameter sched_every is not set"); 
349
+				}
350
+			}
351 351
             
352
-            if ($mode!='daily') {
353
-                switch ($mode) {
354
-                    case 'weekly':
355
-                        if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) {
356
-                            if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) {
357
-                                 $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}';
358
-                            } else {
359
-                                array_push($results['fail'], "$iRow --> Wrong weekdays"); 
360
-                            }
361
-                        } else {
362
-                            array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); 
363
-                        }
364
-                        break;
365
-                    case 'monthly':
366
-                        $monthlyMode = "";
367
-                        if (isset($rows[$locationsFieldsMapping['monthly_mode']])) {
368
-                            if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) {
369
-                                 $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']];
370
-                                 $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",';
371
-                            } else {
372
-                                array_push($results['fail'], "$iRow --> Wrong monthly mode"); 
373
-                            }
374
-                        } else {
375
-                            array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); 
376
-                        }
352
+			if ($mode!='daily') {
353
+				switch ($mode) {
354
+					case 'weekly':
355
+						if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) {
356
+							if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) {
357
+								 $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}';
358
+							} else {
359
+								array_push($results['fail'], "$iRow --> Wrong weekdays"); 
360
+							}
361
+						} else {
362
+							array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); 
363
+						}
364
+						break;
365
+					case 'monthly':
366
+						$monthlyMode = "";
367
+						if (isset($rows[$locationsFieldsMapping['monthly_mode']])) {
368
+							if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) {
369
+								 $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']];
370
+								 $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",';
371
+							} else {
372
+								array_push($results['fail'], "$iRow --> Wrong monthly mode"); 
373
+							}
374
+						} else {
375
+							array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); 
376
+						}
377 377
                         
378
-                        if ($monthlyMode!="") {
379
-                            switch ($monthlyMode) {
380
-                                case 'dates':
381
-                                    if (isset($rows[$locationsFieldsMapping['monthly_dates']])) {
382
-                                        if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) {
383
-                                             $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}';
384
-                                        } else {
385
-                                            array_push($results['fail'], "$iRow --> Wrong monthly dates"); 
386
-                                        }
387
-                                    }
388
-                                    break;
389
-                                case 'nth':
390
-                                    if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) {
391
-                                        if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) {
392
-                                             $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].',';
393
-                                        } else {
394
-                                            array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); 
395
-                                        }
396
-                                    } else {
397
-                                        array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); 
398
-                                    }
378
+						if ($monthlyMode!="") {
379
+							switch ($monthlyMode) {
380
+								case 'dates':
381
+									if (isset($rows[$locationsFieldsMapping['monthly_dates']])) {
382
+										if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) {
383
+											 $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}';
384
+										} else {
385
+											array_push($results['fail'], "$iRow --> Wrong monthly dates"); 
386
+										}
387
+									}
388
+									break;
389
+								case 'nth':
390
+									if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) {
391
+										if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) {
392
+											 $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].',';
393
+										} else {
394
+											array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); 
395
+										}
396
+									} else {
397
+										array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); 
398
+									}
399 399
                                     
400
-                                    if ($curSchedule!="") {
401
-                                        if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
402
-                                            if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
403
-                                                 $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}';
404
-                                            } else {
405
-                                                array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); 
406
-                                            }
407
-                                        } else {
408
-                                            array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); 
409
-                                        }
410
-                                    }
411
-                                    break;
412
-                            }
413
-                        }
414
-                        break;
415
-                    default:
416
-                        $curSchedule = "";
417
-                        break;
418
-                }
419
-            }
400
+									if ($curSchedule!="") {
401
+										if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
402
+											if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
403
+												 $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}';
404
+											} else {
405
+												array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); 
406
+											}
407
+										} else {
408
+											array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); 
409
+										}
410
+									}
411
+									break;
412
+							}
413
+						}
414
+						break;
415
+					default:
416
+						$curSchedule = "";
417
+						break;
418
+				}
419
+			}
420 420
 
421
-            if (sizeof($results['fail'])>$failCount) {
422
-                $curSchedule = "";
423
-            }
421
+			if (sizeof($results['fail'])>$failCount) {
422
+				$curSchedule = "";
423
+			}
424 424
 
425
-            if (($mode=='daily' || $mode=='weekly' || $mode=='monthy') && $curSchedule=="") {
426
-                $iRow++; 
427
-                continue;
428
-            }
425
+			if (($mode=='daily' || $mode=='weekly' || $mode=='monthy') && $curSchedule=="") {
426
+				$iRow++; 
427
+				continue;
428
+			}
429 429
             
430
-            $curSchedule = strtolower($curSchedule);
430
+			$curSchedule = strtolower($curSchedule);
431 431
             
432
-            $curSchedule = '[{'.$curSchedule.'}]';
432
+			$curSchedule = '[{'.$curSchedule.'}]';
433 433
 
434
-            $parametersArray = array();
434
+			$parametersArray = array();
435 435
             
436
-            foreach ($addressBookFields as $addressBookField) {
437
-                if (isset($locationsFieldsMapping[$addressBookField])) {
438
-                    $parametersArray[$addressBookField] = $rows[$locationsFieldsMapping[$addressBookField]];
439
-                }
440
-            }
436
+			foreach ($addressBookFields as $addressBookField) {
437
+				if (isset($locationsFieldsMapping[$addressBookField])) {
438
+					$parametersArray[$addressBookField] = $rows[$locationsFieldsMapping[$addressBookField]];
439
+				}
440
+			}
441 441
             
442
-            $AdressBookLocationParameters = AddressBookLocation::fromArray($parametersArray);
442
+			$AdressBookLocationParameters = AddressBookLocation::fromArray($parametersArray);
443 443
             
444
-            $abContacts = new AddressBookLocation();
444
+			$abContacts = new AddressBookLocation();
445 445
 
446
-            $abcResults = $abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry
446
+			$abcResults = $abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry
447 447
             
448
-            array_push($results['success'], "The schedule location with address_id = ".strval($abcResults["address_id"])." added successfuly.");
449
-        }
448
+			array_push($results['success'], "The schedule location with address_id = ".strval($abcResults["address_id"])." added successfuly.");
449
+		}
450 450
 
451
-        return $results;
452
-    }
451
+		return $results;
452
+	}
453 453
  }
454 454
  
455 455
\ No newline at end of file
Please login to merge, or discard this patch.
src/Route4Me/Exception/myErrorHandler.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@
 block discarded – undo
3 3
 
4 4
 class myErrorHandler extends \Exception
5 5
 {
6
-    public function proc_error($errno, $errstr, $errfile, $errline) 
7
-    {
8
-        echo "Error No: $errno,  line: $errline --- ".$errstr."<br>";
6
+	public function proc_error($errno, $errstr, $errfile, $errline) 
7
+	{
8
+		echo "Error No: $errno,  line: $errline --- ".$errstr."<br>";
9 9
     
10
-    }
10
+	}
11 11
 }
Please login to merge, or discard this patch.
src/Route4Me/Route4Me.php 1 patch
Indentation   +246 added lines, -246 removed lines patch added patch discarded remove patch
@@ -7,287 +7,287 @@
 block discarded – undo
7 7
 
8 8
 class Route4Me
9 9
 {
10
-    static public $apiKey;
11
-    static public $baseUrl = Endpoint::BASE_URL;
10
+	static public $apiKey;
11
+	static public $baseUrl = Endpoint::BASE_URL;
12 12
 
13
-    public static function setApiKey($apiKey)
14
-    {
15
-        self::$apiKey = $apiKey;
16
-    }
13
+	public static function setApiKey($apiKey)
14
+	{
15
+		self::$apiKey = $apiKey;
16
+	}
17 17
 
18
-    public static function getApiKey()
19
-    {
20
-        return self::$apiKey;
21
-    }
18
+	public static function getApiKey()
19
+	{
20
+		return self::$apiKey;
21
+	}
22 22
 
23
-    public static function setBaseUrl($baseUrl)
24
-    {
25
-        self::$baseUrl = $baseUrl;
26
-    }
23
+	public static function setBaseUrl($baseUrl)
24
+	{
25
+		self::$baseUrl = $baseUrl;
26
+	}
27 27
 
28
-    public static function getBaseUrl()
29
-    {
30
-        return self::$baseUrl;
31
-    }
28
+	public static function getBaseUrl()
29
+	{
30
+		return self::$baseUrl;
31
+	}
32 32
     
33
-    public static function makeRequst($options) {
34
-        $method = isset($options['method']) ? $options['method'] : 'GET';
35
-        $query = isset($options['query']) ? array_filter($options['query'], function($x) { return !is_null($x); } ) : array();
33
+	public static function makeRequst($options) {
34
+		$method = isset($options['method']) ? $options['method'] : 'GET';
35
+		$query = isset($options['query']) ? array_filter($options['query'], function($x) { return !is_null($x); } ) : array();
36 36
 
37
-        $body = isset($options['body']) ? $options['body'] : null;
38
-        $file = isset($options['FILE']) ? $options['FILE'] : null;
39
-        $headers = array(
40
-            "User-Agent: Route4Me php-sdk"
41
-        );
37
+		$body = isset($options['body']) ? $options['body'] : null;
38
+		$file = isset($options['FILE']) ? $options['FILE'] : null;
39
+		$headers = array(
40
+			"User-Agent: Route4Me php-sdk"
41
+		);
42 42
 
43
-        if (isset($options['HTTPHEADER'])) {
44
-            $headers[] = $options['HTTPHEADER'];
45
-        }
43
+		if (isset($options['HTTPHEADER'])) {
44
+			$headers[] = $options['HTTPHEADER'];
45
+		}
46 46
 
47
-        if (isset($options['HTTPHEADERS'])) {
48
-            foreach ($options['HTTPHEADERS'] As $header) {
49
-                $headers[] = $header;
50
-            } 
51
-        }
47
+		if (isset($options['HTTPHEADERS'])) {
48
+			foreach ($options['HTTPHEADERS'] As $header) {
49
+				$headers[] = $header;
50
+			} 
51
+		}
52 52
 
53
-        $ch = curl_init();
53
+		$ch = curl_init();
54 54
 
55
-        $url = isset($options['url']) ? $options['url'].'?'.http_build_query(array_merge(
56
-            $query, array('api_key' => self::getApiKey())
57
-        )) : "";
55
+		$url = isset($options['url']) ? $options['url'].'?'.http_build_query(array_merge(
56
+			$query, array('api_key' => self::getApiKey())
57
+		)) : "";
58 58
 
59
-        $baseUrl = self::getBaseUrl();
59
+		$baseUrl = self::getBaseUrl();
60 60
  
61
-        $curlOpts = array(
62
-            CURLOPT_URL            => $baseUrl.$url,
63
-            CURLOPT_RETURNTRANSFER => true,
64
-            CURLOPT_TIMEOUT        => 80,
65
-            CURLOPT_FOLLOWLOCATION => true,
66
-            CURLOPT_SSL_VERIFYHOST => FALSE,
67
-            CURLOPT_SSL_VERIFYPEER => FALSE,
68
-            CURLOPT_HTTPHEADER     => $headers
69
-        );
61
+		$curlOpts = array(
62
+			CURLOPT_URL            => $baseUrl.$url,
63
+			CURLOPT_RETURNTRANSFER => true,
64
+			CURLOPT_TIMEOUT        => 80,
65
+			CURLOPT_FOLLOWLOCATION => true,
66
+			CURLOPT_SSL_VERIFYHOST => FALSE,
67
+			CURLOPT_SSL_VERIFYPEER => FALSE,
68
+			CURLOPT_HTTPHEADER     => $headers
69
+		);
70 70
         
71
-        curl_setopt_array($ch, $curlOpts);
71
+		curl_setopt_array($ch, $curlOpts);
72 72
         
73
-        if ($file!=null) {
74
-            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
75
-            $fp = fopen($file, 'r');
76
-            curl_setopt($ch, CURLOPT_INFILE, $fp);
77
-            curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file));
78
-        }
73
+		if ($file!=null) {
74
+			curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
75
+			$fp = fopen($file, 'r');
76
+			curl_setopt($ch, CURLOPT_INFILE, $fp);
77
+			curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file));
78
+		}
79 79
 
80
-        switch ($method) {
81
-        case 'DELETE':
82
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
83
-            break;
84
-        case 'DELETEARRAY':
85
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
86
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
87
-            break;
88
-        case 'PUT':
89
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
90
-            break;
91
-        case 'POST':
92
-           if (isset($body)) {
93
-                $bodyData = json_encode($body);
94
-               if (isset($options['HTTPHEADER'])) {
95
-                  if (strpos($options['HTTPHEADER'], "multipart/form-data")>0) {
96
-                      $bodyData = $body;
97
-                  }
98
-               }
80
+		switch ($method) {
81
+		case 'DELETE':
82
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
83
+			break;
84
+		case 'DELETEARRAY':
85
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
86
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
87
+			break;
88
+		case 'PUT':
89
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
90
+			break;
91
+		case 'POST':
92
+		   if (isset($body)) {
93
+				$bodyData = json_encode($body);
94
+			   if (isset($options['HTTPHEADER'])) {
95
+				  if (strpos($options['HTTPHEADER'], "multipart/form-data")>0) {
96
+					  $bodyData = $body;
97
+				  }
98
+			   }
99 99
                
100
-               curl_setopt($ch, CURLOPT_POSTFIELDS, $bodyData); 
101
-            } 
102
-            break;
103
-        case 'ADD':
104
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
105
-        }
100
+			   curl_setopt($ch, CURLOPT_POSTFIELDS, $bodyData); 
101
+			} 
102
+			break;
103
+		case 'ADD':
104
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
105
+		}
106 106
 
107
-        if (is_numeric(array_search($method, array('DELETE', 'PUT')))) {
108
-            if (isset($body)) {
109
-                curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
110
-            } 
111
-        }
107
+		if (is_numeric(array_search($method, array('DELETE', 'PUT')))) {
108
+			if (isset($body)) {
109
+				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
110
+			} 
111
+		}
112 112
 
113
-        $result = curl_exec($ch);
113
+		$result = curl_exec($ch);
114 114
 
115
-        $isxml = FALSE;
116
-        $jxml = "";
117
-        if (strpos($result, '<?xml')>-1) {
118
-            $xml = simplexml_load_string($result);
119
-            //$jxml = json_encode($xml);
120
-            $jxml = self::object2array($xml);
121
-            $isxml = TRUE;
122
-        }
115
+		$isxml = FALSE;
116
+		$jxml = "";
117
+		if (strpos($result, '<?xml')>-1) {
118
+			$xml = simplexml_load_string($result);
119
+			//$jxml = json_encode($xml);
120
+			$jxml = self::object2array($xml);
121
+			$isxml = TRUE;
122
+		}
123 123
         
124
-        $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
125
-        curl_close($ch);
124
+		$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
125
+		curl_close($ch);
126 126
         
127
-        if (200==$code) {
128
-            if ($isxml) {
129
-                $json = $jxml;
130
-            } else {
131
-                $json = json_decode($result, true);
132
-            }
127
+		if (200==$code) {
128
+			if ($isxml) {
129
+				$json = $jxml;
130
+			} else {
131
+				$json = json_decode($result, true);
132
+			}
133 133
             
134
-            if (isset($json['errors'])) {
135
-                throw new ApiError(implode(', ', $json['errors']));
136
-            } else {
137
-                return $json;
138
-            }
139
-        } elseif (409==$code) {
140
-            throw new ApiError('Wrong API key');
141
-        } else {
142
-            throw new ApiError('Something wrong');
143
-        }
144
-    }
134
+			if (isset($json['errors'])) {
135
+				throw new ApiError(implode(', ', $json['errors']));
136
+			} else {
137
+				return $json;
138
+			}
139
+		} elseif (409==$code) {
140
+			throw new ApiError('Wrong API key');
141
+		} else {
142
+			throw new ApiError('Something wrong');
143
+		}
144
+	}
145 145
 
146
-    /**
147
-     * @param $object: JSON object
148
-     */
149
-    public static function object2array($object)
150
-    {
151
-        return @json_decode(@json_encode($object), 1);
152
-    }
146
+	/**
147
+	 * @param $object: JSON object
148
+	 */
149
+	public static function object2array($object)
150
+	{
151
+		return @json_decode(@json_encode($object), 1);
152
+	}
153 153
 
154 154
     
155
-    /**
156
-     * Prints on the screen main keys and values of the array 
157
-     * @param $results: object to be printed on the screen.
158
-     * @param $deepPrinting: if true, object will be printed recursively.
159
-     */
160
-    public static function simplePrint($results, $deepPrinting = null)
161
-    {
162
-        if (isset($results)) {
163
-            if (is_array($results)) {
164
-                foreach ($results as $key=>$result) {
165
-                    if (is_array($result)) {
166
-                        foreach ($result as $key1=>$result1) {
167
-                            if (is_array($result1)) {
168
-                                  if ($deepPrinting) {
169
-                                      echo "<br>$key1 ------><br>";
170
-                                      Route4Me::simplePrint($result1, true);
171
-                                      echo "------<br>";
172
-                                  } else {
173
-                                      echo $key1." --> "."Array() <br>";
174
-                                  } 
175
-                            } else {
176
-                                if (is_object($result1)) {
177
-                                    if ($deepPrinting) {
178
-                                        echo "<br>$key1 ------><br>";
179
-                                        $oarray = (array)$result1;
180
-                                        Route4Me::simplePrint($oarray, true);
181
-                                        echo "------<br>";
182
-                                    } else {
183
-                                        echo $key1." --> "."Object <br>";
184
-                                    } 
185
-                                } else {
186
-                                    if (!is_null($result1)) {
187
-                                        echo $key1." --> ".$result1."<br>"; 
188
-                                    }   
189
-                                }
190
-                            }
191
-                        }
192
-                    } else {
193
-                        if (is_object($result)) {
194
-                            if ($deepPrinting) {
195
-                                echo "<br>$key ------><br>";
196
-                                $oarray = (array)$result;
197
-                                Route4Me::simplePrint($oarray, true);
198
-                                echo "------<br>";
199
-                            } else {
200
-                                echo $key." --> "."Object <br>";
201
-                            } 
202
-                        } else {
203
-                            if (!is_null($result)) {
204
-                                echo $key." --> ".$result."<br>";
205
-                            }
206
-                        }
155
+	/**
156
+	 * Prints on the screen main keys and values of the array 
157
+	 * @param $results: object to be printed on the screen.
158
+	 * @param $deepPrinting: if true, object will be printed recursively.
159
+	 */
160
+	public static function simplePrint($results, $deepPrinting = null)
161
+	{
162
+		if (isset($results)) {
163
+			if (is_array($results)) {
164
+				foreach ($results as $key=>$result) {
165
+					if (is_array($result)) {
166
+						foreach ($result as $key1=>$result1) {
167
+							if (is_array($result1)) {
168
+								  if ($deepPrinting) {
169
+									  echo "<br>$key1 ------><br>";
170
+									  Route4Me::simplePrint($result1, true);
171
+									  echo "------<br>";
172
+								  } else {
173
+									  echo $key1." --> "."Array() <br>";
174
+								  } 
175
+							} else {
176
+								if (is_object($result1)) {
177
+									if ($deepPrinting) {
178
+										echo "<br>$key1 ------><br>";
179
+										$oarray = (array)$result1;
180
+										Route4Me::simplePrint($oarray, true);
181
+										echo "------<br>";
182
+									} else {
183
+										echo $key1." --> "."Object <br>";
184
+									} 
185
+								} else {
186
+									if (!is_null($result1)) {
187
+										echo $key1." --> ".$result1."<br>"; 
188
+									}   
189
+								}
190
+							}
191
+						}
192
+					} else {
193
+						if (is_object($result)) {
194
+							if ($deepPrinting) {
195
+								echo "<br>$key ------><br>";
196
+								$oarray = (array)$result;
197
+								Route4Me::simplePrint($oarray, true);
198
+								echo "------<br>";
199
+							} else {
200
+								echo $key." --> "."Object <br>";
201
+							} 
202
+						} else {
203
+							if (!is_null($result)) {
204
+								echo $key." --> ".$result."<br>";
205
+							}
206
+						}
207 207
                         
208
-                    }
209
-                    //echo "<br>";
210
-                }
211
-            } 
212
-        }
213
-    }
208
+					}
209
+					//echo "<br>";
210
+				}
211
+			} 
212
+		}
213
+	}
214 214
 
215
-    /**
216
-     * Generates query or body parameters.
217
-     * @param $allFields: all known fields could be used for parameters generation.
218
-     * @param $params: input parameters (array or object)
219
-     */
220
-    public static function generateRequestParameters($allFields, $params)
221
-    {
222
-        $generatedParams = array();
215
+	/**
216
+	 * Generates query or body parameters.
217
+	 * @param $allFields: all known fields could be used for parameters generation.
218
+	 * @param $params: input parameters (array or object)
219
+	 */
220
+	public static function generateRequestParameters($allFields, $params)
221
+	{
222
+		$generatedParams = array();
223 223
         
224
-        if (is_array($params)) {
225
-            foreach ($allFields as $field) {
226
-                if (isset($params[$field])) {
227
-                    $generatedParams[$field] = $params[$field];
228
-                }
229
-            }
230
-        } elseif (is_object($params)) {
231
-            foreach ($allFields as $field) {
232
-                if (isset($params->{$field})) {
233
-                    $generatedParams[$field] = $params->{$field};
234
-                }
235
-            }
236
-        }
224
+		if (is_array($params)) {
225
+			foreach ($allFields as $field) {
226
+				if (isset($params[$field])) {
227
+					$generatedParams[$field] = $params[$field];
228
+				}
229
+			}
230
+		} elseif (is_object($params)) {
231
+			foreach ($allFields as $field) {
232
+				if (isset($params->{$field})) {
233
+					$generatedParams[$field] = $params->{$field};
234
+				}
235
+			}
236
+		}
237 237
 
238
-        return $generatedParams;
239
-    }
238
+		return $generatedParams;
239
+	}
240 240
     
241
-    /**
242
-     * Returns an array of the object properties
243
-     * @param $object: An object.
244
-     * @param $exclude: array of the object parameters to be excluded from the returned array.
245
-     */
246
-    public static function getObjectProperties($object, $exclude)
247
-    {
248
-        $objectParameters = array();
241
+	/**
242
+	 * Returns an array of the object properties
243
+	 * @param $object: An object.
244
+	 * @param $exclude: array of the object parameters to be excluded from the returned array.
245
+	 */
246
+	public static function getObjectProperties($object, $exclude)
247
+	{
248
+		$objectParameters = array();
249 249
         
250
-        foreach (get_object_vars($object) as $key => $value) {
251
-            if (property_exists($object, $key)) {
252
-                if (!is_numeric(array_search($key, $exclude))) {
253
-                    array_push($objectParameters, $key);
254
-                }
255
-            }
256
-        }
250
+		foreach (get_object_vars($object) as $key => $value) {
251
+			if (property_exists($object, $key)) {
252
+				if (!is_numeric(array_search($key, $exclude))) {
253
+					array_push($objectParameters, $key);
254
+				}
255
+			}
256
+		}
257 257
         
258
-        return $objectParameters;
259
-    }
258
+		return $objectParameters;
259
+	}
260 260
     
261
-    /**
262
-     * Returns url path generated from the array of the fields and parameters.
263
-     * @param $allFields; array of the paossible fields (parameter names).
264
-     * @param $params: input parameters (array or object).
265
-     */
266
-    public static function generateUrlPath($allFields, $params)
267
-    {
268
-        $generatedPath = "";
261
+	/**
262
+	 * Returns url path generated from the array of the fields and parameters.
263
+	 * @param $allFields; array of the paossible fields (parameter names).
264
+	 * @param $params: input parameters (array or object).
265
+	 */
266
+	public static function generateUrlPath($allFields, $params)
267
+	{
268
+		$generatedPath = "";
269 269
 
270
-        if (is_array($params)) {
271
-            foreach ($allFields as $field) {
272
-                if (isset($params[$field])) {
273
-                    $generatedPath .= $params[$field].'/';
274
-                }
275
-            }
276
-        } elseif (is_object($params)) {
277
-            foreach ($allFields as $field) {
278
-                if (isset($params->{$field})) {
279
-                    $generatedPath .= $params->{$field}.'/';
280
-                }
281
-            }
282
-        }
270
+		if (is_array($params)) {
271
+			foreach ($allFields as $field) {
272
+				if (isset($params[$field])) {
273
+					$generatedPath .= $params[$field].'/';
274
+				}
275
+			}
276
+		} elseif (is_object($params)) {
277
+			foreach ($allFields as $field) {
278
+				if (isset($params->{$field})) {
279
+					$generatedPath .= $params->{$field}.'/';
280
+				}
281
+			}
282
+		}
283 283
         
284
-        return $generatedPath;
285
-    }
284
+		return $generatedPath;
285
+	}
286 286
     
287
-    public static function getFileRealPath($fileName)
288
-    {
289
-        $rpath = function_exists('curl_file_create') ? curl_file_create(realpath($fileName)) : '@'.realpath($fileName);
287
+	public static function getFileRealPath($fileName)
288
+	{
289
+		$rpath = function_exists('curl_file_create') ? curl_file_create(realpath($fileName)) : '@'.realpath($fileName);
290 290
         
291
-        return $rpath;
292
-    }
291
+		return $rpath;
292
+	}
293 293
 }
Please login to merge, or discard this patch.
examples/Activities/GetRouteActivities.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -23,26 +23,26 @@
 block discarded – undo
23 23
 
24 24
 // Itereate through all the existing activity types
25 25
 foreach ($activityTypes->getConstants() as $prop => $value) {
26
-    $activityParameters = ActivityParameters::fromArray(array(
27
-        "activity_type" => $value,
28
-        "limit"         => 2,
29
-        "offset"        => 0,
30
-        "route_id"      => $route_id
31
-    ));
26
+	$activityParameters = ActivityParameters::fromArray(array(
27
+		"activity_type" => $value,
28
+		"limit"         => 2,
29
+		"offset"        => 0,
30
+		"route_id"      => $route_id
31
+	));
32 32
     
33
-    $activities = new ActivityParameters();
34
-    $results = $activities->searcActivities($activityParameters);
33
+	$activities = new ActivityParameters();
34
+	$results = $activities->searcActivities($activityParameters);
35 35
     
36
-    if (!is_array($results) || !is_array($results['results']) || sizeof($results['results'])<1) {
37
-        continue;
38
-    }
36
+	if (!is_array($results) || !is_array($results['results']) || sizeof($results['results'])<1) {
37
+		continue;
38
+	}
39 39
     
40
-    $count++;
40
+	$count++;
41 41
 	
42
-    foreach ($results as $key => $activity) {
43
-        Route4Me::simplePrint($activity);
44
-        echo "<br>";
45
-    }
42
+	foreach ($results as $key => $activity) {
43
+		Route4Me::simplePrint($activity);
44
+		echo "<br>";
45
+	}
46 46
     
47
-    echo "------------------- <br><br>";
47
+	echo "------------------- <br><br>";
48 48
 }
Please login to merge, or discard this patch.