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 ( ba89cf...799599 )
by Oleg
02:27
created
src/Route4Me/Route.php 2 patches
Indentation   +416 added lines, -416 removed lines patch added patch discarded remove patch
@@ -9,480 +9,480 @@
 block discarded – undo
9 9
 
10 10
 class Route extends Common
11 11
 {
12
-    public $route_id;
13
-    public $member_id;
14
-    public $route_destination_id;
15
-    public $optimization_problem_id;
16
-    public $vehicle_alias;
17
-    public $driver_alias;
18
-    public $trip_distance;
19
-    public $mpg;
20
-    public $gas_price;
21
-    public $route_duration_sec;
22
-    public $destination_count;
23
-    public $parameters;
24
-    public $addresses = array();
25
-    public $links = array();
26
-    public $directions = array();
27
-    public $path = array();
28
-    public $tracking_history = array();
29
-    public $recipient_email;
30
-    public $httpheaders;
31
-    public $is_unrouted;
32
-    public $time;
12
+	public $route_id;
13
+	public $member_id;
14
+	public $route_destination_id;
15
+	public $optimization_problem_id;
16
+	public $vehicle_alias;
17
+	public $driver_alias;
18
+	public $trip_distance;
19
+	public $mpg;
20
+	public $gas_price;
21
+	public $route_duration_sec;
22
+	public $destination_count;
23
+	public $parameters;
24
+	public $addresses = array();
25
+	public $links = array();
26
+	public $directions = array();
27
+	public $path = array();
28
+	public $tracking_history = array();
29
+	public $recipient_email;
30
+	public $httpheaders;
31
+	public $is_unrouted;
32
+	public $time;
33 33
     
34
-    public $dev_lat;
35
-    public $dev_lng;
34
+	public $dev_lat;
35
+	public $dev_lng;
36 36
     
37
-    public $user_route_rating;
38
-    public $member_email;
39
-    public $member_first_name;
40
-    public $member_last_name;
41
-    public $channel_name;
42
-    public $route_cost;
43
-    public $route_revenue;
44
-    public $net_revenue_per_distance_unit;
45
-    public $created_timestamp;
46
-    public $planned_total_route_duration;
47
-    public $actual_travel_distance;
48
-    public $actual_travel_time;
49
-    public $actual_footsteps;
50
-    public $working_time;
51
-    public $driving_time;
52
-    public $idling_time;
53
-    public $paying_miles;
54
-    public $geofence_polygon_type;
55
-    public $geofence_polygon_size;
56
-    public $notes;
57
-    public $member_config_storage;
37
+	public $user_route_rating;
38
+	public $member_email;
39
+	public $member_first_name;
40
+	public $member_last_name;
41
+	public $channel_name;
42
+	public $route_cost;
43
+	public $route_revenue;
44
+	public $net_revenue_per_distance_unit;
45
+	public $created_timestamp;
46
+	public $planned_total_route_duration;
47
+	public $actual_travel_distance;
48
+	public $actual_travel_time;
49
+	public $actual_footsteps;
50
+	public $working_time;
51
+	public $driving_time;
52
+	public $idling_time;
53
+	public $paying_miles;
54
+	public $geofence_polygon_type;
55
+	public $geofence_polygon_size;
56
+	public $notes;
57
+	public $member_config_storage;
58 58
 
59
-    public static function fromArray(array $params) 
60
-    {
61
-        $route = new Route();
62
-        $route->route_id                = Common::getValue($params, 'route_id');
63
-        $route->member_id               = Common::getValue($params, 'member_id');
64
-        $route->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
65
-        $route->vehicle_alias           = Common::getValue($params, 'vehicle_alias');
66
-        $route->driver_alias            = Common::getValue($params, 'driver_alias');
67
-        $route->trip_distance           = Common::getValue($params, 'trip_distance');
68
-        $route->mpg                     = Common::getValue($params, 'mpg');
69
-        $route->gas_price               = Common::getValue($params, 'gas_price');
70
-        $route->route_duration_sec      = Common::getvalue($params, 'route_duration_sec');
71
-        $route->destination_count       = Common::getvalue($params, 'destination_count');
72
-        $route->is_unrouted             = Common::getvalue($params, 'is_unrouted');
59
+	public static function fromArray(array $params) 
60
+	{
61
+		$route = new Route();
62
+		$route->route_id                = Common::getValue($params, 'route_id');
63
+		$route->member_id               = Common::getValue($params, 'member_id');
64
+		$route->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
65
+		$route->vehicle_alias           = Common::getValue($params, 'vehicle_alias');
66
+		$route->driver_alias            = Common::getValue($params, 'driver_alias');
67
+		$route->trip_distance           = Common::getValue($params, 'trip_distance');
68
+		$route->mpg                     = Common::getValue($params, 'mpg');
69
+		$route->gas_price               = Common::getValue($params, 'gas_price');
70
+		$route->route_duration_sec      = Common::getvalue($params, 'route_duration_sec');
71
+		$route->destination_count       = Common::getvalue($params, 'destination_count');
72
+		$route->is_unrouted             = Common::getvalue($params, 'is_unrouted');
73 73
 
74
-        // Make RouteParameters
75
-        if (isset($params['parameters'])) {
76
-            $route->parameters = RouteParameters::fromArray($params['parameters']);
77
-        }
74
+		// Make RouteParameters
75
+		if (isset($params['parameters'])) {
76
+			$route->parameters = RouteParameters::fromArray($params['parameters']);
77
+		}
78 78
 
79
-        if (isset($params['addresses'])) {
80
-            $addresses = array();
81
-            foreach ($params['addresses'] as $address) {
82
-                $addresses[] = Address::fromArray($address);
83
-            }
79
+		if (isset($params['addresses'])) {
80
+			$addresses = array();
81
+			foreach ($params['addresses'] as $address) {
82
+				$addresses[] = Address::fromArray($address);
83
+			}
84 84
 
85
-            $route->addresses = $addresses;
86
-        }
85
+			$route->addresses = $addresses;
86
+		}
87 87
 
88
-        $route->links            = Common::getValue($params, 'links', array());
89
-        $route->directions       = Common::getValue($params, 'directions', array());
90
-        $route->path             = Common::getValue($params, 'path', array());
91
-        $route->tracking_history = Common::getValue($params, 'tracking_history', array());
88
+		$route->links            = Common::getValue($params, 'links', array());
89
+		$route->directions       = Common::getValue($params, 'directions', array());
90
+		$route->path             = Common::getValue($params, 'path', array());
91
+		$route->tracking_history = Common::getValue($params, 'tracking_history', array());
92 92
 
93
-        return $route;
94
-    }
93
+		return $route;
94
+	}
95 95
 
96
-    public static function getRoutes($routeId = null, $params = null)
97
-    {
98
-        $result = Route4Me::makeRequst(array(
99
-            'url'    => Endpoint::ROUTE_V4,
100
-            'method' => 'GET',
101
-            'query'  => array(
102
-                'api_key'                  => Route4Me::getApiKey(),
103
-                'route_id'                 => !is_null($routeId) ? implode(',', (array)$routeId) : null,
104
-                'route_path_output'        => isset($params['route_path_output']) ? $params['route_path_output'] : null,
105
-                'query'                    => isset($params['query']) ? $params['query'] : null,
106
-                'directions'               => isset($params['directions']) ? $params['directions'] : null,
107
-                'device_tracking_history'  => isset($params['device_tracking_history']) ? $params['device_tracking_history'] : null,
108
-                'limit'                    => isset($params['limit']) ? $params['limit'] : null,
109
-                'offset'                   => isset($params['offset']) ? $params['offset'] : null
110
-            )
111
-        ));
96
+	public static function getRoutes($routeId = null, $params = null)
97
+	{
98
+		$result = Route4Me::makeRequst(array(
99
+			'url'    => Endpoint::ROUTE_V4,
100
+			'method' => 'GET',
101
+			'query'  => array(
102
+				'api_key'                  => Route4Me::getApiKey(),
103
+				'route_id'                 => !is_null($routeId) ? implode(',', (array)$routeId) : null,
104
+				'route_path_output'        => isset($params['route_path_output']) ? $params['route_path_output'] : null,
105
+				'query'                    => isset($params['query']) ? $params['query'] : null,
106
+				'directions'               => isset($params['directions']) ? $params['directions'] : null,
107
+				'device_tracking_history'  => isset($params['device_tracking_history']) ? $params['device_tracking_history'] : null,
108
+				'limit'                    => isset($params['limit']) ? $params['limit'] : null,
109
+				'offset'                   => isset($params['offset']) ? $params['offset'] : null
110
+			)
111
+		));
112 112
         
113
-        if ($routeId) {
114
-            return Route::fromArray($result); die("");
115
-        } else {
116
-            $routes = array();
117
-            foreach ($result as $route) {
118
-                $routes[] = Route::fromArray($route);
119
-            }
120
-            return $routes;
121
-        }
122
-    }
113
+		if ($routeId) {
114
+			return Route::fromArray($result); die("");
115
+		} else {
116
+			$routes = array();
117
+			foreach ($result as $route) {
118
+				$routes[] = Route::fromArray($route);
119
+			}
120
+			return $routes;
121
+		}
122
+	}
123 123
 
124
-    public function getRoutePoints($routeId, $params)
125
-    {
126
-        $result = Route4Me::makeRequst(array(
127
-            'url'    => Endpoint::ROUTE_V4,
128
-            'method' => 'GET',
129
-            'query'  => array(
130
-                'api_key'           => Route4Me::getApiKey(),
131
-                'route_id'          => $routeId,
132
-                'route_path_output' => isset($params['route_path_output']) ? $params['route_path_output'] : null,
133
-                'compress_path_points' => isset($params['compress_path_points']) ? $params['compress_path_points'] : null,
134
-                'directions'        => isset($params['directions']) ? $params['directions'] : null,
135
-            )
136
-        ));
124
+	public function getRoutePoints($routeId, $params)
125
+	{
126
+		$result = Route4Me::makeRequst(array(
127
+			'url'    => Endpoint::ROUTE_V4,
128
+			'method' => 'GET',
129
+			'query'  => array(
130
+				'api_key'           => Route4Me::getApiKey(),
131
+				'route_id'          => $routeId,
132
+				'route_path_output' => isset($params['route_path_output']) ? $params['route_path_output'] : null,
133
+				'compress_path_points' => isset($params['compress_path_points']) ? $params['compress_path_points'] : null,
134
+				'directions'        => isset($params['directions']) ? $params['directions'] : null,
135
+			)
136
+		));
137 137
 
138
-        return $result;
139
-    }
138
+		return $result;
139
+	}
140 140
 
141
-    public function duplicateRoute($route_id)
142
-    {
143
-        $result = Route4Me::makeRequst(array(
144
-            'url'    => Endpoint::ROUTE_DUPLICATE,
145
-            'method' => 'GET',
146
-            'query'  => array(
147
-                'api_key'  => Route4Me::getApiKey(),
148
-                'route_id' => $route_id,
149
-                'to'       => 'none',
150
-            )
151
-        ));
141
+	public function duplicateRoute($route_id)
142
+	{
143
+		$result = Route4Me::makeRequst(array(
144
+			'url'    => Endpoint::ROUTE_DUPLICATE,
145
+			'method' => 'GET',
146
+			'query'  => array(
147
+				'api_key'  => Route4Me::getApiKey(),
148
+				'route_id' => $route_id,
149
+				'to'       => 'none',
150
+			)
151
+		));
152 152
         
153
-        return $result;
154
-    }
153
+		return $result;
154
+	}
155 155
     
156
-    public function resequenceRoute($params)
157
-    {
158
-        $result = Route4Me::makeRequst(array(
159
-            'url'    => Endpoint::ROUTE_V4,
160
-            'method' => 'PUT',
161
-            'query'  => array(
162
-                'api_key'              => Route4Me::getApiKey(),
163
-                'route_id'             => isset($params['route_id']) ? $params['route_id'] : null,
164
-                'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
165
-            ),
166
-            'body'   => array(
167
-                'addresses' => isset($params['addresses']) ? $params['addresses'] : null,
168
-            )
169
-        ));
156
+	public function resequenceRoute($params)
157
+	{
158
+		$result = Route4Me::makeRequst(array(
159
+			'url'    => Endpoint::ROUTE_V4,
160
+			'method' => 'PUT',
161
+			'query'  => array(
162
+				'api_key'              => Route4Me::getApiKey(),
163
+				'route_id'             => isset($params['route_id']) ? $params['route_id'] : null,
164
+				'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
165
+			),
166
+			'body'   => array(
167
+				'addresses' => isset($params['addresses']) ? $params['addresses'] : null,
168
+			)
169
+		));
170 170
         
171
-        return $result;
172
-    }
171
+		return $result;
172
+	}
173 173
     
174
-    public function resequenceAllAddresses($params)
175
-    {
176
-        $result = Route4Me::makeRequst(array(
177
-            'url'    => Endpoint::REOPTIMIZE_V3_2,
178
-            'method' => 'GET',
179
-            'query'  => array(
180
-                'api_key'              => Route4Me::getApiKey(),
181
-                'route_id'             => isset($params['route_id']) ? $params['route_id'] : null,
182
-                'disable_optimization' => isset($params['disable_optimization']) ? $params['disable_optimization'] : null,
183
-                'optimize'             => isset($params['optimize']) ? $params['optimize'] : null,
184
-            )
185
-        ));
174
+	public function resequenceAllAddresses($params)
175
+	{
176
+		$result = Route4Me::makeRequst(array(
177
+			'url'    => Endpoint::REOPTIMIZE_V3_2,
178
+			'method' => 'GET',
179
+			'query'  => array(
180
+				'api_key'              => Route4Me::getApiKey(),
181
+				'route_id'             => isset($params['route_id']) ? $params['route_id'] : null,
182
+				'disable_optimization' => isset($params['disable_optimization']) ? $params['disable_optimization'] : null,
183
+				'optimize'             => isset($params['optimize']) ? $params['optimize'] : null,
184
+			)
185
+		));
186 186
         
187
-        return $result;
188
-    }
187
+		return $result;
188
+	}
189 189
 
190
-    public function mergeRoutes($params)
191
-    {
192
-        $result = Route4Me::makeRequst(array(
193
-            'url'    => Endpoint::ROUTES_MERGE,
194
-            'method' => 'POST',
195
-            'query'  => array(
196
-                'api_key' => Route4Me::getApiKey(),
197
-              ),
198
-            'body'   => array(
199
-                'route_ids'     => isset($params['route_ids']) ? $params['route_ids'] : null,
200
-                'depot_address' => isset($params['depot_address']) ? $params['depot_address'] : null,
201
-                'remove_origin' => isset($params['remove_origin']) ? $params['remove_origin'] : null,
202
-                'depot_lat'     => isset($params['depot_lat']) ? $params['depot_lat'] : null,
203
-                'depot_lat'     => isset($params['depot_lat']) ? $params['depot_lat'] : null
204
-              ),
205
-            'HTTPHEADER'  => 'Content-Type: multipart/form-data'
206
-        ));
190
+	public function mergeRoutes($params)
191
+	{
192
+		$result = Route4Me::makeRequst(array(
193
+			'url'    => Endpoint::ROUTES_MERGE,
194
+			'method' => 'POST',
195
+			'query'  => array(
196
+				'api_key' => Route4Me::getApiKey(),
197
+			  ),
198
+			'body'   => array(
199
+				'route_ids'     => isset($params['route_ids']) ? $params['route_ids'] : null,
200
+				'depot_address' => isset($params['depot_address']) ? $params['depot_address'] : null,
201
+				'remove_origin' => isset($params['remove_origin']) ? $params['remove_origin'] : null,
202
+				'depot_lat'     => isset($params['depot_lat']) ? $params['depot_lat'] : null,
203
+				'depot_lat'     => isset($params['depot_lat']) ? $params['depot_lat'] : null
204
+			  ),
205
+			'HTTPHEADER'  => 'Content-Type: multipart/form-data'
206
+		));
207 207
         
208
-        return $result;
209
-    }
208
+		return $result;
209
+	}
210 210
     
211
-    public function shareRoute($params)
212
-    {
213
-        $result = Route4Me::makeRequst(array(
214
-            'url'    => Endpoint::ROUTE_SHARE,
215
-            'method' => 'POST',
216
-            'query'  => array(
217
-                'api_key'         => Route4Me::getApiKey(),
218
-                'route_id'        => isset($params['route_id']) ? $params['route_id'] : null,
219
-                'response_format' => isset($params['response_format']) ? $params['response_format'] : null,
220
-            ),
221
-            'body'  => array(
222
-                'recipient_email' => isset($params['recipient_email']) ? $params['recipient_email'] : null,
223
-            ),
224
-            'HTTPHEADER'  => 'Content-Type: multipart/form-data'
225
-        ));
211
+	public function shareRoute($params)
212
+	{
213
+		$result = Route4Me::makeRequst(array(
214
+			'url'    => Endpoint::ROUTE_SHARE,
215
+			'method' => 'POST',
216
+			'query'  => array(
217
+				'api_key'         => Route4Me::getApiKey(),
218
+				'route_id'        => isset($params['route_id']) ? $params['route_id'] : null,
219
+				'response_format' => isset($params['response_format']) ? $params['response_format'] : null,
220
+			),
221
+			'body'  => array(
222
+				'recipient_email' => isset($params['recipient_email']) ? $params['recipient_email'] : null,
223
+			),
224
+			'HTTPHEADER'  => 'Content-Type: multipart/form-data'
225
+		));
226 226
         
227
-        return $result;
228
-    }
227
+		return $result;
228
+	}
229 229
     
230
-    // Returns random route_id from existing routes between $offset and $offset+$limit
231
-    public function getRandomRouteId($offset, $limit)
232
-    {
233
-        $query['limit'] = !is_null($limit) ? $limit : 30;
234
-        $query['offset'] = !is_null($offset) ? $offset : 0;
230
+	// Returns random route_id from existing routes between $offset and $offset+$limit
231
+	public function getRandomRouteId($offset, $limit)
232
+	{
233
+		$query['limit'] = !is_null($limit) ? $limit : 30;
234
+		$query['offset'] = !is_null($offset) ? $offset : 0;
235 235
             
236
-        $json = Route4Me::makeRequst(array(
237
-            'url'    => Endpoint::ROUTE_V4,
238
-            'method' => 'GET',
239
-            'query'  => $query
240
-        ));
236
+		$json = Route4Me::makeRequst(array(
237
+			'url'    => Endpoint::ROUTE_V4,
238
+			'method' => 'GET',
239
+			'query'  => $query
240
+		));
241 241
         
242
-        if (sizeof($json)>0) {
243
-            $routes = array();
242
+		if (sizeof($json)>0) {
243
+			$routes = array();
244 244
             
245
-            foreach ($json as $route) {
246
-                $routes[] = Route::fromArray($route);
247
-            }
245
+			foreach ($json as $route) {
246
+				$routes[] = Route::fromArray($route);
247
+			}
248 248
             
249
-            $num = rand(0, sizeof($routes) - 1);
250
-            $rRoute = (array)$routes[$num];
249
+			$num = rand(0, sizeof($routes) - 1);
250
+			$rRoute = (array)$routes[$num];
251 251
             
252
-            if (is_array($rRoute)) {
253
-                return $rRoute["route_id"];
254
-            } else {
255
-                return null;
256
-            }
257
-        } else {
258
-            echo "<br> There are no routes in the account. Please, create the routes first. <br>";
259
-            return null;
260
-        }
261
-    }
252
+			if (is_array($rRoute)) {
253
+				return $rRoute["route_id"];
254
+			} else {
255
+				return null;
256
+			}
257
+		} else {
258
+			echo "<br> There are no routes in the account. Please, create the routes first. <br>";
259
+			return null;
260
+		}
261
+	}
262 262
 
263
-    public function update()
264
-    {
265
-        $route = Route4Me::makeRequst(array(
266
-            'url'    => Endpoint::ROUTE_V4,
267
-            'method' => 'PUT',
268
-            'query'  => array(
269
-                'route_id'  => isset($this->route_id) ? $this->route_id : null
270
-            ),
271
-            'body' => array(
272
-                'parameters' => $this->parameters,
273
-                ),
274
-            'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
275
-        ));
263
+	public function update()
264
+	{
265
+		$route = Route4Me::makeRequst(array(
266
+			'url'    => Endpoint::ROUTE_V4,
267
+			'method' => 'PUT',
268
+			'query'  => array(
269
+				'route_id'  => isset($this->route_id) ? $this->route_id : null
270
+			),
271
+			'body' => array(
272
+				'parameters' => $this->parameters,
273
+				),
274
+			'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
275
+		));
276 276
 
277
-        return Route::fromArray($route);
278
-    }
277
+		return Route::fromArray($route);
278
+	}
279 279
     
280
-    public function updateAddress($address = null)
281
-    {
282
-        $body = sizeof($this->addresses)<1 ? get_object_vars($this->parameters) 
283
-            : (isset($this->addresses[0]) ? $this->addresses[0] : get_object_vars($this->parameters));
280
+	public function updateAddress($address = null)
281
+	{
282
+		$body = sizeof($this->addresses)<1 ? get_object_vars($this->parameters) 
283
+			: (isset($this->addresses[0]) ? $this->addresses[0] : get_object_vars($this->parameters));
284 284
 
285
-        $result = Route4Me::makeRequst(array(
286
-            'url'    => Endpoint::ADDRESS_V4,
287
-            'method' => 'PUT',
288
-            'query'  => array(
289
-                'route_id'             => isset($this->route_id) ? $this->route_id : null,
290
-                'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
291
-            ),
292
-            'body'        => $body,
293
-            'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
294
-        ));
285
+		$result = Route4Me::makeRequst(array(
286
+			'url'    => Endpoint::ADDRESS_V4,
287
+			'method' => 'PUT',
288
+			'query'  => array(
289
+				'route_id'             => isset($this->route_id) ? $this->route_id : null,
290
+				'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
291
+			),
292
+			'body'        => $body,
293
+			'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
294
+		));
295 295
 
296
-        return $result;
297
-    }
296
+		return $result;
297
+	}
298 298
 
299
-    public function updateRouteAddress()
300
-    {
301
-        $result = Route4Me::makeRequst(array(
302
-            'url'    => Endpoint::ADDRESS_V4,
303
-            'method' => 'PUT',
304
-            'query'  => array(
305
-                'route_id'             => isset($this->route_id) ? $this->route_id : null,
306
-                'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
307
-            ),
308
-            'body'        => array(
309
-                "parameters" => isset($this->parameters) ? get_object_vars($this->parameters) : null,
310
-                "addresses"  => isset($this->addresses) ? $this->addresses : null
311
-            ),
312
-            'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
313
-        ));
299
+	public function updateRouteAddress()
300
+	{
301
+		$result = Route4Me::makeRequst(array(
302
+			'url'    => Endpoint::ADDRESS_V4,
303
+			'method' => 'PUT',
304
+			'query'  => array(
305
+				'route_id'             => isset($this->route_id) ? $this->route_id : null,
306
+				'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
307
+			),
308
+			'body'        => array(
309
+				"parameters" => isset($this->parameters) ? get_object_vars($this->parameters) : null,
310
+				"addresses"  => isset($this->addresses) ? $this->addresses : null
311
+			),
312
+			'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
313
+		));
314 314
 
315
-        return $result;
316
-    }
315
+		return $result;
316
+	}
317 317
 
318
-    public function addAddresses($params)
319
-    {
320
-        $route = Route4Me::makeRequst(array(
321
-            'url'    => Endpoint::ROUTE_V4,
322
-            'method' => 'PUT',
323
-            'query'  => array(
324
-                'api_key'   => Route4Me::getApiKey(),
325
-                'route_id'  => isset($params['route_id']) ? $params['route_id'] : null
326
-            ),
327
-            'body'   => array(
328
-                'addresses' => isset($params['addresses']) ? $params['addresses'] : null
329
-            ),
330
-            'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
331
-        ));
318
+	public function addAddresses($params)
319
+	{
320
+		$route = Route4Me::makeRequst(array(
321
+			'url'    => Endpoint::ROUTE_V4,
322
+			'method' => 'PUT',
323
+			'query'  => array(
324
+				'api_key'   => Route4Me::getApiKey(),
325
+				'route_id'  => isset($params['route_id']) ? $params['route_id'] : null
326
+			),
327
+			'body'   => array(
328
+				'addresses' => isset($params['addresses']) ? $params['addresses'] : null
329
+			),
330
+			'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
331
+		));
332 332
 
333
-        return Route::fromArray($route);
334
-    }
333
+		return Route::fromArray($route);
334
+	}
335 335
     
336
-    public function insertAddressOptimalPosition(array $params)
337
-    {
338
-        $route = Route4Me::makeRequst(array(
339
-            'url'    => Endpoint::ROUTE_V4,
340
-            'method' => 'PUT',
341
-            'query'  => array(
342
-                'api_key'  => Route4Me::getApiKey(),
343
-                'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
344
-            ),
345
-            'body'   => array(
346
-                'addresses'        => isset($params['addresses']) ? $params['addresses'] : null,
347
-                'optimal_position' => isset($params['optimal_position']) ? $params['optimal_position'] : null,
348
-            )
349
-        ));
336
+	public function insertAddressOptimalPosition(array $params)
337
+	{
338
+		$route = Route4Me::makeRequst(array(
339
+			'url'    => Endpoint::ROUTE_V4,
340
+			'method' => 'PUT',
341
+			'query'  => array(
342
+				'api_key'  => Route4Me::getApiKey(),
343
+				'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
344
+			),
345
+			'body'   => array(
346
+				'addresses'        => isset($params['addresses']) ? $params['addresses'] : null,
347
+				'optimal_position' => isset($params['optimal_position']) ? $params['optimal_position'] : null,
348
+			)
349
+		));
350 350
 
351
-        return Route::fromArray($route);
352
-    }
351
+		return Route::fromArray($route);
352
+	}
353 353
     
354
-    public function addNoteFile($params)
355
-    {
356
-        $fname = isset($params['strFilename']) ? $params['strFilename'] : null;
357
-        $rpath = realpath($fname);
354
+	public function addNoteFile($params)
355
+	{
356
+		$fname = isset($params['strFilename']) ? $params['strFilename'] : null;
357
+		$rpath = realpath($fname);
358 358
         
359
-        $result = Route4Me::makeRequst(array(
360
-            'url'    => Endpoint::ROUTE_NOTES_ADD,
361
-            'method' => 'POST',
362
-            'query'  => array(
363
-                'api_key'     => Route4Me::getApiKey(),
364
-                'route_id'    => isset($params['route_id']) ? $params['route_id'] : null,
365
-                'address_id'  => isset($params['address_id']) ? $params['address_id'] : null,
366
-                'dev_lat'     => isset($params['dev_lat']) ? $params['dev_lat'] : null,
367
-                'dev_lng'     => isset($params['dev_lng']) ? $params['dev_lng'] : null,
368
-                'device_type' => isset($params['device_type']) ? $params['device_type'] : null,
369
-                'dev_lng'     => isset($params['dev_lng']) ? $params['dev_lng'] : null,
370
-            ),
371
-            'body'  => array(
372
-                'strUpdateType'   => isset($params['strUpdateType']) ? $params['strUpdateType'] : null,
373
-                'strFilename'     => isset($params['strFilename']) ? $params['strFilename'] : null,
374
-                'strNoteContents' => isset($params['strNoteContents']) ? $params['strNoteContents'] : null,
375
-            ),
376
-            'FILE'  => $rpath,
359
+		$result = Route4Me::makeRequst(array(
360
+			'url'    => Endpoint::ROUTE_NOTES_ADD,
361
+			'method' => 'POST',
362
+			'query'  => array(
363
+				'api_key'     => Route4Me::getApiKey(),
364
+				'route_id'    => isset($params['route_id']) ? $params['route_id'] : null,
365
+				'address_id'  => isset($params['address_id']) ? $params['address_id'] : null,
366
+				'dev_lat'     => isset($params['dev_lat']) ? $params['dev_lat'] : null,
367
+				'dev_lng'     => isset($params['dev_lng']) ? $params['dev_lng'] : null,
368
+				'device_type' => isset($params['device_type']) ? $params['device_type'] : null,
369
+				'dev_lng'     => isset($params['dev_lng']) ? $params['dev_lng'] : null,
370
+			),
371
+			'body'  => array(
372
+				'strUpdateType'   => isset($params['strUpdateType']) ? $params['strUpdateType'] : null,
373
+				'strFilename'     => isset($params['strFilename']) ? $params['strFilename'] : null,
374
+				'strNoteContents' => isset($params['strNoteContents']) ? $params['strNoteContents'] : null,
375
+			),
376
+			'FILE'  => $rpath,
377 377
 
378
-            'HTTPHEADER' => array(
379
-                'Content-Type: application/x-www-form-urlencoded'
380
-            )
381
-        ));
378
+			'HTTPHEADER' => array(
379
+				'Content-Type: application/x-www-form-urlencoded'
380
+			)
381
+		));
382 382
 
383
-        return $result;
384
-    }
383
+		return $result;
384
+	}
385 385
 
386
-    public function delete($route_id)
387
-    {
388
-        $result = Route4Me::makeRequst(array(
389
-            'url'    => Endpoint::ROUTE_V4,
390
-            'method' => 'DELETE',
391
-            'query'  => array('route_id' => $route_id )
392
-        ));
386
+	public function delete($route_id)
387
+	{
388
+		$result = Route4Me::makeRequst(array(
389
+			'url'    => Endpoint::ROUTE_V4,
390
+			'method' => 'DELETE',
391
+			'query'  => array('route_id' => $route_id )
392
+		));
393 393
         
394
-         $result = Route4Me::makeRequst(array(
395
-            'url'    => Endpoint::ROUTES_DELETE,
396
-            'method' => 'DELETE',
397
-            'query'  => array(
398
-                'api_key' => Route4Me::getApiKey(),
399
-                'route_id' => $route_id,
400
-            )
401
-        ));
394
+		 $result = Route4Me::makeRequst(array(
395
+			'url'    => Endpoint::ROUTES_DELETE,
396
+			'method' => 'DELETE',
397
+			'query'  => array(
398
+				'api_key' => Route4Me::getApiKey(),
399
+				'route_id' => $route_id,
400
+			)
401
+		));
402 402
         
403
-        return $result;
404
-    }
403
+		return $result;
404
+	}
405 405
     
406
-    public function GetAddressesFromRoute($route_id)
407
-    {
408
-        $route1 = Route::getRoutes($route_id,null);
406
+	public function GetAddressesFromRoute($route_id)
407
+	{
408
+		$route1 = Route::getRoutes($route_id,null);
409 409
         
410
-        if (isset($route1)) {
411
-            return $route1->addresses;
412
-        } else {
413
-            return null;
414
-        }
415
-    }
410
+		if (isset($route1)) {
411
+			return $route1->addresses;
412
+		} else {
413
+			return null;
414
+		}
415
+	}
416 416
     
417
-    public function GetRandomAddressFromRoute($route_id)
418
-    {
419
-        $route1 = Route::getRoutes($route_id, null);
417
+	public function GetRandomAddressFromRoute($route_id)
418
+	{
419
+		$route1 = Route::getRoutes($route_id, null);
420 420
         
421
-        if (isset($route1)) {
422
-            $addresses = $route1->addresses;
421
+		if (isset($route1)) {
422
+			$addresses = $route1->addresses;
423 423
             
424
-            $rnd = rand(0, sizeof($addresses) - 1);
424
+			$rnd = rand(0, sizeof($addresses) - 1);
425 425
             
426
-            return $addresses[$rnd];
427
-        } else {
428
-            return null;
429
-        }
430
-    }
426
+			return $addresses[$rnd];
427
+		} else {
428
+			return null;
429
+		}
430
+	}
431 431
 
432
-    public function getRouteId()
433
-    {
434
-        return $this->route_id;
435
-    }
432
+	public function getRouteId()
433
+	{
434
+		return $this->route_id;
435
+	}
436 436
 
437
-    public function getOptimizationId()
438
-    {
439
-        return $this->optimization_problem_id;
440
-    }
437
+	public function getOptimizationId()
438
+	{
439
+		return $this->optimization_problem_id;
440
+	}
441 441
     
442
-    public function GetLastLocation(array $params)
443
-    {
444
-        $route = Route4Me::makeRequst(array(
445
-            'url'    => Endpoint::ROUTE_V4,
446
-            'method' => 'GET',
447
-            'query'  => array(
448
-                'api_key'                 => Route4Me::getApiKey(),
449
-                'route_id'                => isset($params['route_id']) ? $params['route_id'] : null,
450
-                'device_tracking_history' => isset($params['device_tracking_history']) ? $params['device_tracking_history'] : null
451
-            )
452
-        ));
442
+	public function GetLastLocation(array $params)
443
+	{
444
+		$route = Route4Me::makeRequst(array(
445
+			'url'    => Endpoint::ROUTE_V4,
446
+			'method' => 'GET',
447
+			'query'  => array(
448
+				'api_key'                 => Route4Me::getApiKey(),
449
+				'route_id'                => isset($params['route_id']) ? $params['route_id'] : null,
450
+				'device_tracking_history' => isset($params['device_tracking_history']) ? $params['device_tracking_history'] : null
451
+			)
452
+		));
453 453
 
454
-        return Route::fromArray($route);
455
-    }
454
+		return Route::fromArray($route);
455
+	}
456 456
     
457
-    public function GetTrackingHistoryFromTimeRange(array $params)
458
-    {
459
-        $route = Route4Me::makeRequst(array(
460
-            'url'    => Endpoint::GET_DEVICE_LOCATION,
461
-            'method' => 'GET',
462
-            'query'  => array(
463
-                'api_key'     => Route4Me::getApiKey(),
464
-                'route_id'    => isset($params['route_id']) ? $params['route_id'] : null,
465
-                'format'      => isset($params['format']) ? $params['format'] : null,
466
-                'time_period' => isset($params['time_period']) ? $params['time_period'] : null,
467
-                'start_date'  => isset($params['start_date']) ? $params['start_date'] : null,
468
-                'end_date'    => isset($params['end_date']) ? $params['end_date'] : null
469
-                )
470
-        ));
457
+	public function GetTrackingHistoryFromTimeRange(array $params)
458
+	{
459
+		$route = Route4Me::makeRequst(array(
460
+			'url'    => Endpoint::GET_DEVICE_LOCATION,
461
+			'method' => 'GET',
462
+			'query'  => array(
463
+				'api_key'     => Route4Me::getApiKey(),
464
+				'route_id'    => isset($params['route_id']) ? $params['route_id'] : null,
465
+				'format'      => isset($params['format']) ? $params['format'] : null,
466
+				'time_period' => isset($params['time_period']) ? $params['time_period'] : null,
467
+				'start_date'  => isset($params['start_date']) ? $params['start_date'] : null,
468
+				'end_date'    => isset($params['end_date']) ? $params['end_date'] : null
469
+				)
470
+		));
471 471
 
472
-        return $route;
473
-    }
472
+		return $route;
473
+	}
474 474
     
475
-    public function GetAssetTracking(array $params)
476
-    {
477
-        $route = Route4Me::makeRequst(array(
478
-            'url'    => Endpoint::STATUS_V4,
479
-            'method' => 'GET',
480
-            'query'  => array(
481
-                'api_key'  => Route4Me::getApiKey(),
482
-                'tracking' => isset($params['tracking']) ? $params['tracking'] : null
483
-                )
484
-        ));
475
+	public function GetAssetTracking(array $params)
476
+	{
477
+		$route = Route4Me::makeRequst(array(
478
+			'url'    => Endpoint::STATUS_V4,
479
+			'method' => 'GET',
480
+			'query'  => array(
481
+				'api_key'  => Route4Me::getApiKey(),
482
+				'tracking' => isset($params['tracking']) ? $params['tracking'] : null
483
+				)
484
+		));
485 485
 
486
-        return $route;
487
-    }
486
+		return $route;
487
+	}
488 488
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
         $result = Route4Me::makeRequst(array(
389 389
             'url'    => Endpoint::ROUTE_V4,
390 390
             'method' => 'DELETE',
391
-            'query'  => array('route_id' => $route_id )
391
+            'query'  => array('route_id' => $route_id)
392 392
         ));
393 393
         
394 394
          $result = Route4Me::makeRequst(array(
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
     
406 406
     public function GetAddressesFromRoute($route_id)
407 407
     {
408
-        $route1 = Route::getRoutes($route_id,null);
408
+        $route1 = Route::getRoutes($route_id, null);
409 409
         
410 410
         if (isset($route1)) {
411 411
             return $route1->addresses;
Please login to merge, or discard this patch.
src/Route4Me/AddressBookLocation.php 4 patches
Indentation   +427 added lines, -427 removed lines patch added patch discarded remove patch
@@ -6,510 +6,510 @@
 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
-    /**
147
-     * @param AddressBookLocation $params
148
-    */
149
-    public static function addAdressBookLocation($params)
150
-    {
151
-        $body = array();
152
-        $abLocations = new AddressBookLocation();
146
+	/**
147
+	 * @param AddressBookLocation $params
148
+	 */
149
+	public static function addAdressBookLocation($params)
150
+	{
151
+		$body = array();
152
+		$abLocations = new AddressBookLocation();
153 153
         
154
-        foreach ($params as $key => $value) {
155
-            if ($key=="address_id") {
156
-                continue;
157
-            }
154
+		foreach ($params as $key => $value) {
155
+			if ($key=="address_id") {
156
+				continue;
157
+			}
158 158
             
159
-            if (property_exists($abLocations, $key)) {
160
-                if (isset($params->{$key})) {
161
-                    $body[$key] = $params->{$key};
162
-                } 
163
-            }
164
-        }
159
+			if (property_exists($abLocations, $key)) {
160
+				if (isset($params->{$key})) {
161
+					$body[$key] = $params->{$key};
162
+				} 
163
+			}
164
+		}
165 165
         
166
-        $response = Route4Me::makeRequst(array(
167
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
168
-            'method' => 'POST',
169
-            'body'   => $body
170
-        ));
166
+		$response = Route4Me::makeRequst(array(
167
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
168
+			'method' => 'POST',
169
+			'body'   => $body
170
+		));
171 171
 
172
-        return $response;
173
-    }
172
+		return $response;
173
+	}
174 174
     
175
-    public function deleteAdressBookLocation($address_ids)
176
-    {
177
-        $result = Route4Me::makeRequst(array(
178
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
179
-            'method' => 'DELETEARRAY',
180
-            'query'  => array(
181
-                'address_ids' => $address_ids
182
-            )
183
-        ));
175
+	public function deleteAdressBookLocation($address_ids)
176
+	{
177
+		$result = Route4Me::makeRequst(array(
178
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
179
+			'method' => 'DELETEARRAY',
180
+			'query'  => array(
181
+				'address_ids' => $address_ids
182
+			)
183
+		));
184 184
 
185
-        return $result;
186
-    }
185
+		return $result;
186
+	}
187 187
     
188
-    public function updateAdressBookLocation($params)
189
-    {
190
-        $body = array();
191
-        $abLocations = new AddressBookLocation();
188
+	public function updateAdressBookLocation($params)
189
+	{
190
+		$body = array();
191
+		$abLocations = new AddressBookLocation();
192 192
         
193
-        foreach ($params as $key => $value) {
194
-            if (property_exists($abLocations, $key)) {
195
-                if (isset($params->{$key})) {
196
-                    $body[$key] = $params->{$key};
197
-                } 
198
-            }
199
-        }
193
+		foreach ($params as $key => $value) {
194
+			if (property_exists($abLocations, $key)) {
195
+				if (isset($params->{$key})) {
196
+					$body[$key] = $params->{$key};
197
+				} 
198
+			}
199
+		}
200 200
 
201
-        $response = Route4Me::makeRequst(array(
202
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
203
-            'method' => 'PUT',
204
-            'body'   => $body,
205
-        ));
201
+		$response = Route4Me::makeRequst(array(
202
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
203
+			'method' => 'PUT',
204
+			'body'   => $body,
205
+		));
206 206
 
207
-        return $response;
208
-    }
207
+		return $response;
208
+	}
209 209
         
210
-    public static function get($params)
211
-    {
212
-        $ablocations = Route4Me::makeRequst(array(
213
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
214
-            'method' => 'ADD',
215
-            'query'  => array(
216
-                'first_name' => isset($params->first_name) ? $params->first_name : null,
217
-                'address_1'  => isset($params->address_1) ? $params->address_1 : null,
218
-                'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null,
219
-                'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null,
220
-            )
221
-        ));
210
+	public static function get($params)
211
+	{
212
+		$ablocations = Route4Me::makeRequst(array(
213
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
214
+			'method' => 'ADD',
215
+			'query'  => array(
216
+				'first_name' => isset($params->first_name) ? $params->first_name : null,
217
+				'address_1'  => isset($params->address_1) ? $params->address_1 : null,
218
+				'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null,
219
+				'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null,
220
+			)
221
+		));
222 222
 
223
-        return $ablocations;
224
-    }
223
+		return $ablocations;
224
+	}
225 225
     
226
-    public static function validateScheduleMode($scheduleMode)
227
-    {
228
-        $schedMmodes = array("daily", "weekly", "monthly", "annually");
226
+	public static function validateScheduleMode($scheduleMode)
227
+	{
228
+		$schedMmodes = array("daily", "weekly", "monthly", "annually");
229 229
         
230
-        if (in_array($scheduleMode, $schedMmodes)) {
231
-            return TRUE; 
232
-        } else {
233
-            return FALSE;
234
-        }
235
-    }
230
+		if (in_array($scheduleMode, $schedMmodes)) {
231
+			return TRUE; 
232
+		} else {
233
+			return FALSE;
234
+		}
235
+	}
236 236
     
237
-    public static function validateScheduleEnable($scheduleEnabled)
238
-    {
239
-        $schedEnables = array(TRUE, FALSE);
237
+	public static function validateScheduleEnable($scheduleEnabled)
238
+	{
239
+		$schedEnables = array(TRUE, FALSE);
240 240
         
241
-        if (in_array($scheduleEnabled, $schedEnables)) {
242
-            return TRUE;
243
-        } else {
244
-            return FALSE;
245
-        }
246
-    }
241
+		if (in_array($scheduleEnabled, $schedEnables)) {
242
+			return TRUE;
243
+		} else {
244
+			return FALSE;
245
+		}
246
+	}
247 247
     
248
-    public static function validateScheduleEvery($scheduleEvery)
249
-    {
250
-        if (is_numeric($scheduleEvery)) {
251
-            return TRUE;
252
-        } else {
253
-            return FALSE;
254
-        }
255
-    }
248
+	public static function validateScheduleEvery($scheduleEvery)
249
+	{
250
+		if (is_numeric($scheduleEvery)) {
251
+			return TRUE;
252
+		} else {
253
+			return FALSE;
254
+		}
255
+	}
256 256
     
257
-    public static function validateScheduleWeekDays($scheduleWeekDays)
258
-    {
259
-        $weekdays = explode(',', $scheduleWeekDays);
257
+	public static function validateScheduleWeekDays($scheduleWeekDays)
258
+	{
259
+		$weekdays = explode(',', $scheduleWeekDays);
260 260
         
261
-        if (sizeof($weekdays)<1) return FALSE;
261
+		if (sizeof($weekdays)<1) return FALSE;
262 262
         
263
-        $isValid = TRUE;
263
+		$isValid = TRUE;
264 264
         
265
-        for ($i=0; $i<sizeof($weekdays); $i++) { 
266
-            if (is_numeric($weekdays[$i])) {
267
-                $wday = intval($weekdays[$i]);
268
-                if ($wday<1 || $wday>7) $isValid = FALSE;
269
-            } else {
270
-                $isValid = FALSE;
271
-            }
272
-        }
265
+		for ($i=0; $i<sizeof($weekdays); $i++) { 
266
+			if (is_numeric($weekdays[$i])) {
267
+				$wday = intval($weekdays[$i]);
268
+				if ($wday<1 || $wday>7) $isValid = FALSE;
269
+			} else {
270
+				$isValid = FALSE;
271
+			}
272
+		}
273 273
         
274
-        return $isValid;
275
-    }
274
+		return $isValid;
275
+	}
276 276
     
277
-    public static function validateScheduleMonthlyMode($scheduleMonthlyMode)
278
-    {
279
-        $schedMonthlyMmodes = array("dates", "nth");
277
+	public static function validateScheduleMonthlyMode($scheduleMonthlyMode)
278
+	{
279
+		$schedMonthlyMmodes = array("dates", "nth");
280 280
         
281
-        if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes)) {
282
-            return TRUE;
283
-        } else {
284
-            return FALSE;
285
-        }
286
-    }
281
+		if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes)) {
282
+			return TRUE;
283
+		} else {
284
+			return FALSE;
285
+		}
286
+	}
287 287
     
288
-    public static function validateScheduleMonthlyDates($scheduleMonthlyDates)
289
-    {
290
-        $monthlyDates = explode(',', $scheduleMonthlyDates);
288
+	public static function validateScheduleMonthlyDates($scheduleMonthlyDates)
289
+	{
290
+		$monthlyDates = explode(',', $scheduleMonthlyDates);
291 291
         
292
-        if (sizeof($monthlyDates) <1) return FALSE;
292
+		if (sizeof($monthlyDates) <1) return FALSE;
293 293
         
294
-        $isValid = TRUE;
294
+		$isValid = TRUE;
295 295
         
296
-        for ($i=0; $i < sizeof($monthlyDates); $i++) { 
297
-            if (is_numeric($monthlyDates[$i])) {
298
-                $mday = intval($monthlyDates[$i]);
299
-                if ($mday <1 || $mday > 31) $isValid = FALSE;
300
-            } else {
301
-                $isValid = FALSE;
302
-            }
303
-        }
296
+		for ($i=0; $i < sizeof($monthlyDates); $i++) { 
297
+			if (is_numeric($monthlyDates[$i])) {
298
+				$mday = intval($monthlyDates[$i]);
299
+				if ($mday <1 || $mday > 31) $isValid = FALSE;
300
+			} else {
301
+				$isValid = FALSE;
302
+			}
303
+		}
304 304
 
305
-        return $isValid;
306
-    }
305
+		return $isValid;
306
+	}
307 307
     
308
-    public static function validateScheduleNthN($scheduleNthN)
309
-    {
310
-        if (!is_numeric($scheduleNthN)) return FALSE;
308
+	public static function validateScheduleNthN($scheduleNthN)
309
+	{
310
+		if (!is_numeric($scheduleNthN)) return FALSE;
311 311
         
312
-        $schedNthNs = array(1, 2, 3, 4, 5, -1);
312
+		$schedNthNs = array(1, 2, 3, 4, 5, -1);
313 313
         
314
-        if (in_array($scheduleNthN, $schedNthNs)) {
315
-            return TRUE;
316
-        } else {
317
-            return FALSE;
318
-        }
319
-    }
314
+		if (in_array($scheduleNthN, $schedNthNs)) {
315
+			return TRUE;
316
+		} else {
317
+			return FALSE;
318
+		}
319
+	}
320 320
     
321
-    public static function validateScheduleNthWhat($scheduleNthWhat)
322
-    {
323
-        if (!is_numeric($scheduleNthWhat)) return FALSE;
321
+	public static function validateScheduleNthWhat($scheduleNthWhat)
322
+	{
323
+		if (!is_numeric($scheduleNthWhat)) return FALSE;
324 324
         
325
-        $schedNthWhats = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
325
+		$schedNthWhats = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
326 326
         
327
-        if (in_array($scheduleNthWhat, $schedNthWhats)) {
328
-            return TRUE;
329
-        } else {
330
-            return FALSE;
331
-        }
332
-    }
327
+		if (in_array($scheduleNthWhat, $schedNthWhats)) {
328
+			return TRUE;
329
+		} else {
330
+			return FALSE;
331
+		}
332
+	}
333 333
     
334
-    /* Function adds the locations (with/without schedule) from the CSV file. 
334
+	/* Function adds the locations (with/without schedule) from the CSV file. 
335 335
      * $csvFileHandle - a file handler.
336 336
      * Returns array $results which contains two arrays: fail and succes.
337 337
      */
338
-    public function addLocationsFromCsvFile($csvFileHandle, $locationsFieldsMapping)
339
-    {
340
-        $max_line_length = 512;
341
-        $delemietr = ',';
338
+	public function addLocationsFromCsvFile($csvFileHandle, $locationsFieldsMapping)
339
+	{
340
+		$max_line_length = 512;
341
+		$delemietr = ',';
342 342
         
343
-        $results = array();
344
-        $results['fail'] = array();
345
-        $results['success'] = array();
343
+		$results = array();
344
+		$results['fail'] = array();
345
+		$results['success'] = array();
346 346
         
347
-        $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
347
+		$columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
348 348
         
349
-        $addressBookFields = array("cached_lat","cached_lng","curbside_lat","curbside_lng","address_alias","address_1","address_2","address_city",
350
-                "address_state_id","address_zip","address_phone_number","schedule","address_group","first_name","last_name","local_time_window_start",
351
-                "local_time_window_end","local_time_window_start_2","local_time_window_end_2","address_email","address_country_id","address_custom_data",
352
-                "schedule_blacklist","service_time","local_timezone_string","color","address_icon","address_stop_type","address_cube","address_pieces",
353
-                "address_reference_no","address_revenue","address_weight","address_priority","address_customer_po");
349
+		$addressBookFields = array("cached_lat","cached_lng","curbside_lat","curbside_lng","address_alias","address_1","address_2","address_city",
350
+				"address_state_id","address_zip","address_phone_number","schedule","address_group","first_name","last_name","local_time_window_start",
351
+				"local_time_window_end","local_time_window_start_2","local_time_window_end_2","address_email","address_country_id","address_custom_data",
352
+				"schedule_blacklist","service_time","local_timezone_string","color","address_icon","address_stop_type","address_cube","address_pieces",
353
+				"address_reference_no","address_revenue","address_weight","address_priority","address_customer_po");
354 354
 
355
-        if (empty($columns)) {
356
-            array_push($results['fail'], 'Empty CSV table');
357
-            return ($results);
358
-        }
355
+		if (empty($columns)) {
356
+			array_push($results['fail'], 'Empty CSV table');
357
+			return ($results);
358
+		}
359 359
 
360
-        $iRow = 1;
360
+		$iRow = 1;
361 361
         
362
-        while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr)) !== false) {
363
-            if ($rows[$locationsFieldsMapping['cached_lat']] 
364
-                  && $rows[$locationsFieldsMapping['cached_lng']] 
365
-                  && $rows[$locationsFieldsMapping['address_1']] 
366
-                  && array(null)!==$rows) {
367
-                $curSchedule = "";
368
-                $mode = "";
362
+		while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr)) !== false) {
363
+			if ($rows[$locationsFieldsMapping['cached_lat']] 
364
+				  && $rows[$locationsFieldsMapping['cached_lng']] 
365
+				  && $rows[$locationsFieldsMapping['address_1']] 
366
+				  && array(null)!==$rows) {
367
+				$curSchedule = "";
368
+				$mode = "";
369 369
                 
370
-                if (isset($rows[$locationsFieldsMapping['schedule_mode']])) {
371
-                    if ($this->validateScheduleMode($rows[$locationsFieldsMapping['schedule_mode']])) {
372
-                        $curSchedule = '"mode":"'.$rows[$locationsFieldsMapping['schedule_mode']].'",'; 
373
-                        $mode = $rows[$locationsFieldsMapping['schedule_mode']];
374
-                    } else {
375
-                        array_push($results['fail'], "$iRow --> Wrong schedule mode parameter"); 
376
-                        $curSchedule = "";
377
-                    }
378
-                } else {
379
-                    array_push($results['fail'], "$iRow --> The schedule mode parameter is not set"); 
380
-                    $curSchedule = "";
381
-                }
370
+				if (isset($rows[$locationsFieldsMapping['schedule_mode']])) {
371
+					if ($this->validateScheduleMode($rows[$locationsFieldsMapping['schedule_mode']])) {
372
+						$curSchedule = '"mode":"'.$rows[$locationsFieldsMapping['schedule_mode']].'",'; 
373
+						$mode = $rows[$locationsFieldsMapping['schedule_mode']];
374
+					} else {
375
+						array_push($results['fail'], "$iRow --> Wrong schedule mode parameter"); 
376
+						$curSchedule = "";
377
+					}
378
+				} else {
379
+					array_push($results['fail'], "$iRow --> The schedule mode parameter is not set"); 
380
+					$curSchedule = "";
381
+				}
382 382
                 
383
-                if (isset($rows[$locationsFieldsMapping['schedule_enabled']])) {
384
-                    if ($this->validateScheduleEnable($rows[$locationsFieldsMapping['schedule_enabled']])) { 
385
-                        $curSchedule .= '"enabled":'.$rows[$locationsFieldsMapping['schedule_enabled']].',';
386
-                    } else {
387
-                        array_push($results['fail'], "$iRow --> The schedule enabled parameter is not set ");  
388
-                        $curSchedule = "";
389
-                    }
390
-                }
383
+				if (isset($rows[$locationsFieldsMapping['schedule_enabled']])) {
384
+					if ($this->validateScheduleEnable($rows[$locationsFieldsMapping['schedule_enabled']])) { 
385
+						$curSchedule .= '"enabled":'.$rows[$locationsFieldsMapping['schedule_enabled']].',';
386
+					} else {
387
+						array_push($results['fail'], "$iRow --> The schedule enabled parameter is not set ");  
388
+						$curSchedule = "";
389
+					}
390
+				}
391 391
                 
392
-                if (isset($rows[$locationsFieldsMapping['schedule_every']])) {
393
-                    if ($this->validateScheduleEvery($rows[$locationsFieldsMapping['schedule_every']])) {
394
-                        $curSchedule.='"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; 
395
-                        if ($mode == 'daily') {
396
-                            $curSchedule = trim($curSchedule,',');
397
-                            $curSchedule.='}';
398
-                        }
399
-                    } else {
400
-                        array_push($results['fail'], "$iRow --> The parameter sched_every is not set"); 
401
-                        $curSchedule = ""; 
402
-                    }
403
-                }
392
+				if (isset($rows[$locationsFieldsMapping['schedule_every']])) {
393
+					if ($this->validateScheduleEvery($rows[$locationsFieldsMapping['schedule_every']])) {
394
+						$curSchedule.='"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; 
395
+						if ($mode == 'daily') {
396
+							$curSchedule = trim($curSchedule,',');
397
+							$curSchedule.='}';
398
+						}
399
+					} else {
400
+						array_push($results['fail'], "$iRow --> The parameter sched_every is not set"); 
401
+						$curSchedule = ""; 
402
+					}
403
+				}
404 404
                 
405
-                if ($mode!='daily') {
406
-                    switch ($mode) {
407
-                        case 'weekly':
408
-                            if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) {
409
-                                if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) {
410
-                                     $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}';
411
-                                } else {
412
-                                    array_push($results['fail'], "$iRow --> Wrong weekdays"); 
413
-                                    $curSchedule = "";
414
-                                }
415
-                            } else {
416
-                                array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); 
417
-                                $curSchedule = "";
418
-                            }
419
-                            break;
420
-                        case 'monthly':
421
-                            $monthlyMode = "";
422
-                            if (isset($rows[$locationsFieldsMapping['monthly_mode']])) {
423
-                                if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) {
424
-                                     $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']];
425
-                                     $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",';
426
-                                } else {
427
-                                    array_push($results['fail'], "$iRow --> Wrong monthly mode"); 
428
-                                    $curSchedule = "";
429
-                                }
430
-                            } else {
431
-                                array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); 
432
-                                $curSchedule = "";
433
-                            }
405
+				if ($mode!='daily') {
406
+					switch ($mode) {
407
+						case 'weekly':
408
+							if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) {
409
+								if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) {
410
+									 $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}';
411
+								} else {
412
+									array_push($results['fail'], "$iRow --> Wrong weekdays"); 
413
+									$curSchedule = "";
414
+								}
415
+							} else {
416
+								array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); 
417
+								$curSchedule = "";
418
+							}
419
+							break;
420
+						case 'monthly':
421
+							$monthlyMode = "";
422
+							if (isset($rows[$locationsFieldsMapping['monthly_mode']])) {
423
+								if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) {
424
+									 $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']];
425
+									 $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",';
426
+								} else {
427
+									array_push($results['fail'], "$iRow --> Wrong monthly mode"); 
428
+									$curSchedule = "";
429
+								}
430
+							} else {
431
+								array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); 
432
+								$curSchedule = "";
433
+							}
434 434
                             
435
-                            if ($monthlyMode != "") {
436
-                                switch ($monthlyMode) {
437
-                                    case 'dates':
438
-                                        if (isset($rows[$locationsFieldsMapping['monthly_dates']])) {
439
-                                            if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) {
440
-                                                 $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}';
441
-                                            } else {
442
-                                                array_push($results['fail'], "$iRow --> Wrong monthly dates"); 
443
-                                                $curSchedule = "";
444
-                                            }
445
-                                        }
446
-                                        break;
447
-                                    case 'nth':
448
-                                        if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) {
449
-                                            if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) {
450
-                                                 $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].',';
451
-                                            } else {
452
-                                                array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); 
453
-                                                $curSchedule = "";
454
-                                            }
455
-                                        } else {
456
-                                            array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); 
457
-                                            $curSchedule = "";
458
-                                        }
435
+							if ($monthlyMode != "") {
436
+								switch ($monthlyMode) {
437
+									case 'dates':
438
+										if (isset($rows[$locationsFieldsMapping['monthly_dates']])) {
439
+											if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) {
440
+												 $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}';
441
+											} else {
442
+												array_push($results['fail'], "$iRow --> Wrong monthly dates"); 
443
+												$curSchedule = "";
444
+											}
445
+										}
446
+										break;
447
+									case 'nth':
448
+										if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) {
449
+											if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) {
450
+												 $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].',';
451
+											} else {
452
+												array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); 
453
+												$curSchedule = "";
454
+											}
455
+										} else {
456
+											array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); 
457
+											$curSchedule = "";
458
+										}
459 459
                                         
460
-                                        if ($curSchedule != "") {
461
-                                            if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
462
-                                                if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
463
-                                                     $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}';
464
-                                                } else {
465
-                                                    array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); 
466
-                                                    $curSchedule = "";
467
-                                                }
468
-                                            } else {
469
-                                                array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); 
470
-                                                $curSchedule = "";
471
-                                            }
472
-                                        }
473
-                                        break;
474
-                                }
475
-                            }
476
-                            break;
477
-                        default:
478
-                            $curSchedule = "";
479
-                            break;
480
-                    }
481
-                }
460
+										if ($curSchedule != "") {
461
+											if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
462
+												if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
463
+													 $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}';
464
+												} else {
465
+													array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); 
466
+													$curSchedule = "";
467
+												}
468
+											} else {
469
+												array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); 
470
+												$curSchedule = "";
471
+											}
472
+										}
473
+										break;
474
+								}
475
+							}
476
+							break;
477
+						default:
478
+							$curSchedule = "";
479
+							break;
480
+					}
481
+				}
482 482
 
483
-                if (($mode == 'daily' || $mode == 'weekly' || $mode == 'monthy') && $curSchedule == "") {
484
-                    $iRow++; 
485
-                    continue;
486
-                }
483
+				if (($mode == 'daily' || $mode == 'weekly' || $mode == 'monthy') && $curSchedule == "") {
484
+					$iRow++; 
485
+					continue;
486
+				}
487 487
                 
488
-                $curSchedule = strtolower($curSchedule);
488
+				$curSchedule = strtolower($curSchedule);
489 489
                 
490
-                $curSchedule = '[{'.$curSchedule.'}]';
490
+				$curSchedule = '[{'.$curSchedule.'}]';
491 491
 
492
-                $oSchedule = json_decode($curSchedule,TRUE);
492
+				$oSchedule = json_decode($curSchedule,TRUE);
493 493
                 
494
-                $parametersArray = array();
494
+				$parametersArray = array();
495 495
                 
496
-                foreach ($addressBookFields as $addressBookField) {
497
-                    if (isset($locationsFieldsMapping[$addressBookField])) {
498
-                        $parametersArray[$addressBookField] = $rows[$locationsFieldsMapping[$addressBookField]];
499
-                    }
500
-                }
496
+				foreach ($addressBookFields as $addressBookField) {
497
+					if (isset($locationsFieldsMapping[$addressBookField])) {
498
+						$parametersArray[$addressBookField] = $rows[$locationsFieldsMapping[$addressBookField]];
499
+					}
500
+				}
501 501
                 
502
-                $AdressBookLocationParameters = AddressBookLocation::fromArray($parametersArray);
502
+				$AdressBookLocationParameters = AddressBookLocation::fromArray($parametersArray);
503 503
                 
504
-                $abContacts = new AddressBookLocation();
504
+				$abContacts = new AddressBookLocation();
505 505
 
506
-                $abcResults = $abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry
506
+				$abcResults = $abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry
507 507
                 
508
-                array_push($results['success'], "The schedule location with address_id = ".strval($abcResults["address_id"])." added successfuly.");
509
-            }
510
-        }
508
+				array_push($results['success'], "The schedule location with address_id = ".strval($abcResults["address_id"])." added successfuly.");
509
+			}
510
+		}
511 511
 
512
-        return $results;
513
-    }
512
+		return $results;
513
+	}
514 514
  }
515
-    
516 515
\ No newline at end of file
516
+	
517 517
\ No newline at end of file
Please login to merge, or discard this patch.
Switch Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -404,79 +404,79 @@
 block discarded – undo
404 404
                 
405 405
                 if ($mode!='daily') {
406 406
                     switch ($mode) {
407
-                        case 'weekly':
408
-                            if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) {
409
-                                if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) {
410
-                                     $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}';
411
-                                } else {
412
-                                    array_push($results['fail'], "$iRow --> Wrong weekdays"); 
413
-                                    $curSchedule = "";
414
-                                }
407
+                    case 'weekly':
408
+                        if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) {
409
+                            if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) {
410
+                                 $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}';
411
+                            } else {
412
+                                array_push($results['fail'], "$iRow --> Wrong weekdays"); 
413
+                                $curSchedule = "";
414
+                            }
415
+                        } else {
416
+                            array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); 
417
+                            $curSchedule = "";
418
+                        }
419
+                        break;
420
+                    case 'monthly':
421
+                        $monthlyMode = "";
422
+                        if (isset($rows[$locationsFieldsMapping['monthly_mode']])) {
423
+                            if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) {
424
+                                 $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']];
425
+                                 $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",';
415 426
                             } else {
416
-                                array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); 
427
+                                array_push($results['fail'], "$iRow --> Wrong monthly mode"); 
417 428
                                 $curSchedule = "";
418 429
                             }
430
+                        } else {
431
+                            array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); 
432
+                            $curSchedule = "";
433
+                        }
434
+                            
435
+                        if ($monthlyMode != "") {
436
+                            switch ($monthlyMode) {
437
+                            case 'dates':
438
+                            if (isset($rows[$locationsFieldsMapping['monthly_dates']])) {
439
+                            if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) {
440
+                                 $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}';
441
+                            } else {
442
+                                array_push($results['fail'], "$iRow --> Wrong monthly dates"); 
443
+                                $curSchedule = "";
444
+                            }
445
+                            }
419 446
                             break;
420
-                        case 'monthly':
421
-                            $monthlyMode = "";
422
-                            if (isset($rows[$locationsFieldsMapping['monthly_mode']])) {
423
-                                if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) {
424
-                                     $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']];
425
-                                     $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",';
447
+                            case 'nth':
448
+                            if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) {
449
+                            if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) {
450
+                                 $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].',';
451
+                            } else {
452
+                                array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); 
453
+                                $curSchedule = "";
454
+                            }
455
+                            } else {
456
+                            array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); 
457
+                            $curSchedule = "";
458
+                            }
459
+                                        
460
+                            if ($curSchedule != "") {
461
+                            if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
462
+                                if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
463
+                                     $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}';
426 464
                                 } else {
427
-                                    array_push($results['fail'], "$iRow --> Wrong monthly mode"); 
465
+                                    array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); 
428 466
                                     $curSchedule = "";
429 467
                                 }
430 468
                             } else {
431
-                                array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); 
469
+                                array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); 
432 470
                                 $curSchedule = "";
433 471
                             }
434
-                            
435
-                            if ($monthlyMode != "") {
436
-                                switch ($monthlyMode) {
437
-                                    case 'dates':
438
-                                        if (isset($rows[$locationsFieldsMapping['monthly_dates']])) {
439
-                                            if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) {
440
-                                                 $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}';
441
-                                            } else {
442
-                                                array_push($results['fail'], "$iRow --> Wrong monthly dates"); 
443
-                                                $curSchedule = "";
444
-                                            }
445
-                                        }
446
-                                        break;
447
-                                    case 'nth':
448
-                                        if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) {
449
-                                            if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) {
450
-                                                 $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].',';
451
-                                            } else {
452
-                                                array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); 
453
-                                                $curSchedule = "";
454
-                                            }
455
-                                        } else {
456
-                                            array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); 
457
-                                            $curSchedule = "";
458
-                                        }
459
-                                        
460
-                                        if ($curSchedule != "") {
461
-                                            if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
462
-                                                if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
463
-                                                     $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}';
464
-                                                } else {
465
-                                                    array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); 
466
-                                                    $curSchedule = "";
467
-                                                }
468
-                                            } else {
469
-                                                array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); 
470
-                                                $curSchedule = "";
471
-                                            }
472
-                                        }
473
-                                        break;
474
-                                }
475 472
                             }
476 473
                             break;
477
-                        default:
478
-                            $curSchedule = "";
474
+                            }
475
+                            }
479 476
                             break;
477
+                    default:
478
+                        $curSchedule = "";
479
+                        break;
480 480
                     }
481 481
                 }
482 482
 
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
         
263 263
         $isValid = TRUE;
264 264
         
265
-        for ($i=0; $i<sizeof($weekdays); $i++) { 
265
+        for ($i = 0; $i<sizeof($weekdays); $i++) { 
266 266
             if (is_numeric($weekdays[$i])) {
267 267
                 $wday = intval($weekdays[$i]);
268 268
                 if ($wday<1 || $wday>7) $isValid = FALSE;
@@ -289,14 +289,14 @@  discard block
 block discarded – undo
289 289
     {
290 290
         $monthlyDates = explode(',', $scheduleMonthlyDates);
291 291
         
292
-        if (sizeof($monthlyDates) <1) return FALSE;
292
+        if (sizeof($monthlyDates)<1) return FALSE;
293 293
         
294 294
         $isValid = TRUE;
295 295
         
296
-        for ($i=0; $i < sizeof($monthlyDates); $i++) { 
296
+        for ($i = 0; $i<sizeof($monthlyDates); $i++) { 
297 297
             if (is_numeric($monthlyDates[$i])) {
298 298
                 $mday = intval($monthlyDates[$i]);
299
-                if ($mday <1 || $mday > 31) $isValid = FALSE;
299
+                if ($mday<1 || $mday>31) $isValid = FALSE;
300 300
             } else {
301 301
                 $isValid = FALSE;
302 302
             }
@@ -346,11 +346,11 @@  discard block
 block discarded – undo
346 346
         
347 347
         $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
348 348
         
349
-        $addressBookFields = array("cached_lat","cached_lng","curbside_lat","curbside_lng","address_alias","address_1","address_2","address_city",
350
-                "address_state_id","address_zip","address_phone_number","schedule","address_group","first_name","last_name","local_time_window_start",
351
-                "local_time_window_end","local_time_window_start_2","local_time_window_end_2","address_email","address_country_id","address_custom_data",
352
-                "schedule_blacklist","service_time","local_timezone_string","color","address_icon","address_stop_type","address_cube","address_pieces",
353
-                "address_reference_no","address_revenue","address_weight","address_priority","address_customer_po");
349
+        $addressBookFields = array("cached_lat", "cached_lng", "curbside_lat", "curbside_lng", "address_alias", "address_1", "address_2", "address_city",
350
+                "address_state_id", "address_zip", "address_phone_number", "schedule", "address_group", "first_name", "last_name", "local_time_window_start",
351
+                "local_time_window_end", "local_time_window_start_2", "local_time_window_end_2", "address_email", "address_country_id", "address_custom_data",
352
+                "schedule_blacklist", "service_time", "local_timezone_string", "color", "address_icon", "address_stop_type", "address_cube", "address_pieces",
353
+                "address_reference_no", "address_revenue", "address_weight", "address_priority", "address_customer_po");
354 354
 
355 355
         if (empty($columns)) {
356 356
             array_push($results['fail'], 'Empty CSV table');
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
         $iRow = 1;
361 361
         
362
-        while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr)) !== false) {
362
+        while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))!==false) {
363 363
             if ($rows[$locationsFieldsMapping['cached_lat']] 
364 364
                   && $rows[$locationsFieldsMapping['cached_lng']] 
365 365
                   && $rows[$locationsFieldsMapping['address_1']] 
@@ -391,10 +391,10 @@  discard block
 block discarded – undo
391 391
                 
392 392
                 if (isset($rows[$locationsFieldsMapping['schedule_every']])) {
393 393
                     if ($this->validateScheduleEvery($rows[$locationsFieldsMapping['schedule_every']])) {
394
-                        $curSchedule.='"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; 
395
-                        if ($mode == 'daily') {
396
-                            $curSchedule = trim($curSchedule,',');
397
-                            $curSchedule.='}';
394
+                        $curSchedule .= '"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; 
395
+                        if ($mode=='daily') {
396
+                            $curSchedule = trim($curSchedule, ',');
397
+                            $curSchedule .= '}';
398 398
                         }
399 399
                     } else {
400 400
                         array_push($results['fail'], "$iRow --> The parameter sched_every is not set"); 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
                                 $curSchedule = "";
433 433
                             }
434 434
                             
435
-                            if ($monthlyMode != "") {
435
+                            if ($monthlyMode!="") {
436 436
                                 switch ($monthlyMode) {
437 437
                                     case 'dates':
438 438
                                         if (isset($rows[$locationsFieldsMapping['monthly_dates']])) {
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
                                             $curSchedule = "";
458 458
                                         }
459 459
                                         
460
-                                        if ($curSchedule != "") {
460
+                                        if ($curSchedule!="") {
461 461
                                             if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
462 462
                                                 if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
463 463
                                                      $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}';
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
                     }
481 481
                 }
482 482
 
483
-                if (($mode == 'daily' || $mode == 'weekly' || $mode == 'monthy') && $curSchedule == "") {
483
+                if (($mode=='daily' || $mode=='weekly' || $mode=='monthy') && $curSchedule=="") {
484 484
                     $iRow++; 
485 485
                     continue;
486 486
                 }
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
                 
490 490
                 $curSchedule = '[{'.$curSchedule.'}]';
491 491
 
492
-                $oSchedule = json_decode($curSchedule,TRUE);
492
+                $oSchedule = json_decode($curSchedule, TRUE);
493 493
                 
494 494
                 $parametersArray = array();
495 495
                 
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -258,14 +258,18 @@  discard block
 block discarded – undo
258 258
     {
259 259
         $weekdays = explode(',', $scheduleWeekDays);
260 260
         
261
-        if (sizeof($weekdays)<1) return FALSE;
261
+        if (sizeof($weekdays)<1) {
262
+        	return FALSE;
263
+        }
262 264
         
263 265
         $isValid = TRUE;
264 266
         
265 267
         for ($i=0; $i<sizeof($weekdays); $i++) { 
266 268
             if (is_numeric($weekdays[$i])) {
267 269
                 $wday = intval($weekdays[$i]);
268
-                if ($wday<1 || $wday>7) $isValid = FALSE;
270
+                if ($wday<1 || $wday>7) {
271
+                	$isValid = FALSE;
272
+                }
269 273
             } else {
270 274
                 $isValid = FALSE;
271 275
             }
@@ -289,14 +293,18 @@  discard block
 block discarded – undo
289 293
     {
290 294
         $monthlyDates = explode(',', $scheduleMonthlyDates);
291 295
         
292
-        if (sizeof($monthlyDates) <1) return FALSE;
296
+        if (sizeof($monthlyDates) <1) {
297
+        	return FALSE;
298
+        }
293 299
         
294 300
         $isValid = TRUE;
295 301
         
296 302
         for ($i=0; $i < sizeof($monthlyDates); $i++) { 
297 303
             if (is_numeric($monthlyDates[$i])) {
298 304
                 $mday = intval($monthlyDates[$i]);
299
-                if ($mday <1 || $mday > 31) $isValid = FALSE;
305
+                if ($mday <1 || $mday > 31) {
306
+                	$isValid = FALSE;
307
+                }
300 308
             } else {
301 309
                 $isValid = FALSE;
302 310
             }
@@ -307,7 +315,9 @@  discard block
 block discarded – undo
307 315
     
308 316
     public static function validateScheduleNthN($scheduleNthN)
309 317
     {
310
-        if (!is_numeric($scheduleNthN)) return FALSE;
318
+        if (!is_numeric($scheduleNthN)) {
319
+        	return FALSE;
320
+        }
311 321
         
312 322
         $schedNthNs = array(1, 2, 3, 4, 5, -1);
313 323
         
@@ -320,7 +330,9 @@  discard block
 block discarded – undo
320 330
     
321 331
     public static function validateScheduleNthWhat($scheduleNthWhat)
322 332
     {
323
-        if (!is_numeric($scheduleNthWhat)) return FALSE;
333
+        if (!is_numeric($scheduleNthWhat)) {
334
+        	return FALSE;
335
+        }
324 336
         
325 337
         $schedNthWhats = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
326 338
         
Please login to merge, or discard this patch.