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 ( 1527b5...1d156a )
by Oleg
02:42
created
examples/Activities/GetRouteTeamActivities.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace Route4Me;
3 3
 
4
-$root = realpath(dirname(__FILE__) . '/../../');
5
-require $root . '/vendor/autoload.php';
4
+$root = realpath(dirname(__FILE__).'/../../');
5
+require $root.'/vendor/autoload.php';
6 6
 
7 7
 use Route4Me\Route4Me;
8 8
 use Route4Me\Route;
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
 $activities = new ActivityParameters();
28 28
 $actresults = $activities->getActivities($activityParameters);
29
-$results = $activities->getValue($actresults,"results");
29
+$results = $activities->getValue($actresults, "results");
30 30
 
31 31
 foreach ($results as $result) {
32 32
 	Route4Me::simplePrint($result);
Please login to merge, or discard this patch.
examples/Members/webinar_registration.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@
 block discarded – undo
13 13
 Route4Me::setApiKey('11111111111111111111111111111111');
14 14
 
15 15
 $recordParameters = Member::fromArray(array(
16
-    'email_address' => '[email protected]',
17
-    'first_name'    => 'Mmmmm',
18
-    'last_name'     => 'Ccccc',
19
-    'phone_number'  => '454-454544',
20
-    'company_name'  => 'c_name',
21
-    'member_id'     => '123456',
22
-    'webinar_date' => '2016-06-05 10:00:00'
16
+	'email_address' => '[email protected]',
17
+	'first_name'    => 'Mmmmm',
18
+	'last_name'     => 'Ccccc',
19
+	'phone_number'  => '454-454544',
20
+	'company_name'  => 'c_name',
21
+	'member_id'     => '123456',
22
+	'webinar_date' => '2016-06-05 10:00:00'
23 23
 ));
24 24
 
25 25
 $member = new Member();
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Route4Me;
3 3
 
4
-$root = realpath(dirname(__FILE__) . '/../../');
5
-require $root . '/vendor/autoload.php';
4
+$root = realpath(dirname(__FILE__).'/../../');
5
+require $root.'/vendor/autoload.php';
6 6
 
7 7
 use Route4Me\Route4Me;
8 8
 use Route4Me\Member;
Please login to merge, or discard this patch.
examples/AddressBook/GetAddressBookLocationsByIDs.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
 
13 13
 // Get two random locations IDs
14 14
 $adressBookLocationParameters = array(
15
-    "limit"   => 30,
16
-    "offset"  => 0
15
+	"limit"   => 30,
16
+	"offset"  => 0
17 17
 ); 
18 18
 
19 19
 $abContacts = new AddressBookLocation();
@@ -37,6 +37,6 @@  discard block
 block discarded – undo
37 37
 $results = $ablocation->getValue($abcResult,"results");
38 38
 
39 39
 foreach ($results as $result) {
40
-    Route4Me::simplePrint($result);
41
-    echo "<br>";
40
+	Route4Me::simplePrint($result);
41
+	echo "<br>";
42 42
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace Route4Me;
3 3
 
4
-$root = realpath(dirname(__FILE__) . '/../../');
5
-require $root . '/vendor/autoload.php';
4
+$root = realpath(dirname(__FILE__).'/../../');
5
+require $root.'/vendor/autoload.php';
6 6
 
7 7
 use Route4Me\Route4Me;
8 8
 use Route4Me\Route;
@@ -20,11 +20,11 @@  discard block
 block discarded – undo
20 20
 
21 21
 $abcResults = $abContacts->getAddressBookLocations($adressBookLocationParameters);
22 22
 
23
-$results = $abContacts->getValue($abcResults,"results");
23
+$results = $abContacts->getValue($abcResults, "results");
24 24
 
25 25
 $contactsNumber = sizeof($results);
26
-$id1 = $results[rand(1, $contactsNumber)-1]['address_id'];
27
-$id2 = $results[rand(1, $contactsNumber)-1]['address_id'];
26
+$id1 = $results[rand(1, $contactsNumber) - 1]['address_id'];
27
+$id2 = $results[rand(1, $contactsNumber) - 1]['address_id'];
28 28
 
29 29
 $ids = array();
30 30
 $ids['address_id'] = $id1.",".$id2;
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
 $abcResult = $ablocation->getAddressBookLocations($ids);
36 36
 
37
-$results = $ablocation->getValue($abcResult,"results");
37
+$results = $ablocation->getValue($abcResult, "results");
38 38
 
39 39
 foreach ($results as $result) {
40 40
     Route4Me::simplePrint($result);
Please login to merge, or discard this patch.
src/Route4Me/Order.php 2 patches
Indentation   +258 added lines, -258 removed lines patch added patch discarded remove patch
@@ -6,333 +6,333 @@
 block discarded – undo
6 6
 
7 7
 class Order extends Common
8 8
 {
9
-    public $address_1;
10
-    public $address_2;
11
-    public $cached_lat;
12
-    public $cached_lng;
13
-    public $curbside_lat;
14
-    public $curbside_lng;
15
-    public $address_alias;
16
-    public $address_city;
17
-    public $EXT_FIELD_first_name;
18
-    public $EXT_FIELD_last_name;
19
-    public $EXT_FIELD_email;
20
-    public $EXT_FIELD_phone;
21
-    public $EXT_FIELD_custom_data;
9
+	public $address_1;
10
+	public $address_2;
11
+	public $cached_lat;
12
+	public $cached_lng;
13
+	public $curbside_lat;
14
+	public $curbside_lng;
15
+	public $address_alias;
16
+	public $address_city;
17
+	public $EXT_FIELD_first_name;
18
+	public $EXT_FIELD_last_name;
19
+	public $EXT_FIELD_email;
20
+	public $EXT_FIELD_phone;
21
+	public $EXT_FIELD_custom_data;
22 22
     
23
-    public $color;
24
-    public $order_icon;
25
-    public $local_time_window_start;
26
-    public $local_time_window_end;
27
-    public $local_time_window_start_2;
28
-    public $local_time_window_end_2;
29
-    public $service_time;
23
+	public $color;
24
+	public $order_icon;
25
+	public $local_time_window_start;
26
+	public $local_time_window_end;
27
+	public $local_time_window_start_2;
28
+	public $local_time_window_end_2;
29
+	public $service_time;
30 30
     
31
-    public $day_scheduled_for_YYMMDD;
31
+	public $day_scheduled_for_YYMMDD;
32 32
     
33
-    public $route_id;
34
-    public $redirect;
35
-    public $optimization_problem_id;
36
-    public $order_id;
37
-    public $order_ids;
33
+	public $route_id;
34
+	public $redirect;
35
+	public $optimization_problem_id;
36
+	public $order_id;
37
+	public $order_ids;
38 38
     
39
-    public $day_added_YYMMDD;
40
-    public $scheduled_for_YYMMDD;
41
-    public $fields;
42
-    public $offset;
43
-    public $limit;
44
-    public $query;
39
+	public $day_added_YYMMDD;
40
+	public $scheduled_for_YYMMDD;
41
+	public $fields;
42
+	public $offset;
43
+	public $limit;
44
+	public $query;
45 45
     
46
-    public $created_timestamp;
47
-    public $order_status_id;
48
-    public $member_id;
49
-    public $address_state_id;
50
-    public $address_country_id;
51
-    public $address_zip;
52
-    public $in_route_count;
53
-    public $last_visited_timestamp;
54
-    public $last_routed_timestamp;
55
-    public $local_timezone_string;
56
-    public $is_validated;
57
-    public $is_pending;
58
-    public $is_accepted;
59
-    public $is_started;
60
-    public $is_completed;
61
-    public $custom_user_fields;
46
+	public $created_timestamp;
47
+	public $order_status_id;
48
+	public $member_id;
49
+	public $address_state_id;
50
+	public $address_country_id;
51
+	public $address_zip;
52
+	public $in_route_count;
53
+	public $last_visited_timestamp;
54
+	public $last_routed_timestamp;
55
+	public $local_timezone_string;
56
+	public $is_validated;
57
+	public $is_pending;
58
+	public $is_accepted;
59
+	public $is_started;
60
+	public $is_completed;
61
+	public $custom_user_fields;
62 62
     
63
-    public $addresses = array();
63
+	public $addresses = array();
64 64
     
65
-    public static function fromArray(array $params) {
66
-        $order = new Order();
67
-        foreach ($params as $key => $value) {
68
-            if (property_exists($order, $key)) {
69
-                $order->{$key} = $value;
70
-            }
71
-        }
65
+	public static function fromArray(array $params) {
66
+		$order = new Order();
67
+		foreach ($params as $key => $value) {
68
+			if (property_exists($order, $key)) {
69
+				$order->{$key} = $value;
70
+			}
71
+		}
72 72
         
73
-        return $order;
74
-    }
73
+		return $order;
74
+	}
75 75
     
76
-    /**
77
-     * @param Order $params
78
-     */
79
-    public static function addOrder($params)
80
-    {
81
-        $excludeFields = array('route_id', 'redirect', 'optimization_problem_id', 'order_id', 
82
-        'order_ids', 'fields', 'offset', 'limit', 'query', 'created_timestamp');
76
+	/**
77
+	 * @param Order $params
78
+	 */
79
+	public static function addOrder($params)
80
+	{
81
+		$excludeFields = array('route_id', 'redirect', 'optimization_problem_id', 'order_id', 
82
+		'order_ids', 'fields', 'offset', 'limit', 'query', 'created_timestamp');
83 83
         
84
-        $allBodyFields = Route4Me::getObjectProperties(new Order(), $excludeFields);
84
+		$allBodyFields = Route4Me::getObjectProperties(new Order(), $excludeFields);
85 85
         
86
-        $response = Route4Me::makeRequst(array(
87
-            'url'    => Endpoint::ORDER_V4,
88
-            'method' => 'POST',
89
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
90
-        ));
86
+		$response = Route4Me::makeRequst(array(
87
+			'url'    => Endpoint::ORDER_V4,
88
+			'method' => 'POST',
89
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
90
+		));
91 91
 
92
-        return $response;
93
-    }
92
+		return $response;
93
+	}
94 94
 
95
-    public static function addOrder2Route($params)
96
-    {
97
-        $allQueryFields = array('route_id', 'redirect');
98
-        $allBodyFields = array('addresses');
95
+	public static function addOrder2Route($params)
96
+	{
97
+		$allQueryFields = array('route_id', 'redirect');
98
+		$allBodyFields = array('addresses');
99 99
         
100
-        $response = Route4Me::makeRequst(array(
101
-            'url'    => Endpoint::ROUTE_V4,
102
-            'method' => 'PUT',
103
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
104
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
105
-        ));
100
+		$response = Route4Me::makeRequst(array(
101
+			'url'    => Endpoint::ROUTE_V4,
102
+			'method' => 'PUT',
103
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
104
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
105
+		));
106 106
 
107
-        return $response;
108
-    }
107
+		return $response;
108
+	}
109 109
     
110
-    public static function addOrder2Optimization($params)
111
-    {
112
-        $allQueryFields = array('optimization_problem_id', 'redirect', 'device_type');
113
-        $allBodyFields = array('addresses');
110
+	public static function addOrder2Optimization($params)
111
+	{
112
+		$allQueryFields = array('optimization_problem_id', 'redirect', 'device_type');
113
+		$allBodyFields = array('addresses');
114 114
         
115
-        $response = Route4Me::makeRequst(array(
116
-            'url'    => Endpoint::OPTIMIZATION_PROBLEM,
117
-            'method' => 'PUT',
118
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
119
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
120
-        ));
115
+		$response = Route4Me::makeRequst(array(
116
+			'url'    => Endpoint::OPTIMIZATION_PROBLEM,
117
+			'method' => 'PUT',
118
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
119
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
120
+		));
121 121
 
122
-        return $response;
123
-    }
122
+		return $response;
123
+	}
124 124
     
125
-    public static function getOrder($params)
126
-    {
127
-        $allQueryFields = array('order_id', 'fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit');
125
+	public static function getOrder($params)
126
+	{
127
+		$allQueryFields = array('order_id', 'fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit');
128 128
 
129
-        $response = Route4Me::makeRequst(array(
130
-            'url'    => Endpoint::ORDER_V4,
131
-            'method' => 'GET',
132
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
133
-        ));
129
+		$response = Route4Me::makeRequst(array(
130
+			'url'    => Endpoint::ORDER_V4,
131
+			'method' => 'GET',
132
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
133
+		));
134 134
 
135
-        return $response;
136
-    }
135
+		return $response;
136
+	}
137 137
     
138
-    public static function getOrders($params)
139
-    {
140
-        $allQueryFields = array('offset', 'limit');
138
+	public static function getOrders($params)
139
+	{
140
+		$allQueryFields = array('offset', 'limit');
141 141
         
142
-        $response = Route4Me::makeRequst(array(
143
-            'url'    => Endpoint::ORDER_V4,
144
-            'method' => 'GET',
145
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
146
-        ));
142
+		$response = Route4Me::makeRequst(array(
143
+			'url'    => Endpoint::ORDER_V4,
144
+			'method' => 'GET',
145
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
146
+		));
147 147
 
148
-        return $response;
149
-    }
148
+		return $response;
149
+	}
150 150
     
151
-    public function getRandomOrderId($offset, $limit)
152
-    {
153
-        $randomOrder = $this->getRandomOrder($offset, $limit);
151
+	public function getRandomOrderId($offset, $limit)
152
+	{
153
+		$randomOrder = $this->getRandomOrder($offset, $limit);
154 154
         
155
-        if (is_null($randomOrder)) {
156
-            return null;
157
-        }
155
+		if (is_null($randomOrder)) {
156
+			return null;
157
+		}
158 158
         
159
-        if (!isset($randomOrder)) {
160
-            return null;
161
-        }
159
+		if (!isset($randomOrder)) {
160
+			return null;
161
+		}
162 162
         
163
-        return $randomOrder['order_id'];
164
-    }
163
+		return $randomOrder['order_id'];
164
+	}
165 165
     
166
-    public function getRandomOrder($offset, $limit)
167
-    {
168
-        $params = array('offset' => $offset, 'limit' => $limit);
166
+	public function getRandomOrder($offset, $limit)
167
+	{
168
+		$params = array('offset' => $offset, 'limit' => $limit);
169 169
         
170
-        $orders = self::getOrders($params);
170
+		$orders = self::getOrders($params);
171 171
         
172
-        if (is_null($orders)) {
173
-            return null;
174
-        }
172
+		if (is_null($orders)) {
173
+			return null;
174
+		}
175 175
         
176
-        if (!isset($orders['results'])) {
177
-            return null;
178
-        }
176
+		if (!isset($orders['results'])) {
177
+			return null;
178
+		}
179 179
         
180
-        $randomIndex = rand(0, sizeof($orders['results']) - 1);
180
+		$randomIndex = rand(0, sizeof($orders['results']) - 1);
181 181
         
182
-        $order = $orders['results'][$randomIndex];
182
+		$order = $orders['results'][$randomIndex];
183 183
         
184
-        return $order;
185
-    }
184
+		return $order;
185
+	}
186 186
     
187
-    public static function removeOrder($params)
188
-    {
189
-        $allBodyFields = array('order_ids');
187
+	public static function removeOrder($params)
188
+	{
189
+		$allBodyFields = array('order_ids');
190 190
         
191
-        $response = Route4Me::makeRequst(array(
192
-            'url'    => Endpoint::ORDER_V4,
193
-            'method' => 'DELETE',
194
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
195
-        ));
191
+		$response = Route4Me::makeRequst(array(
192
+			'url'    => Endpoint::ORDER_V4,
193
+			'method' => 'DELETE',
194
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
195
+		));
196 196
 
197
-        return $response;
198
-    }
197
+		return $response;
198
+	}
199 199
     
200
-    public static function updateOrder($params)
201
-    {
202
-        $excludeFields = array('route_id', 'redirect', 'optimization_problem_id', 
203
-        'order_ids', 'fields', 'offset', 'limit', 'query', 'created_timestamp');
200
+	public static function updateOrder($params)
201
+	{
202
+		$excludeFields = array('route_id', 'redirect', 'optimization_problem_id', 
203
+		'order_ids', 'fields', 'offset', 'limit', 'query', 'created_timestamp');
204 204
         
205
-        $allBodyFields = Route4Me::getObjectProperties(new Order(), $excludeFields);
205
+		$allBodyFields = Route4Me::getObjectProperties(new Order(), $excludeFields);
206 206
         
207
-        $response = Route4Me::makeRequst(array(
208
-            'url'    => Endpoint::ORDER_V4,
209
-            'method' => 'PUT',
210
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
211
-        ));
207
+		$response = Route4Me::makeRequst(array(
208
+			'url'    => Endpoint::ORDER_V4,
209
+			'method' => 'PUT',
210
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
211
+		));
212 212
 
213
-        return $response;
214
-    }
213
+		return $response;
214
+	}
215 215
     
216
-    public static function searchOrder($params)
217
-    {
218
-        $allQueryFields = array('fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit' );
216
+	public static function searchOrder($params)
217
+	{
218
+		$allQueryFields = array('fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit' );
219 219
         
220
-        $response = Route4Me::makeRequst(array(
221
-            'url'    => Endpoint::ORDER_V4,
222
-            'method' => 'GET',
223
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
224
-        ));
220
+		$response = Route4Me::makeRequst(array(
221
+			'url'    => Endpoint::ORDER_V4,
222
+			'method' => 'GET',
223
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
224
+		));
225 225
 
226
-        return $response;
227
-    }
226
+		return $response;
227
+	}
228 228
     
229
-    public static function validateCoordinate($coord)
230
-    {
231
-        $key = key($coord);
229
+	public static function validateCoordinate($coord)
230
+	{
231
+		$key = key($coord);
232 232
         
233
-        if (!is_numeric($coord[$key])) {
234
-            return false;
235
-        }
233
+		if (!is_numeric($coord[$key])) {
234
+			return false;
235
+		}
236 236
         
237
-        switch ($key) {
238
-            case 'cached_lat':
239
-            case 'curbside_lat':
240
-                if ($coord[$key]>90 || $coord[$key]<-90) {
241
-                    return false;
242
-                }
243
-                break;
244
-            case 'cached_lng':
245
-            case 'curbside_lng':
246
-                if ($coord[$key]>180 || $coord[$key]<-180) {
247
-                    return false;
248
-                }
249
-                break;
250
-        }
237
+		switch ($key) {
238
+			case 'cached_lat':
239
+			case 'curbside_lat':
240
+				if ($coord[$key]>90 || $coord[$key]<-90) {
241
+					return false;
242
+				}
243
+				break;
244
+			case 'cached_lng':
245
+			case 'curbside_lng':
246
+				if ($coord[$key]>180 || $coord[$key]<-180) {
247
+					return false;
248
+				}
249
+				break;
250
+		}
251 251
         
252
-        return true;
253
-    }
252
+		return true;
253
+	}
254 254
     
255
-    public function addOrdersFromCsvFile($csvFileHandle, $ordersFieldsMapping)
256
-    {
257
-        $max_line_length = 512;
258
-        $delemietr = ',';
255
+	public function addOrdersFromCsvFile($csvFileHandle, $ordersFieldsMapping)
256
+	{
257
+		$max_line_length = 512;
258
+		$delemietr = ',';
259 259
         
260
-        $results = array();
261
-        $results['fail'] = array();
262
-        $results['success'] = array();
260
+		$results = array();
261
+		$results['fail'] = array();
262
+		$results['success'] = array();
263 263
         
264
-        $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
264
+		$columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
265 265
         
266
-        $excludeFields = array('route_id', 'redirect', 'optimization_problem_id', 'order_id', 
267
-        'order_ids', 'fields', 'offset', 'limit', 'query', 'created_timestamp');
266
+		$excludeFields = array('route_id', 'redirect', 'optimization_problem_id', 'order_id', 
267
+		'order_ids', 'fields', 'offset', 'limit', 'query', 'created_timestamp');
268 268
         
269
-        $allOrderFields = Route4Me::getObjectProperties(new Order(), $excludeFields);
269
+		$allOrderFields = Route4Me::getObjectProperties(new Order(), $excludeFields);
270 270
         
271
-        if (!empty($columns)) {
272
-             array_push($results['fail'],'Empty CSV table');
273
-             return ($results);
274
-        }
271
+		if (!empty($columns)) {
272
+			 array_push($results['fail'],'Empty CSV table');
273
+			 return ($results);
274
+		}
275 275
                  
276
-        $iRow=1;
276
+		$iRow=1;
277 277
         
278
-        while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))!==false) {
279
-            if ($rows[$ordersFieldsMapping['cached_lat']] && $rows[$ordersFieldsMapping['cached_lng']] && $rows[$ordersFieldsMapping['address_1']] && array(null)!==$rows) {
278
+		while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))!==false) {
279
+			if ($rows[$ordersFieldsMapping['cached_lat']] && $rows[$ordersFieldsMapping['cached_lng']] && $rows[$ordersFieldsMapping['address_1']] && array(null)!==$rows) {
280 280
                 
281
-                $cached_lat = 0.000;
282
-                $cached_lng = 0.000;
281
+				$cached_lat = 0.000;
282
+				$cached_lng = 0.000;
283 283
                 
284
-                foreach (array('cached_lat', 'cached_lng', 'curbside_lat', 'curbside_lng') as $coord) {
285
-                    if (!$this->validateCoordinate(array($coord => $rows[$ordersFieldsMapping[$coord]]))) {
286
-                        array_push($results['fail'], "$iRow --> Wrong "+$coord); 
287
-                        $iRow++;
288
-                        continue;
289
-                    } else {
290
-                        switch ($coord) {
291
-                            case 'cached_lat':
292
-                                $cached_lat = doubleval($rows[$ordersFieldsMapping[$coord]]);
293
-                                break;
294
-                            case 'cached_lng':
295
-                                $cached_lng = doubleval($rows[$ordersFieldsMapping[$coord]]);
296
-                                break;
297
-                        }
298
-                    }
299
-                }
284
+				foreach (array('cached_lat', 'cached_lng', 'curbside_lat', 'curbside_lng') as $coord) {
285
+					if (!$this->validateCoordinate(array($coord => $rows[$ordersFieldsMapping[$coord]]))) {
286
+						array_push($results['fail'], "$iRow --> Wrong "+$coord); 
287
+						$iRow++;
288
+						continue;
289
+					} else {
290
+						switch ($coord) {
291
+							case 'cached_lat':
292
+								$cached_lat = doubleval($rows[$ordersFieldsMapping[$coord]]);
293
+								break;
294
+							case 'cached_lng':
295
+								$cached_lng = doubleval($rows[$ordersFieldsMapping[$coord]]);
296
+								break;
297
+						}
298
+					}
299
+				}
300 300
                 
301
-                $address = $rows[$ordersFieldsMapping['address_1']];
301
+				$address = $rows[$ordersFieldsMapping['address_1']];
302 302
                 
303
-                foreach (array('order_city', 'order_state_id', 'order_zip_code', 'order_country_id') as $addressPart) {
304
-                    if (isset($ordersFieldsMapping[$addressPart])) {
305
-                        $address .= ', '.$rows[$ordersFieldsMapping[$addressPart]];
306
-                    }
307
-                }
303
+				foreach (array('order_city', 'order_state_id', 'order_zip_code', 'order_country_id') as $addressPart) {
304
+					if (isset($ordersFieldsMapping[$addressPart])) {
305
+						$address .= ', '.$rows[$ordersFieldsMapping[$addressPart]];
306
+					}
307
+				}
308 308
 
309
-                echo "$iRow --> ".$ordersFieldsMapping['day_scheduled_for_YYMMDD'].", ".$rows[$ordersFieldsMapping['day_scheduled_for_YYMMDD']]."<br>";
309
+				echo "$iRow --> ".$ordersFieldsMapping['day_scheduled_for_YYMMDD'].", ".$rows[$ordersFieldsMapping['day_scheduled_for_YYMMDD']]."<br>";
310 310
                 
311
-                $parametersArray = array();
311
+				$parametersArray = array();
312 312
                 
313
-                $parametersArray["cached_lat"] = $cached_lat;
314
-                $parametersArray["cached_lng"] = $cached_lng;
313
+				$parametersArray["cached_lat"] = $cached_lat;
314
+				$parametersArray["cached_lng"] = $cached_lng;
315 315
                 
316 316
                 
317
-                foreach ($allOrderFields as $orderField) {
318
-                    if (isset($ordersFieldsMapping[$orderField])) {
319
-                        $parametersArray[$orderField] = $rows[$ordersFieldsMapping[$orderField]];
320
-                    }
321
-                }
317
+				foreach ($allOrderFields as $orderField) {
318
+					if (isset($ordersFieldsMapping[$orderField])) {
319
+						$parametersArray[$orderField] = $rows[$ordersFieldsMapping[$orderField]];
320
+					}
321
+				}
322 322
                 
323
-                $orderParameters = Order::fromArray($parametersArray);
323
+				$orderParameters = Order::fromArray($parametersArray);
324 324
 
325
-                $order = new Order();
325
+				$order = new Order();
326 326
                 
327
-                $orderResults = $order->addOrder($orderParameters);
327
+				$orderResults = $order->addOrder($orderParameters);
328 328
                 
329
-                array_push($results['success'], "The order with order_id = ".strval($orderResults["order_id"])." added successfuly.");
330
-            }
331
-            else {
332
-                array_push($results['fail'], "$iRow --> one of the parameters cached_lat, cached_lng, address_1 is not set"); 
333
-            }
329
+				array_push($results['success'], "The order with order_id = ".strval($orderResults["order_id"])." added successfuly.");
330
+			}
331
+			else {
332
+				array_push($results['fail'], "$iRow --> one of the parameters cached_lat, cached_lng, address_1 is not set"); 
333
+			}
334 334
             
335
-            $iRow++;
336
-        }
337
-    }
335
+			$iRow++;
336
+		}
337
+	}
338 338
 }
Please login to merge, or discard this patch.
Switch Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -235,18 +235,18 @@  discard block
 block discarded – undo
235 235
         }
236 236
         
237 237
         switch ($key) {
238
-            case 'cached_lat':
239
-            case 'curbside_lat':
240
-                if ($coord[$key]>90 || $coord[$key]<-90) {
241
-                    return false;
242
-                }
243
-                break;
244
-            case 'cached_lng':
245
-            case 'curbside_lng':
246
-                if ($coord[$key]>180 || $coord[$key]<-180) {
247
-                    return false;
248
-                }
249
-                break;
238
+        case 'cached_lat':
239
+        case 'curbside_lat':
240
+            if ($coord[$key]>90 || $coord[$key]<-90) {
241
+                return false;
242
+            }
243
+            break;
244
+        case 'cached_lng':
245
+        case 'curbside_lng':
246
+            if ($coord[$key]>180 || $coord[$key]<-180) {
247
+                return false;
248
+            }
249
+            break;
250 250
         }
251 251
         
252 252
         return true;
@@ -288,12 +288,12 @@  discard block
 block discarded – undo
288 288
                         continue;
289 289
                     } else {
290 290
                         switch ($coord) {
291
-                            case 'cached_lat':
292
-                                $cached_lat = doubleval($rows[$ordersFieldsMapping[$coord]]);
293
-                                break;
294
-                            case 'cached_lng':
295
-                                $cached_lng = doubleval($rows[$ordersFieldsMapping[$coord]]);
296
-                                break;
291
+                        case 'cached_lat':
292
+                            $cached_lat = doubleval($rows[$ordersFieldsMapping[$coord]]);
293
+                            break;
294
+                        case 'cached_lng':
295
+                            $cached_lng = doubleval($rows[$ordersFieldsMapping[$coord]]);
296
+                            break;
297 297
                         }
298 298
                     }
299 299
                 }
Please login to merge, or discard this patch.
src/Route4Me/ActivityParameters.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -6,79 +6,79 @@
 block discarded – undo
6 6
 
7 7
 class ActivityParameters extends Common
8 8
 {
9
-    public $route_id;
10
-    public $device_id;
11
-    public $member_id;
12
-    public $team;
13
-    public $limit;
14
-    public $offset;
15
-    public $start;
16
-    public $end;
17
-    public $activity_type;
18
-    public $activity_message;
9
+	public $route_id;
10
+	public $device_id;
11
+	public $member_id;
12
+	public $team;
13
+	public $limit;
14
+	public $offset;
15
+	public $start;
16
+	public $end;
17
+	public $activity_type;
18
+	public $activity_message;
19 19
     
20
-    public $activity_id;
21
-    public $activity_timestamp;
22
-    public $route_destination_id;
23
-    public $note_id;
24
-    public $member;
25
-    public $note_type;
26
-    public $note_contents;
27
-    public $route_name;
28
-    public $note_file;
29
-    public $destination_name;
30
-    public $destination_alias;
20
+	public $activity_id;
21
+	public $activity_timestamp;
22
+	public $route_destination_id;
23
+	public $note_id;
24
+	public $member;
25
+	public $note_type;
26
+	public $note_contents;
27
+	public $route_name;
28
+	public $note_file;
29
+	public $destination_name;
30
+	public $destination_alias;
31 31
     
32
-    public static function fromArray(array $params) 
33
-    {
34
-        $activityparameters = new ActivityParameters();
32
+	public static function fromArray(array $params) 
33
+	{
34
+		$activityparameters = new ActivityParameters();
35 35
         
36
-        foreach($params as $key => $value) {
37
-            if (property_exists($activityparameters, $key)) {
38
-                $activityparameters->{$key} = $value;
39
-            }
40
-        }
36
+		foreach($params as $key => $value) {
37
+			if (property_exists($activityparameters, $key)) {
38
+				$activityparameters->{$key} = $value;
39
+			}
40
+		}
41 41
         
42
-        return $activityparameters;
43
-    }
42
+		return $activityparameters;
43
+	}
44 44
     
45
-    public static function getActivities($params)
46
-    {
47
-        $allQueryFields = array('route_id', 'team', 'limit', 'offset', 'start');
45
+	public static function getActivities($params)
46
+	{
47
+		$allQueryFields = array('route_id', 'team', 'limit', 'offset', 'start');
48 48
         
49
-        $activity = Route4Me::makeRequst(array(
50
-            'url'    => Endpoint::GET_ACTIVITIES,
51
-            'method' => 'GET',
52
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
53
-        ));
49
+		$activity = Route4Me::makeRequst(array(
50
+			'url'    => Endpoint::GET_ACTIVITIES,
51
+			'method' => 'GET',
52
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
53
+		));
54 54
 
55
-        return $activity;
56
-    }
55
+		return $activity;
56
+	}
57 57
 
58
-    public static function searcActivities($params)
59
-    {
60
-        $allQueryFields = array('route_id', 'limit', 'offset', 'activity_type');
58
+	public static function searcActivities($params)
59
+	{
60
+		$allQueryFields = array('route_id', 'limit', 'offset', 'activity_type');
61 61
         
62
-        $activity = Route4Me::makeRequst(array(
63
-            'url'    => Endpoint::GET_ACTIVITIES,
64
-            'method' => 'GET',
65
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
66
-        ));
62
+		$activity = Route4Me::makeRequst(array(
63
+			'url'    => Endpoint::GET_ACTIVITIES,
64
+			'method' => 'GET',
65
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
66
+		));
67 67
 
68
-        return $activity;
69
-    }
68
+		return $activity;
69
+	}
70 70
     
71
-    public static function sendUserMessage($params)
72
-    {
73
-        $allBodyFields = array('activity_type', 'activity_message', 'route_id');
71
+	public static function sendUserMessage($params)
72
+	{
73
+		$allBodyFields = array('activity_type', 'activity_message', 'route_id');
74 74
         
75
-        $result = Route4Me::makeRequst(array(
76
-            'url'    => Endpoint::ACTIVITY_FEED,
77
-            'method' => 'POST',
78
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
79
-        ));
75
+		$result = Route4Me::makeRequst(array(
76
+			'url'    => Endpoint::ACTIVITY_FEED,
77
+			'method' => 'POST',
78
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
79
+		));
80 80
         
81
-        return $result;
82
-    }
81
+		return $result;
82
+	}
83 83
     
84 84
 }
Please login to merge, or discard this patch.
src/Route4Me/AddressBookLocation.php 1 patch
Indentation   +357 added lines, -357 removed lines patch added patch discarded remove patch
@@ -6,439 +6,439 @@
 block discarded – undo
6 6
 
7 7
 class AddressBookLocation extends Common
8 8
 {
9
-    public $address_id;
10
-    public $address_group;
11
-    public $address_alias;
12
-    public $address_1;
13
-    public $address_2;
14
-    public $first_name;
15
-    public $last_name;
16
-    public $address_email;
17
-    public $address_phone_number;
18
-    public $address_city;
19
-    public $address_state_id;
20
-    public $address_country_id;
21
-    public $address_zip;
22
-    public $cached_lat;
23
-    public $cached_lng;
24
-    public $curbside_lat;
25
-    public $curbside_lng;
26
-    public $color;
27
-    public $address_custom_data;
28
-    public $schedule;
9
+	public $address_id;
10
+	public $address_group;
11
+	public $address_alias;
12
+	public $address_1;
13
+	public $address_2;
14
+	public $first_name;
15
+	public $last_name;
16
+	public $address_email;
17
+	public $address_phone_number;
18
+	public $address_city;
19
+	public $address_state_id;
20
+	public $address_country_id;
21
+	public $address_zip;
22
+	public $cached_lat;
23
+	public $cached_lng;
24
+	public $curbside_lat;
25
+	public $curbside_lng;
26
+	public $color;
27
+	public $address_custom_data;
28
+	public $schedule;
29 29
     
30
-    public $created_timestamp;
31
-    public $member_id;
32
-    public $schedule_blacklist;
33
-    public $in_route_count;
34
-    public $last_visited_timestamp;
35
-    public $last_routed_timestamp;
36
-    public $local_time_window_start;
37
-    public $local_time_window_end;
38
-    public $local_time_window_start_2;
39
-    public $local_time_window_end_2;
40
-    public $service_time;
41
-    public $local_timezone_string;
42
-    public $address_icon;
43
-    public $address_stop_type;
44
-    public $address_cube;
45
-    public $address_pieces;
46
-    public $address_reference_no;
47
-    public $address_revenue;
48
-    public $address_weight;
49
-    public $address_priority;
50
-    public $address_customer_po;
30
+	public $created_timestamp;
31
+	public $member_id;
32
+	public $schedule_blacklist;
33
+	public $in_route_count;
34
+	public $last_visited_timestamp;
35
+	public $last_routed_timestamp;
36
+	public $local_time_window_start;
37
+	public $local_time_window_end;
38
+	public $local_time_window_start_2;
39
+	public $local_time_window_end_2;
40
+	public $service_time;
41
+	public $local_timezone_string;
42
+	public $address_icon;
43
+	public $address_stop_type;
44
+	public $address_cube;
45
+	public $address_pieces;
46
+	public $address_reference_no;
47
+	public $address_revenue;
48
+	public $address_weight;
49
+	public $address_priority;
50
+	public $address_customer_po;
51 51
     
52
-    public static function fromArray(array $params)
53
-    {
54
-        $addressbooklocation = new AddressBookLocation();
52
+	public static function fromArray(array $params)
53
+	{
54
+		$addressbooklocation = new AddressBookLocation();
55 55
         
56
-        foreach ($params as $key => $value) {
57
-            if (property_exists($addressbooklocation, $key)) {
58
-                $addressbooklocation->{$key} = $value;
59
-            }
60
-        }
56
+		foreach ($params as $key => $value) {
57
+			if (property_exists($addressbooklocation, $key)) {
58
+				$addressbooklocation->{$key} = $value;
59
+			}
60
+		}
61 61
         
62
-        return $addressbooklocation;
63
-    }
62
+		return $addressbooklocation;
63
+	}
64 64
     
65 65
     
66 66
     
67
-    public static function getAddressBookLocation($addressId)
68
-    {
69
-        $ablocations = Route4Me::makeRequst(array(
70
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
71
-            'method' => 'GET',
72
-            'query'  => array(
73
-                'query' => $addressId,
74
-                'limit' => 30
75
-            )
76
-        ));
67
+	public static function getAddressBookLocation($addressId)
68
+	{
69
+		$ablocations = Route4Me::makeRequst(array(
70
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
71
+			'method' => 'GET',
72
+			'query'  => array(
73
+				'query' => $addressId,
74
+				'limit' => 30
75
+			)
76
+		));
77 77
 
78
-        return $ablocations;
79
-    }
78
+		return $ablocations;
79
+	}
80 80
     
81
-    public static function searchAddressBookLocations($params)
82
-    {
83
-        $allQueryFields = array('display', 'query', 'fields', 'limit', 'offset');
81
+	public static function searchAddressBookLocations($params)
82
+	{
83
+		$allQueryFields = array('display', 'query', 'fields', 'limit', 'offset');
84 84
         
85
-        $result = Route4Me::makeRequst(array(
86
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
87
-            'method' => 'GET',
88
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
89
-        ));
85
+		$result = Route4Me::makeRequst(array(
86
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
87
+			'method' => 'GET',
88
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
89
+		));
90 90
 
91
-        return $result;
92
-    }
91
+		return $result;
92
+	}
93 93
     
94
-    public static function getAddressBookLocations($params)
95
-    {
96
-        $allQueryFields = array('limit', 'offset', 'address_id');
94
+	public static function getAddressBookLocations($params)
95
+	{
96
+		$allQueryFields = array('limit', 'offset', 'address_id');
97 97
         
98
-        $ablocations = Route4Me::makeRequst(array(
99
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
100
-            'method' => 'GET',
101
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
102
-        ));
98
+		$ablocations = Route4Me::makeRequst(array(
99
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
100
+			'method' => 'GET',
101
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
102
+		));
103 103
 
104
-        return $ablocations;
105
-    }
104
+		return $ablocations;
105
+	}
106 106
     
107
-    public static function getRandomAddressBookLocation($params)
108
-    {
109
-        $ablocations = self::getAddressBookLocations($params);
107
+	public static function getRandomAddressBookLocation($params)
108
+	{
109
+		$ablocations = self::getAddressBookLocations($params);
110 110
         
111
-        if (isset($ablocations["results"])) {
112
-            $locationsSize = sizeof($ablocations["results"]);
111
+		if (isset($ablocations["results"])) {
112
+			$locationsSize = sizeof($ablocations["results"]);
113 113
             
114
-            if ($locationsSize>0) {
115
-                $randomLocationIndex = rand(0, $locationsSize - 1);
116
-                return $ablocations["results"][$randomLocationIndex];
117
-            } 
118
-        } 
114
+			if ($locationsSize>0) {
115
+				$randomLocationIndex = rand(0, $locationsSize - 1);
116
+				return $ablocations["results"][$randomLocationIndex];
117
+			} 
118
+		} 
119 119
 
120
-        return null;
121
-    }
120
+		return null;
121
+	}
122 122
     
123
-    /**
124
-     * @param AddressBookLocation $params
125
-    */
126
-    public static function addAdressBookLocation($params)
127
-    {
128
-        $allBodyFields = Route4Me::getObjectProperties(new AddressBookLocation(), array('address_id', 'in_route_count'));
123
+	/**
124
+	 * @param AddressBookLocation $params
125
+	 */
126
+	public static function addAdressBookLocation($params)
127
+	{
128
+		$allBodyFields = Route4Me::getObjectProperties(new AddressBookLocation(), array('address_id', 'in_route_count'));
129 129
         
130
-        $response = Route4Me::makeRequst(array(
131
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
132
-            'method' => 'POST',
133
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
134
-        ));
130
+		$response = Route4Me::makeRequst(array(
131
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
132
+			'method' => 'POST',
133
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
134
+		));
135 135
 
136
-        return $response;
137
-    }
136
+		return $response;
137
+	}
138 138
     
139
-    public function deleteAdressBookLocation($address_ids)
140
-    {
141
-        $result = Route4Me::makeRequst(array(
142
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
143
-            'method' => 'DELETEARRAY',
144
-            'query'  => array(
145
-                'address_ids' => $address_ids
146
-            )
147
-        ));
139
+	public function deleteAdressBookLocation($address_ids)
140
+	{
141
+		$result = Route4Me::makeRequst(array(
142
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
143
+			'method' => 'DELETEARRAY',
144
+			'query'  => array(
145
+				'address_ids' => $address_ids
146
+			)
147
+		));
148 148
 
149
-        return $result;
150
-    }
149
+		return $result;
150
+	}
151 151
     
152
-    public function updateAdressBookLocation($params)
153
-    {
154
-        $allBodyFields = Route4Me::getObjectProperties(new AddressBookLocation(), array('in_route_count'));
152
+	public function updateAdressBookLocation($params)
153
+	{
154
+		$allBodyFields = Route4Me::getObjectProperties(new AddressBookLocation(), array('in_route_count'));
155 155
 
156
-        $response = Route4Me::makeRequst(array(
157
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
158
-            'method' => 'PUT',
159
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
160
-        ));
156
+		$response = Route4Me::makeRequst(array(
157
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
158
+			'method' => 'PUT',
159
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
160
+		));
161 161
 
162
-        return $response;
163
-    }
162
+		return $response;
163
+	}
164 164
         
165
-    public static function validateScheduleMode($scheduleMode)
166
-    {
167
-        $schedMmodes = array("daily", "weekly", "monthly", "annually");
165
+	public static function validateScheduleMode($scheduleMode)
166
+	{
167
+		$schedMmodes = array("daily", "weekly", "monthly", "annually");
168 168
         
169
-        if (in_array($scheduleMode, $schedMmodes)) {
170
-            return TRUE; 
171
-        } else {
172
-            return FALSE;
173
-        }
174
-    }
169
+		if (in_array($scheduleMode, $schedMmodes)) {
170
+			return TRUE; 
171
+		} else {
172
+			return FALSE;
173
+		}
174
+	}
175 175
     
176
-    public static function validateScheduleEnable($scheduleEnabled)
177
-    {
178
-        $schedEnables = array(TRUE, FALSE);
176
+	public static function validateScheduleEnable($scheduleEnabled)
177
+	{
178
+		$schedEnables = array(TRUE, FALSE);
179 179
         
180
-        if (in_array($scheduleEnabled, $schedEnables)) {
181
-            return TRUE;
182
-        } else {
183
-            return FALSE;
184
-        }
185
-    }
180
+		if (in_array($scheduleEnabled, $schedEnables)) {
181
+			return TRUE;
182
+		} else {
183
+			return FALSE;
184
+		}
185
+	}
186 186
     
187
-    public static function validateScheduleEvery($scheduleEvery)
188
-    {
189
-        if (is_numeric($scheduleEvery)) {
190
-            return TRUE;
191
-        } else {
192
-            return FALSE;
193
-        }
194
-    }
187
+	public static function validateScheduleEvery($scheduleEvery)
188
+	{
189
+		if (is_numeric($scheduleEvery)) {
190
+			return TRUE;
191
+		} else {
192
+			return FALSE;
193
+		}
194
+	}
195 195
     
196
-    public static function validateScheduleWeekDays($scheduleWeekDays)
197
-    {
198
-        $weekdays = explode(',', $scheduleWeekDays);
196
+	public static function validateScheduleWeekDays($scheduleWeekDays)
197
+	{
198
+		$weekdays = explode(',', $scheduleWeekDays);
199 199
         
200
-        if (sizeof($weekdays)<1) return FALSE;
200
+		if (sizeof($weekdays)<1) return FALSE;
201 201
         
202
-        $isValid = TRUE;
202
+		$isValid = TRUE;
203 203
         
204
-        for ($i=0; $i<sizeof($weekdays); $i++) { 
205
-            if (is_numeric($weekdays[$i])) {
206
-                $wday = intval($weekdays[$i]);
207
-                if ($wday<1 || $wday>7) $isValid = FALSE;
208
-            } else {
209
-                $isValid = FALSE;
210
-            }
211
-        }
204
+		for ($i=0; $i<sizeof($weekdays); $i++) { 
205
+			if (is_numeric($weekdays[$i])) {
206
+				$wday = intval($weekdays[$i]);
207
+				if ($wday<1 || $wday>7) $isValid = FALSE;
208
+			} else {
209
+				$isValid = FALSE;
210
+			}
211
+		}
212 212
         
213
-        return $isValid;
214
-    }
213
+		return $isValid;
214
+	}
215 215
     
216
-    public static function validateScheduleMonthlyMode($scheduleMonthlyMode)
217
-    {
218
-        $schedMonthlyMmodes = array("dates", "nth");
216
+	public static function validateScheduleMonthlyMode($scheduleMonthlyMode)
217
+	{
218
+		$schedMonthlyMmodes = array("dates", "nth");
219 219
         
220
-        if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes)) {
221
-            return TRUE;
222
-        } else {
223
-            return FALSE;
224
-        }
225
-    }
220
+		if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes)) {
221
+			return TRUE;
222
+		} else {
223
+			return FALSE;
224
+		}
225
+	}
226 226
     
227
-    public static function validateScheduleMonthlyDates($scheduleMonthlyDates)
228
-    {
229
-        $monthlyDates = explode(',', $scheduleMonthlyDates);
227
+	public static function validateScheduleMonthlyDates($scheduleMonthlyDates)
228
+	{
229
+		$monthlyDates = explode(',', $scheduleMonthlyDates);
230 230
         
231
-        if (sizeof($monthlyDates) <1) return FALSE;
231
+		if (sizeof($monthlyDates) <1) return FALSE;
232 232
         
233
-        $isValid = TRUE;
233
+		$isValid = TRUE;
234 234
         
235
-        for ($i=0; $i < sizeof($monthlyDates); $i++) { 
236
-            if (is_numeric($monthlyDates[$i])) {
237
-                $mday = intval($monthlyDates[$i]);
238
-                if ($mday <1 || $mday > 31) $isValid = FALSE;
239
-            } else {
240
-                $isValid = FALSE;
241
-            }
242
-        }
235
+		for ($i=0; $i < sizeof($monthlyDates); $i++) { 
236
+			if (is_numeric($monthlyDates[$i])) {
237
+				$mday = intval($monthlyDates[$i]);
238
+				if ($mday <1 || $mday > 31) $isValid = FALSE;
239
+			} else {
240
+				$isValid = FALSE;
241
+			}
242
+		}
243 243
 
244
-        return $isValid;
245
-    }
244
+		return $isValid;
245
+	}
246 246
     
247
-    public static function validateScheduleNthN($scheduleNthN)
248
-    {
249
-        if (!is_numeric($scheduleNthN)) return FALSE;
247
+	public static function validateScheduleNthN($scheduleNthN)
248
+	{
249
+		if (!is_numeric($scheduleNthN)) return FALSE;
250 250
         
251
-        $schedNthNs = array(1, 2, 3, 4, 5, -1);
251
+		$schedNthNs = array(1, 2, 3, 4, 5, -1);
252 252
         
253
-        if (in_array($scheduleNthN, $schedNthNs)) {
254
-            return TRUE;
255
-        } else {
256
-            return FALSE;
257
-        }
258
-    }
253
+		if (in_array($scheduleNthN, $schedNthNs)) {
254
+			return TRUE;
255
+		} else {
256
+			return FALSE;
257
+		}
258
+	}
259 259
     
260
-    public static function validateScheduleNthWhat($scheduleNthWhat)
261
-    {
262
-        if (!is_numeric($scheduleNthWhat)) return FALSE;
260
+	public static function validateScheduleNthWhat($scheduleNthWhat)
261
+	{
262
+		if (!is_numeric($scheduleNthWhat)) return FALSE;
263 263
         
264
-        $schedNthWhats = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
264
+		$schedNthWhats = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
265 265
         
266
-        if (in_array($scheduleNthWhat, $schedNthWhats)) {
267
-            return TRUE;
268
-        } else {
269
-            return FALSE;
270
-        }
271
-    }
266
+		if (in_array($scheduleNthWhat, $schedNthWhats)) {
267
+			return TRUE;
268
+		} else {
269
+			return FALSE;
270
+		}
271
+	}
272 272
     
273
-    /** Function adds the locations (with/without schedule) from the CSV file. 
274
-     * $csvFileHandle - a file handler.
275
-     * Returns array $results which contains two arrays: fail and succes.
276
-     */
277
-    public function addLocationsFromCsvFile($csvFileHandle, $locationsFieldsMapping)
278
-    {
279
-        $max_line_length = 512;
280
-        $delemietr = ',';
273
+	/** Function adds the locations (with/without schedule) from the CSV file. 
274
+	 * $csvFileHandle - a file handler.
275
+	 * Returns array $results which contains two arrays: fail and succes.
276
+	 */
277
+	public function addLocationsFromCsvFile($csvFileHandle, $locationsFieldsMapping)
278
+	{
279
+		$max_line_length = 512;
280
+		$delemietr = ',';
281 281
         
282
-        $results = array();
283
-        $results['fail'] = array();
284
-        $results['success'] = array();
282
+		$results = array();
283
+		$results['fail'] = array();
284
+		$results['success'] = array();
285 285
         
286
-        $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
286
+		$columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
287 287
         
288
-        $addressBookFields = Route4Me::getObjectProperties(new AddressBookLocation(), array('address_id', 'in_route_count'));
288
+		$addressBookFields = Route4Me::getObjectProperties(new AddressBookLocation(), array('address_id', 'in_route_count'));
289 289
 
290
-        if (empty($columns)) {
291
-            array_push($results['fail'], 'Empty CSV table');
292
-            return ($results);
293
-        }
290
+		if (empty($columns)) {
291
+			array_push($results['fail'], 'Empty CSV table');
292
+			return ($results);
293
+		}
294 294
 
295
-        $iRow = 1;
295
+		$iRow = 1;
296 296
         
297
-        while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))!==false) {
298
-            if (!isset($rows[$locationsFieldsMapping['cached_lat']]) || !isset($rows[$locationsFieldsMapping['cached_lng']]) 
299
-                  || !isset($rows[$locationsFieldsMapping['address_1']]) || array(null)==$rows) {
300
-                continue;
301
-            }
297
+		while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))!==false) {
298
+			if (!isset($rows[$locationsFieldsMapping['cached_lat']]) || !isset($rows[$locationsFieldsMapping['cached_lng']]) 
299
+				  || !isset($rows[$locationsFieldsMapping['address_1']]) || array(null)==$rows) {
300
+				continue;
301
+			}
302 302
                       
303
-            $curSchedule = "";
304
-            $mode = "";
303
+			$curSchedule = "";
304
+			$mode = "";
305 305
             
306
-            $failCount = sizeof($results['fail']); 
306
+			$failCount = sizeof($results['fail']); 
307 307
             
308
-            if (isset($rows[$locationsFieldsMapping['schedule_mode']])) {
309
-                if ($this->validateScheduleMode($rows[$locationsFieldsMapping['schedule_mode']])) {
310
-                    $curSchedule = '"mode":"'.$rows[$locationsFieldsMapping['schedule_mode']].'",'; 
311
-                    $mode = $rows[$locationsFieldsMapping['schedule_mode']];
312
-                } else {
313
-                    array_push($results['fail'], "$iRow --> Wrong schedule mode parameter"); 
314
-                }
315
-            } else {
316
-                array_push($results['fail'], "$iRow --> The schedule mode parameter is not set"); 
317
-            }
308
+			if (isset($rows[$locationsFieldsMapping['schedule_mode']])) {
309
+				if ($this->validateScheduleMode($rows[$locationsFieldsMapping['schedule_mode']])) {
310
+					$curSchedule = '"mode":"'.$rows[$locationsFieldsMapping['schedule_mode']].'",'; 
311
+					$mode = $rows[$locationsFieldsMapping['schedule_mode']];
312
+				} else {
313
+					array_push($results['fail'], "$iRow --> Wrong schedule mode parameter"); 
314
+				}
315
+			} else {
316
+				array_push($results['fail'], "$iRow --> The schedule mode parameter is not set"); 
317
+			}
318 318
             
319
-            if (isset($rows[$locationsFieldsMapping['schedule_enabled']])) {
320
-                if ($this->validateScheduleEnable($rows[$locationsFieldsMapping['schedule_enabled']])) { 
321
-                    $curSchedule .= '"enabled":'.$rows[$locationsFieldsMapping['schedule_enabled']].',';
322
-                } else {
323
-                    array_push($results['fail'], "$iRow --> The schedule enabled parameter is not set ");  
324
-                }
325
-            }
319
+			if (isset($rows[$locationsFieldsMapping['schedule_enabled']])) {
320
+				if ($this->validateScheduleEnable($rows[$locationsFieldsMapping['schedule_enabled']])) { 
321
+					$curSchedule .= '"enabled":'.$rows[$locationsFieldsMapping['schedule_enabled']].',';
322
+				} else {
323
+					array_push($results['fail'], "$iRow --> The schedule enabled parameter is not set ");  
324
+				}
325
+			}
326 326
             
327
-            if (isset($rows[$locationsFieldsMapping['schedule_every']])) {
328
-                if ($this->validateScheduleEvery($rows[$locationsFieldsMapping['schedule_every']])) {
329
-                    $curSchedule.='"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; 
330
-                    if ($mode=='daily') {
331
-                        $curSchedule = trim($curSchedule,',');
332
-                        $curSchedule.='}';
333
-                    }
334
-                } else {
335
-                    array_push($results['fail'], "$iRow --> The parameter sched_every is not set"); 
336
-                }
337
-            }
327
+			if (isset($rows[$locationsFieldsMapping['schedule_every']])) {
328
+				if ($this->validateScheduleEvery($rows[$locationsFieldsMapping['schedule_every']])) {
329
+					$curSchedule.='"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; 
330
+					if ($mode=='daily') {
331
+						$curSchedule = trim($curSchedule,',');
332
+						$curSchedule.='}';
333
+					}
334
+				} else {
335
+					array_push($results['fail'], "$iRow --> The parameter sched_every is not set"); 
336
+				}
337
+			}
338 338
             
339
-            if ($mode!='daily') {
340
-                switch ($mode) {
341
-                    case 'weekly':
342
-                        if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) {
343
-                            if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) {
344
-                                 $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}';
345
-                            } else {
346
-                                array_push($results['fail'], "$iRow --> Wrong weekdays"); 
347
-                            }
348
-                        } else {
349
-                            array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); 
350
-                        }
351
-                        break;
352
-                    case 'monthly':
353
-                        $monthlyMode = "";
354
-                        if (isset($rows[$locationsFieldsMapping['monthly_mode']])) {
355
-                            if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) {
356
-                                 $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']];
357
-                                 $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",';
358
-                            } else {
359
-                                array_push($results['fail'], "$iRow --> Wrong monthly mode"); 
360
-                            }
361
-                        } else {
362
-                            array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); 
363
-                        }
339
+			if ($mode!='daily') {
340
+				switch ($mode) {
341
+					case 'weekly':
342
+						if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) {
343
+							if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) {
344
+								 $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}';
345
+							} else {
346
+								array_push($results['fail'], "$iRow --> Wrong weekdays"); 
347
+							}
348
+						} else {
349
+							array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); 
350
+						}
351
+						break;
352
+					case 'monthly':
353
+						$monthlyMode = "";
354
+						if (isset($rows[$locationsFieldsMapping['monthly_mode']])) {
355
+							if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) {
356
+								 $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']];
357
+								 $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",';
358
+							} else {
359
+								array_push($results['fail'], "$iRow --> Wrong monthly mode"); 
360
+							}
361
+						} else {
362
+							array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); 
363
+						}
364 364
                         
365
-                        if ($monthlyMode!="") {
366
-                            switch ($monthlyMode) {
367
-                                case 'dates':
368
-                                    if (isset($rows[$locationsFieldsMapping['monthly_dates']])) {
369
-                                        if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) {
370
-                                             $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}';
371
-                                        } else {
372
-                                            array_push($results['fail'], "$iRow --> Wrong monthly dates"); 
373
-                                        }
374
-                                    }
375
-                                    break;
376
-                                case 'nth':
377
-                                    if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) {
378
-                                        if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) {
379
-                                             $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].',';
380
-                                        } else {
381
-                                            array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); 
382
-                                        }
383
-                                    } else {
384
-                                        array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); 
385
-                                    }
365
+						if ($monthlyMode!="") {
366
+							switch ($monthlyMode) {
367
+								case 'dates':
368
+									if (isset($rows[$locationsFieldsMapping['monthly_dates']])) {
369
+										if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) {
370
+											 $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}';
371
+										} else {
372
+											array_push($results['fail'], "$iRow --> Wrong monthly dates"); 
373
+										}
374
+									}
375
+									break;
376
+								case 'nth':
377
+									if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) {
378
+										if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) {
379
+											 $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].',';
380
+										} else {
381
+											array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); 
382
+										}
383
+									} else {
384
+										array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); 
385
+									}
386 386
                                     
387
-                                    if ($curSchedule!="") {
388
-                                        if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
389
-                                            if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
390
-                                                 $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}';
391
-                                            } else {
392
-                                                array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); 
393
-                                            }
394
-                                        } else {
395
-                                            array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); 
396
-                                        }
397
-                                    }
398
-                                    break;
399
-                            }
400
-                        }
401
-                        break;
402
-                    default:
403
-                        $curSchedule = "";
404
-                        break;
405
-                }
406
-            }
387
+									if ($curSchedule!="") {
388
+										if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
389
+											if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
390
+												 $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}';
391
+											} else {
392
+												array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); 
393
+											}
394
+										} else {
395
+											array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); 
396
+										}
397
+									}
398
+									break;
399
+							}
400
+						}
401
+						break;
402
+					default:
403
+						$curSchedule = "";
404
+						break;
405
+				}
406
+			}
407 407
 
408
-            if (sizeof($results['fail'])>$failCount) {
409
-                $curSchedule = "";
410
-            }
408
+			if (sizeof($results['fail'])>$failCount) {
409
+				$curSchedule = "";
410
+			}
411 411
 
412
-            if (($mode=='daily' || $mode=='weekly' || $mode=='monthy') && $curSchedule=="") {
413
-                $iRow++; 
414
-                continue;
415
-            }
412
+			if (($mode=='daily' || $mode=='weekly' || $mode=='monthy') && $curSchedule=="") {
413
+				$iRow++; 
414
+				continue;
415
+			}
416 416
             
417
-            $curSchedule = strtolower($curSchedule);
417
+			$curSchedule = strtolower($curSchedule);
418 418
             
419
-            $curSchedule = '[{'.$curSchedule.'}]';
419
+			$curSchedule = '[{'.$curSchedule.'}]';
420 420
 
421
-            $oSchedule = json_decode($curSchedule,TRUE);
421
+			$oSchedule = json_decode($curSchedule,TRUE);
422 422
             
423
-            $parametersArray = array();
423
+			$parametersArray = array();
424 424
             
425
-            foreach ($addressBookFields as $addressBookField) {
426
-                if (isset($locationsFieldsMapping[$addressBookField])) {
427
-                    $parametersArray[$addressBookField] = $rows[$locationsFieldsMapping[$addressBookField]];
428
-                }
429
-            }
425
+			foreach ($addressBookFields as $addressBookField) {
426
+				if (isset($locationsFieldsMapping[$addressBookField])) {
427
+					$parametersArray[$addressBookField] = $rows[$locationsFieldsMapping[$addressBookField]];
428
+				}
429
+			}
430 430
             
431
-            $AdressBookLocationParameters = AddressBookLocation::fromArray($parametersArray);
431
+			$AdressBookLocationParameters = AddressBookLocation::fromArray($parametersArray);
432 432
             
433
-            $abContacts = new AddressBookLocation();
433
+			$abContacts = new AddressBookLocation();
434 434
 
435
-            $abcResults = $abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry
435
+			$abcResults = $abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry
436 436
             
437
-            array_push($results['success'], "The schedule location with address_id = ".strval($abcResults["address_id"])." added successfuly.");
438
-        }
437
+			array_push($results['success'], "The schedule location with address_id = ".strval($abcResults["address_id"])." added successfuly.");
438
+		}
439 439
 
440
-        return $results;
441
-    }
440
+		return $results;
441
+	}
442 442
 
443 443
  }
444 444
  
445 445
\ No newline at end of file
Please login to merge, or discard this patch.
src/Route4Me/Member.php 1 patch
Indentation   +274 added lines, -274 removed lines patch added patch discarded remove patch
@@ -6,320 +6,320 @@
 block discarded – undo
6 6
 
7 7
 class Member extends Common
8 8
 {
9
-    public $device_id;
10
-    public $device_type;
11
-    public $format;
9
+	public $device_id;
10
+	public $device_type;
11
+	public $format;
12 12
     
13
-    public $strEmail;
14
-    public $strPassword;
15
-    public $strPassword_1;
16
-    public $strPassword_2;
17
-    public $strFirstName;
18
-    public $strLastName;
19
-    public $strIndustry;
20
-    public $chkTerms;
21
-    public $plan;
13
+	public $strEmail;
14
+	public $strPassword;
15
+	public $strPassword_1;
16
+	public $strPassword_2;
17
+	public $strFirstName;
18
+	public $strLastName;
19
+	public $strIndustry;
20
+	public $chkTerms;
21
+	public $plan;
22 22
     
23
-    public $session_guid;
24
-    public $member_id;
23
+	public $session_guid;
24
+	public $member_id;
25 25
     
26
-    public $email_address;
27
-    public $first_name;
28
-    public $last_name;
29
-    public $phone_number;
30
-    public $company_name;
31
-    public $webinar_date;
26
+	public $email_address;
27
+	public $first_name;
28
+	public $last_name;
29
+	public $phone_number;
30
+	public $company_name;
31
+	public $webinar_date;
32 32
     
33
-    public $subscription_name;
34
-    public $token;
35
-    public $payload;
33
+	public $subscription_name;
34
+	public $token;
35
+	public $payload;
36 36
     
37
-    public $HIDE_ROUTED_ADDRESSES;
38
-    public $member_phone;
39
-    public $member_zipcode;
40
-    public $route_count;
41
-    public $member_email;
42
-    public $HIDE_VISITED_ADDRESSES;
43
-    public $READONLY_USER;
44
-    public $member_type;
45
-    public $date_of_birth;
46
-    public $member_first_name;
47
-    public $member_password;
48
-    public $HIDE_NONFUTURE_ROUTES;
49
-    public $member_last_name;
50
-    public $SHOW_ALL_VEHICLES;
51
-    public $SHOW_ALL_DRIVERS;
37
+	public $HIDE_ROUTED_ADDRESSES;
38
+	public $member_phone;
39
+	public $member_zipcode;
40
+	public $route_count;
41
+	public $member_email;
42
+	public $HIDE_VISITED_ADDRESSES;
43
+	public $READONLY_USER;
44
+	public $member_type;
45
+	public $date_of_birth;
46
+	public $member_first_name;
47
+	public $member_password;
48
+	public $HIDE_NONFUTURE_ROUTES;
49
+	public $member_last_name;
50
+	public $SHOW_ALL_VEHICLES;
51
+	public $SHOW_ALL_DRIVERS;
52 52
     
53
-    public $config_key;
54
-    public $config_value;
53
+	public $config_key;
54
+	public $config_value;
55 55
     
56
-    public $preferred_units;
57
-    public $preferred_language;
58
-    public $timezone;
59
-    public $OWNER_MEMBER_ID;
60
-    public $user_reg_state_id;
61
-    public $user_reg_country_id;
62
-    public $member_picture;
63
-    public $api_key;
64
-    public $custom_data;
56
+	public $preferred_units;
57
+	public $preferred_language;
58
+	public $timezone;
59
+	public $OWNER_MEMBER_ID;
60
+	public $user_reg_state_id;
61
+	public $user_reg_country_id;
62
+	public $member_picture;
63
+	public $api_key;
64
+	public $custom_data;
65 65
     
66
-    public static function fromArray(array $params) 
67
-    {
68
-        $member= new Member();
69
-        
70
-        foreach($params as $key => $value) {
71
-            if (property_exists($member, $key)) {
72
-                $member->{$key} = $value;
73
-            }
74
-        }
75
-        
76
-        return $member;
77
-    }
66
+	public static function fromArray(array $params) 
67
+	{
68
+		$member= new Member();
69
+        
70
+		foreach($params as $key => $value) {
71
+			if (property_exists($member, $key)) {
72
+				$member->{$key} = $value;
73
+			}
74
+		}
75
+        
76
+		return $member;
77
+	}
78 78
     
79
-    public static function getUsers()
80
-    {
81
-        $response = Route4Me::makeRequst(array(
82
-            'url'    => Endpoint::USER_V4,
83
-            'method' => 'GET'
84
-        ));
79
+	public static function getUsers()
80
+	{
81
+		$response = Route4Me::makeRequst(array(
82
+			'url'    => Endpoint::USER_V4,
83
+			'method' => 'GET'
84
+		));
85 85
 
86
-        return $response;
87
-    }
86
+		return $response;
87
+	}
88 88
     
89
-    public static function getUser($params)
90
-    {
91
-        $response = Route4Me::makeRequst(array(
92
-            'url'    => Endpoint::USER_V4,
93
-            'method' => 'GET',
94
-            'query'  => array(
95
-                'member_id' => isset($params['member_id']) ? $params['member_id'] : null
96
-            )
97
-        ));
89
+	public static function getUser($params)
90
+	{
91
+		$response = Route4Me::makeRequst(array(
92
+			'url'    => Endpoint::USER_V4,
93
+			'method' => 'GET',
94
+			'query'  => array(
95
+				'member_id' => isset($params['member_id']) ? $params['member_id'] : null
96
+			)
97
+		));
98 98
 
99
-        return $response;
100
-    }
99
+		return $response;
100
+	}
101 101
     
102
-    public static function getUserLocations($param)
103
-    {
104
-        $response = Route4Me::makeRequst(array(
105
-            'url'    => Endpoint::VIEW_USER_LOCATIONS,
106
-            'method' => 'GET',
107
-            'query'  => array(
108
-                'query' => $param
109
-            )
110
-        ));
102
+	public static function getUserLocations($param)
103
+	{
104
+		$response = Route4Me::makeRequst(array(
105
+			'url'    => Endpoint::VIEW_USER_LOCATIONS,
106
+			'method' => 'GET',
107
+			'query'  => array(
108
+				'query' => $param
109
+			)
110
+		));
111 111
 
112
-        return $response;
113
-    }
112
+		return $response;
113
+	}
114 114
     
115
-    public static function addDeviceRecord($params)
116
-    {
117
-        $allQueryFields = array('device_id', 'device_type');
118
-        $allBodyFields = array('device_id', 'device_type', 'format');
119
-        
120
-        $response = Route4Me::makeRequst(array(
121
-            'url'    => Endpoint::VERIFY_DEVICE_LICENSE,
122
-            'method' => 'POST',
123
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
124
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
125
-        ));
126
-        
127
-        return $response;
128
-    }
115
+	public static function addDeviceRecord($params)
116
+	{
117
+		$allQueryFields = array('device_id', 'device_type');
118
+		$allBodyFields = array('device_id', 'device_type', 'format');
119
+        
120
+		$response = Route4Me::makeRequst(array(
121
+			'url'    => Endpoint::VERIFY_DEVICE_LICENSE,
122
+			'method' => 'POST',
123
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
124
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
125
+		));
126
+        
127
+		return $response;
128
+	}
129 129
     
130
-    public static function createMember($params)
131
-    {
132
-        $excludeFields = array('session_guid', 'member_id', 'token', 'payload', 'webinar_date', 
133
-        'company_name', 'config_key', 'config_value', 'api_key');
130
+	public static function createMember($params)
131
+	{
132
+		$excludeFields = array('session_guid', 'member_id', 'token', 'payload', 'webinar_date', 
133
+		'company_name', 'config_key', 'config_value', 'api_key');
134 134
         
135
-        $allBodyFields = Route4Me::getObjectProperties(new Member(), $excludeFields);
135
+		$allBodyFields = Route4Me::getObjectProperties(new Member(), $excludeFields);
136 136
 
137
-        $response = Route4Me::makeRequst(array(
138
-            'url'    => Endpoint::USER_V4,
139
-            'method' => 'POST',
140
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
141
-        ));
142
-        
143
-        return $response;
144
-    }
137
+		$response = Route4Me::makeRequst(array(
138
+			'url'    => Endpoint::USER_V4,
139
+			'method' => 'POST',
140
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
141
+		));
142
+        
143
+		return $response;
144
+	}
145 145
 
146
-    public static function getRandomMemberByType($memberType)
147
-    {
148
-        $members = self::getUsers();
146
+	public static function getRandomMemberByType($memberType)
147
+	{
148
+		$members = self::getUsers();
149 149
         
150
-        if (is_null($members)) return null;
151
-        if (!isset($members['results'])) return null;
150
+		if (is_null($members)) return null;
151
+		if (!isset($members['results'])) return null;
152 152
         
153
-        $memberIDs = array();
153
+		$memberIDs = array();
154 154
         
155
-        foreach ($members['results'] as $memb) {
156
-            if (isset($memb['member_id']) && isset($memb['member_type'])) {
157
-                if ($memberType==$memb['member_type']) $memberIDs[]=$memb['member_id'];
158
-            }
159
-        }
155
+		foreach ($members['results'] as $memb) {
156
+			if (isset($memb['member_id']) && isset($memb['member_type'])) {
157
+				if ($memberType==$memb['member_type']) $memberIDs[]=$memb['member_id'];
158
+			}
159
+		}
160 160
         
161
-        if (sizeof($memberIDs)<1) return null;
161
+		if (sizeof($memberIDs)<1) return null;
162 162
         
163
-        $randomIndex = rand(0, sizeof($memberIDs)-1);
163
+		$randomIndex = rand(0, sizeof($memberIDs)-1);
164 164
         
165
-        return $memberIDs[$randomIndex];
166
-    }
165
+		return $memberIDs[$randomIndex];
166
+	}
167 167
 
168 168
 
169
-    public static function updateMember($body)
170
-    {
171
-        $excludeFields = array('session_guid', 'token', 'payload', 'webinar_date', 
172
-        'company_name', 'config_key', 'config_value', 'api_key');
169
+	public static function updateMember($body)
170
+	{
171
+		$excludeFields = array('session_guid', 'token', 'payload', 'webinar_date', 
172
+		'company_name', 'config_key', 'config_value', 'api_key');
173 173
         
174
-        $allBodyFields = Route4Me::getObjectProperties(new Member(), $excludeFields);
174
+		$allBodyFields = Route4Me::getObjectProperties(new Member(), $excludeFields);
175 175
         
176
-        $response = Route4Me::makeRequst(array(
177
-            'url'    => Endpoint::USER_V4,
178
-            'method' => 'PUT',
179
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $body)
180
-        ));
176
+		$response = Route4Me::makeRequst(array(
177
+			'url'    => Endpoint::USER_V4,
178
+			'method' => 'PUT',
179
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $body)
180
+		));
181 181
         
182
-        return $response;
183
-    }
182
+		return $response;
183
+	}
184 184
 
185
-    public static function deleteMember($body)
186
-    {
187
-        $response = Route4Me::makeRequst(array(
188
-            'url'    => Endpoint::USER_V4,
189
-            'method' => 'DELETE',
190
-            'body'   => array(
191
-                'member_id' =>  isset($body->member_id) ? $body->member_id : null
192
-            )
185
+	public static function deleteMember($body)
186
+	{
187
+		$response = Route4Me::makeRequst(array(
188
+			'url'    => Endpoint::USER_V4,
189
+			'method' => 'DELETE',
190
+			'body'   => array(
191
+				'member_id' =>  isset($body->member_id) ? $body->member_id : null
192
+			)
193 193
 
194
-        ));
194
+		));
195 195
         
196
-        return $response;
197
-    }
196
+		return $response;
197
+	}
198 198
     
199
-    public static function newAccountRegistration($params)
200
-    {
201
-        $allQueryFields = array('plan');
202
-        $allBodyFields = array('strEmail', 'strPassword_1', 'strPassword_2', 'strFirstName', 
203
-        'strLastName', 'format', 'strIndustry', 'chkTerms', 
204
-        'device_type', 'strSubAccountType', 'blDisableMarketing', 'blDisableAccountActivationEmail');
205
-        
206
-        $response = Route4Me::makeRequst(array(
207
-            'url'    => Endpoint::REGISTER_ACTION,
208
-            'method' => 'POST',
209
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
210
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
211
-            'HTTPHEADER'  => 'Content-Type: multipart/form-data'
212
-        ));
213
-        
214
-        return $response;
215
-    }
199
+	public static function newAccountRegistration($params)
200
+	{
201
+		$allQueryFields = array('plan');
202
+		$allBodyFields = array('strEmail', 'strPassword_1', 'strPassword_2', 'strFirstName', 
203
+		'strLastName', 'format', 'strIndustry', 'chkTerms', 
204
+		'device_type', 'strSubAccountType', 'blDisableMarketing', 'blDisableAccountActivationEmail');
205
+        
206
+		$response = Route4Me::makeRequst(array(
207
+			'url'    => Endpoint::REGISTER_ACTION,
208
+			'method' => 'POST',
209
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
210
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
211
+			'HTTPHEADER'  => 'Content-Type: multipart/form-data'
212
+		));
213
+        
214
+		return $response;
215
+	}
216 216
     
217
-    public static function validateSession($params)
218
-    {
219
-        $allQueryFields = array('session_guid', 'member_id', 'format');
220
-        
221
-        $response = Route4Me::makeRequst(array(
222
-            'url'    => Endpoint::VALIDATE_SESSION,
223
-            'method' => 'GET',
224
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
225
-        ));
226
-        
227
-        return $response;
228
-    }
217
+	public static function validateSession($params)
218
+	{
219
+		$allQueryFields = array('session_guid', 'member_id', 'format');
220
+        
221
+		$response = Route4Me::makeRequst(array(
222
+			'url'    => Endpoint::VALIDATE_SESSION,
223
+			'method' => 'GET',
224
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
225
+		));
226
+        
227
+		return $response;
228
+	}
229 229
     
230
-    public static function memberAuthentication($params)
231
-    {
232
-        $allBodyFields = array('strEmail', 'strPassword', 'format');
233
-        
234
-        $response = Route4Me::makeRequst(array(
235
-            'url'    => Endpoint::AUTHENTICATE,
236
-            'method' => 'POST',
237
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
238
-            'HTTPHEADER'  => 'Content-Type: multipart/form-data'
239
-        ));
240
-        
241
-        return $response;
242
-    }
230
+	public static function memberAuthentication($params)
231
+	{
232
+		$allBodyFields = array('strEmail', 'strPassword', 'format');
233
+        
234
+		$response = Route4Me::makeRequst(array(
235
+			'url'    => Endpoint::AUTHENTICATE,
236
+			'method' => 'POST',
237
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
238
+			'HTTPHEADER'  => 'Content-Type: multipart/form-data'
239
+		));
240
+        
241
+		return $response;
242
+	}
243 243
     
244
-    public static function webinarRegistration($params)
245
-    {
246
-        $allBodyFields = array('email_address', 'first_name', 'last_name', 'phone_number', 
247
-        'company_name', 'member_id', 'webinar_date');
248
-        
249
-        $response = Route4Me::makeRequst(array(
250
-            'url'    => Endpoint::WEBINAR_REGISTER,
251
-            'method' => 'POST',
252
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
253
-        ));
254
-        
255
-        return $response;
256
-    }
244
+	public static function webinarRegistration($params)
245
+	{
246
+		$allBodyFields = array('email_address', 'first_name', 'last_name', 'phone_number', 
247
+		'company_name', 'member_id', 'webinar_date');
248
+        
249
+		$response = Route4Me::makeRequst(array(
250
+			'url'    => Endpoint::WEBINAR_REGISTER,
251
+			'method' => 'POST',
252
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
253
+		));
254
+        
255
+		return $response;
256
+	}
257 257
     
258
-    public static function purchaseUserLicense($params)
259
-    {
260
-        $allQueryFields = array('device_id');
261
-        $allBodyFields = array('member_id', 'session_guid', 'device_id', 'device_type', 
262
-        'subscription_name', 'token', 'payload', 'format');
263
-        
264
-        $response = Route4Me::makeRequst(array(
265
-            'url'    => Endpoint::USER_LICENSE,
266
-            'method' => 'POST',
267
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
268
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
269
-        ));
270
-        
271
-        return $response;
272
-    }
258
+	public static function purchaseUserLicense($params)
259
+	{
260
+		$allQueryFields = array('device_id');
261
+		$allBodyFields = array('member_id', 'session_guid', 'device_id', 'device_type', 
262
+		'subscription_name', 'token', 'payload', 'format');
263
+        
264
+		$response = Route4Me::makeRequst(array(
265
+			'url'    => Endpoint::USER_LICENSE,
266
+			'method' => 'POST',
267
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
268
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
269
+		));
270
+        
271
+		return $response;
272
+	}
273 273
     
274
-    public static function newMemberConfigKey($params)
275
-    {
276
-        $allBodyFields = array('config_key', 'config_value');
277
-        
278
-        $response = Route4Me::makeRequst(array(
279
-            'url'    => Endpoint::CONFIGURATION_SETTINGS,
280
-            'method' => 'POST',
281
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
282
-        ));
283
-        
284
-        return $response;
285
-    }
274
+	public static function newMemberConfigKey($params)
275
+	{
276
+		$allBodyFields = array('config_key', 'config_value');
277
+        
278
+		$response = Route4Me::makeRequst(array(
279
+			'url'    => Endpoint::CONFIGURATION_SETTINGS,
280
+			'method' => 'POST',
281
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
282
+		));
283
+        
284
+		return $response;
285
+	}
286 286
     
287
-    public static function removeMemberConfigKey($params)
288
-    {
289
-        $allBodyFields = array('config_key');
290
-        
291
-        $response = Route4Me::makeRequst(array(
292
-            'url'    => Endpoint::CONFIGURATION_SETTINGS,
293
-            'method' => 'DELETE',
294
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
295
-        ));
296
-        
297
-        return $response;
298
-    }
287
+	public static function removeMemberConfigKey($params)
288
+	{
289
+		$allBodyFields = array('config_key');
290
+        
291
+		$response = Route4Me::makeRequst(array(
292
+			'url'    => Endpoint::CONFIGURATION_SETTINGS,
293
+			'method' => 'DELETE',
294
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
295
+		));
296
+        
297
+		return $response;
298
+	}
299 299
     
300
-    public static function getMemberConfigData($params)
301
-    {
302
-        $allQueryFields = array('config_key');
303
-        
304
-        $response = Route4Me::makeRequst(array(
305
-            'url'    => Endpoint::CONFIGURATION_SETTINGS,
306
-            'method' => 'GET',
307
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
308
-        ));
309
-        
310
-        return $response;
311
-    }
300
+	public static function getMemberConfigData($params)
301
+	{
302
+		$allQueryFields = array('config_key');
303
+        
304
+		$response = Route4Me::makeRequst(array(
305
+			'url'    => Endpoint::CONFIGURATION_SETTINGS,
306
+			'method' => 'GET',
307
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
308
+		));
309
+        
310
+		return $response;
311
+	}
312 312
 
313
-    public static function updateMemberConfigKey($params)
314
-    {
315
-        $allBodyFields = array('config_key', 'config_value');
316
-        
317
-        $response = Route4Me::makeRequst(array(
318
-            'url'    => Endpoint::CONFIGURATION_SETTINGS,
319
-            'method' => 'PUT',
320
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
321
-        ));
322
-        
323
-        return $response;
324
-    }
313
+	public static function updateMemberConfigKey($params)
314
+	{
315
+		$allBodyFields = array('config_key', 'config_value');
316
+        
317
+		$response = Route4Me::makeRequst(array(
318
+			'url'    => Endpoint::CONFIGURATION_SETTINGS,
319
+			'method' => 'PUT',
320
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
321
+		));
322
+        
323
+		return $response;
324
+	}
325 325
 }
Please login to merge, or discard this patch.