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/Vehicle.php 3 patches
Indentation   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -6,179 +6,179 @@
 block discarded – undo
6 6
 
7 7
 class Vehicle extends Common
8 8
 {
9
-    public $vehicle_id;
10
-    public $member_id;
11
-    public $is_deleted;
12
-    public $vehicle_alias;
13
-    public $vehicle_vin;
14
-    public $vehicle_reg_state_id;
15
-    public $vehicle_reg_country_id;
16
-    public $vehicle_license_plate;
17
-    public $vehicle_type_id;
18
-    public $vehicle_make;
19
-    public $vehicle_model_year;
20
-    public $vehicle_model;
21
-    public $vehicle_year_acquired;
22
-    public $vehicle_cost_new;
23
-    public $purchased_new;
24
-    public $license_start_date;
25
-    public $license_end_date;
26
-    public $vehicle_axle_count;
27
-    public $is_operational;
28
-    public $mpg_city;
29
-    public $mpg_highway;
30
-    public $fuel_type;
31
-    public $height_inches;
32
-    public $weight_lb;
33
-    public $external_telematics_vehicle_id;
34
-    public $has_trailer;
35
-    public $heightInInches;
36
-    public $lengthInInches;
37
-    public $widthInInches;
38
-    public $maxWeightPerAxleGroupInPounds;
39
-    public $numAxles;
40
-    public $weightInPounds;
41
-    public $HazmatType;
42
-    public $LowEmissionZonePref;
43
-    public $Use53FootTrailerRouting;
44
-    public $UseNationalNetwork;
45
-    public $UseTruckRestrictions;
46
-    public $AvoidFerries;
47
-    public $DividedHighwayAvoidPreference;
48
-    public $FreewayAvoidPreference;
49
-    public $InternationalBordersOpen;
50
-    public $TollRoadUsage;
51
-    public $hwy_only;
52
-    public $long_combination_vehicle;
53
-    public $avoid_highways;
54
-    public $side_street_adherence;
55
-    public $truck_config;
56
-    public $height_metric;
57
-    public $length_metric;
58
-    public $width_metric;
59
-    public $weight_metric;
60
-    public $max_weight_per_axle_group_metric;
9
+	public $vehicle_id;
10
+	public $member_id;
11
+	public $is_deleted;
12
+	public $vehicle_alias;
13
+	public $vehicle_vin;
14
+	public $vehicle_reg_state_id;
15
+	public $vehicle_reg_country_id;
16
+	public $vehicle_license_plate;
17
+	public $vehicle_type_id;
18
+	public $vehicle_make;
19
+	public $vehicle_model_year;
20
+	public $vehicle_model;
21
+	public $vehicle_year_acquired;
22
+	public $vehicle_cost_new;
23
+	public $purchased_new;
24
+	public $license_start_date;
25
+	public $license_end_date;
26
+	public $vehicle_axle_count;
27
+	public $is_operational;
28
+	public $mpg_city;
29
+	public $mpg_highway;
30
+	public $fuel_type;
31
+	public $height_inches;
32
+	public $weight_lb;
33
+	public $external_telematics_vehicle_id;
34
+	public $has_trailer;
35
+	public $heightInInches;
36
+	public $lengthInInches;
37
+	public $widthInInches;
38
+	public $maxWeightPerAxleGroupInPounds;
39
+	public $numAxles;
40
+	public $weightInPounds;
41
+	public $HazmatType;
42
+	public $LowEmissionZonePref;
43
+	public $Use53FootTrailerRouting;
44
+	public $UseNationalNetwork;
45
+	public $UseTruckRestrictions;
46
+	public $AvoidFerries;
47
+	public $DividedHighwayAvoidPreference;
48
+	public $FreewayAvoidPreference;
49
+	public $InternationalBordersOpen;
50
+	public $TollRoadUsage;
51
+	public $hwy_only;
52
+	public $long_combination_vehicle;
53
+	public $avoid_highways;
54
+	public $side_street_adherence;
55
+	public $truck_config;
56
+	public $height_metric;
57
+	public $length_metric;
58
+	public $width_metric;
59
+	public $weight_metric;
60
+	public $max_weight_per_axle_group_metric;
61 61
     
62
-    public function __construct () 
63
-    {
64
-        Route4Me::setBaseUrl(Endpoint::WH_BASE_URL);
65
-    }
62
+	public function __construct () 
63
+	{
64
+		Route4Me::setBaseUrl(Endpoint::WH_BASE_URL);
65
+	}
66 66
     
67
-    public static function fromArray(array $params) {
68
-        $vehicle= new Vehicle();
69
-        foreach($params as $key => $value) {
70
-            if (property_exists($vehicle, $key)) {
71
-                $vehicle->{$key} = $value;
72
-            }
73
-        }
67
+	public static function fromArray(array $params) {
68
+		$vehicle= new Vehicle();
69
+		foreach($params as $key => $value) {
70
+			if (property_exists($vehicle, $key)) {
71
+				$vehicle->{$key} = $value;
72
+			}
73
+		}
74 74
         
75
-        return $vehicle;
76
-    }
75
+		return $vehicle;
76
+	}
77 77
     
78
-    public static function getVehicles($params)
79
-    {
80
-        $response = Route4Me::makeRequst(array(
81
-            'url'    => Endpoint::VEHICLE_V4,
82
-            'method' => 'GET',
83
-            'query'  => array(
84
-                'with_pagination'  => isset($params['with_pagination']) ? $params['with_pagination'] : null,
85
-                'page'             => isset($params['page']) ? $params['page'] : null,
86
-                'perPage'          => isset($params['perPage']) ? $params['perPage'] : null,
87
-            )
88
-        ));
78
+	public static function getVehicles($params)
79
+	{
80
+		$response = Route4Me::makeRequst(array(
81
+			'url'    => Endpoint::VEHICLE_V4,
82
+			'method' => 'GET',
83
+			'query'  => array(
84
+				'with_pagination'  => isset($params['with_pagination']) ? $params['with_pagination'] : null,
85
+				'page'             => isset($params['page']) ? $params['page'] : null,
86
+				'perPage'          => isset($params['perPage']) ? $params['perPage'] : null,
87
+			)
88
+		));
89 89
 
90
-        return $response;
91
-    }
90
+		return $response;
91
+	}
92 92
     
93
-    public function getRandomVehicleId($page,$perPage)
94
-    {
95
-        $query['page'] = isset($page) ? $page : 1;
96
-        $query['perPage'] = isset($perPage) ? $perPage : 10;
97
-        $query['with_pagination'] = true;
93
+	public function getRandomVehicleId($page,$perPage)
94
+	{
95
+		$query['page'] = isset($page) ? $page : 1;
96
+		$query['perPage'] = isset($perPage) ? $perPage : 10;
97
+		$query['with_pagination'] = true;
98 98
         
99
-        $vehicles = $this->getVehicles($query);
99
+		$vehicles = $this->getVehicles($query);
100 100
 
101
-        if (is_null($vehicles)) return null;
102
-        if (!isset($vehicles['data'])) return null;
103
-        if (sizeof($vehicles['data'])<1) return null;
101
+		if (is_null($vehicles)) return null;
102
+		if (!isset($vehicles['data'])) return null;
103
+		if (sizeof($vehicles['data'])<1) return null;
104 104
         
105
-        $randomIndex = rand(0, sizeof($vehicles['data'])-1);
105
+		$randomIndex = rand(0, sizeof($vehicles['data'])-1);
106 106
         
107
-        return $vehicles['data'][$randomIndex]['vehicle_id'];
108
-    }
107
+		return $vehicles['data'][$randomIndex]['vehicle_id'];
108
+	}
109 109
     
110
-    public function getVehicleByID($vehicleID)
111
-    {
112
-        $response = Route4Me::makeRequst(array(
113
-            'url'    => Endpoint::VEHICLE_V4 . '/' . $vehicleID,
114
-            'method' => 'GET'
115
-        ));
110
+	public function getVehicleByID($vehicleID)
111
+	{
112
+		$response = Route4Me::makeRequst(array(
113
+			'url'    => Endpoint::VEHICLE_V4 . '/' . $vehicleID,
114
+			'method' => 'GET'
115
+		));
116 116
 
117
-        return $response;
118
-    }
117
+		return $response;
118
+	}
119 119
     
120
-    public function updateVehicle($params)
121
-    {
122
-        $vehicleID = isset($params->vehicle_id) ? $params->vehicle_id : null;
120
+	public function updateVehicle($params)
121
+	{
122
+		$vehicleID = isset($params->vehicle_id) ? $params->vehicle_id : null;
123 123
         
124
-        $body = array();
124
+		$body = array();
125 125
         
126
-        $vehicle= new Vehicle();
126
+		$vehicle= new Vehicle();
127 127
         
128
-        foreach($params as $key => $value) {
129
-            if ($key=="vehicle_id") continue; 
130
-            if (property_exists($vehicle, $key)) {
131
-                if (isset($params->{$key})) {
132
-                    $body[$key] = $params->{$key};
133
-                } 
134
-            }
135
-        }
128
+		foreach($params as $key => $value) {
129
+			if ($key=="vehicle_id") continue; 
130
+			if (property_exists($vehicle, $key)) {
131
+				if (isset($params->{$key})) {
132
+					$body[$key] = $params->{$key};
133
+				} 
134
+			}
135
+		}
136 136
         
137
-        $response = Route4Me::makeRequst(array(
138
-            'url'    => Endpoint::VEHICLE_V4 . '/' . $vehicleID,
139
-            'method' => 'PUT',
140
-            'body'   => $body,
141
-            'HTTPHEADER'  => 'Content-Type: application/json'
142
-        ));
137
+		$response = Route4Me::makeRequst(array(
138
+			'url'    => Endpoint::VEHICLE_V4 . '/' . $vehicleID,
139
+			'method' => 'PUT',
140
+			'body'   => $body,
141
+			'HTTPHEADER'  => 'Content-Type: application/json'
142
+		));
143 143
 
144
-        return $response;
145
-    }
144
+		return $response;
145
+	}
146 146
     
147
-    public function createVehicle($params)
148
-    {
149
-        $body = array();
147
+	public function createVehicle($params)
148
+	{
149
+		$body = array();
150 150
         
151
-        $vehicle= new Vehicle();
151
+		$vehicle= new Vehicle();
152 152
         
153
-        foreach($params as $key => $value) {
154
-            if ($key=="vehicle_id") continue; 
155
-            if (property_exists($vehicle, $key)) {
156
-                if (isset($params->{$key})) {
157
-                    $body[$key] = $params->{$key};
158
-                } 
159
-            }
160
-        }
153
+		foreach($params as $key => $value) {
154
+			if ($key=="vehicle_id") continue; 
155
+			if (property_exists($vehicle, $key)) {
156
+				if (isset($params->{$key})) {
157
+					$body[$key] = $params->{$key};
158
+				} 
159
+			}
160
+		}
161 161
         
162
-        $response = Route4Me::makeRequst(array(
163
-            'url'    => Endpoint::VEHICLE_V4,
164
-            'method' => 'POST',
165
-            'body'   => $body,
166
-            'HTTPHEADER'  => 'Content-Type: application/json'
167
-        ));
162
+		$response = Route4Me::makeRequst(array(
163
+			'url'    => Endpoint::VEHICLE_V4,
164
+			'method' => 'POST',
165
+			'body'   => $body,
166
+			'HTTPHEADER'  => 'Content-Type: application/json'
167
+		));
168 168
 
169
-        return $response;
170
-    }
169
+		return $response;
170
+	}
171 171
     
172
-    public function removeVehicle($params)
173
-    {
174
-        $vehicleID = isset($params->vehicle_id) ? $params->vehicle_id : null;
172
+	public function removeVehicle($params)
173
+	{
174
+		$vehicleID = isset($params->vehicle_id) ? $params->vehicle_id : null;
175 175
         
176
-        $response = Route4Me::makeRequst(array(
177
-            'url'    => Endpoint::VEHICLE_V4 . '/' . $vehicleID,
178
-            'method' => 'DELETE',
179
-            'HTTPHEADER'  => 'Content-Type: application/json'
180
-        ));
176
+		$response = Route4Me::makeRequst(array(
177
+			'url'    => Endpoint::VEHICLE_V4 . '/' . $vehicleID,
178
+			'method' => 'DELETE',
179
+			'HTTPHEADER'  => 'Content-Type: application/json'
180
+		));
181 181
 
182
-        return $response;
183
-    }
182
+		return $response;
183
+	}
184 184
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -59,14 +59,14 @@  discard block
 block discarded – undo
59 59
     public $weight_metric;
60 60
     public $max_weight_per_axle_group_metric;
61 61
     
62
-    public function __construct () 
62
+    public function __construct() 
63 63
     {
64 64
         Route4Me::setBaseUrl(Endpoint::WH_BASE_URL);
65 65
     }
66 66
     
67 67
     public static function fromArray(array $params) {
68
-        $vehicle= new Vehicle();
69
-        foreach($params as $key => $value) {
68
+        $vehicle = new Vehicle();
69
+        foreach ($params as $key => $value) {
70 70
             if (property_exists($vehicle, $key)) {
71 71
                 $vehicle->{$key} = $value;
72 72
             }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         return $response;
91 91
     }
92 92
     
93
-    public function getRandomVehicleId($page,$perPage)
93
+    public function getRandomVehicleId($page, $perPage)
94 94
     {
95 95
         $query['page'] = isset($page) ? $page : 1;
96 96
         $query['perPage'] = isset($perPage) ? $perPage : 10;
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         if (!isset($vehicles['data'])) return null;
103 103
         if (sizeof($vehicles['data'])<1) return null;
104 104
         
105
-        $randomIndex = rand(0, sizeof($vehicles['data'])-1);
105
+        $randomIndex = rand(0, sizeof($vehicles['data']) - 1);
106 106
         
107 107
         return $vehicles['data'][$randomIndex]['vehicle_id'];
108 108
     }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     public function getVehicleByID($vehicleID)
111 111
     {
112 112
         $response = Route4Me::makeRequst(array(
113
-            'url'    => Endpoint::VEHICLE_V4 . '/' . $vehicleID,
113
+            'url'    => Endpoint::VEHICLE_V4.'/'.$vehicleID,
114 114
             'method' => 'GET'
115 115
         ));
116 116
 
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
         
124 124
         $body = array();
125 125
         
126
-        $vehicle= new Vehicle();
126
+        $vehicle = new Vehicle();
127 127
         
128
-        foreach($params as $key => $value) {
128
+        foreach ($params as $key => $value) {
129 129
             if ($key=="vehicle_id") continue; 
130 130
             if (property_exists($vehicle, $key)) {
131 131
                 if (isset($params->{$key})) {
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         }
136 136
         
137 137
         $response = Route4Me::makeRequst(array(
138
-            'url'    => Endpoint::VEHICLE_V4 . '/' . $vehicleID,
138
+            'url'    => Endpoint::VEHICLE_V4.'/'.$vehicleID,
139 139
             'method' => 'PUT',
140 140
             'body'   => $body,
141 141
             'HTTPHEADER'  => 'Content-Type: application/json'
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
     {
149 149
         $body = array();
150 150
         
151
-        $vehicle= new Vehicle();
151
+        $vehicle = new Vehicle();
152 152
         
153
-        foreach($params as $key => $value) {
153
+        foreach ($params as $key => $value) {
154 154
             if ($key=="vehicle_id") continue; 
155 155
             if (property_exists($vehicle, $key)) {
156 156
                 if (isset($params->{$key})) {
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
         $vehicleID = isset($params->vehicle_id) ? $params->vehicle_id : null;
175 175
         
176 176
         $response = Route4Me::makeRequst(array(
177
-            'url'    => Endpoint::VEHICLE_V4 . '/' . $vehicleID,
177
+            'url'    => Endpoint::VEHICLE_V4.'/'.$vehicleID,
178 178
             'method' => 'DELETE',
179 179
             'HTTPHEADER'  => 'Content-Type: application/json'
180 180
         ));
Please login to merge, or discard this patch.
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -98,9 +98,15 @@  discard block
 block discarded – undo
98 98
         
99 99
         $vehicles = $this->getVehicles($query);
100 100
 
101
-        if (is_null($vehicles)) return null;
102
-        if (!isset($vehicles['data'])) return null;
103
-        if (sizeof($vehicles['data'])<1) return null;
101
+        if (is_null($vehicles)) {
102
+        	return null;
103
+        }
104
+        if (!isset($vehicles['data'])) {
105
+        	return null;
106
+        }
107
+        if (sizeof($vehicles['data'])<1) {
108
+        	return null;
109
+        }
104 110
         
105 111
         $randomIndex = rand(0, sizeof($vehicles['data'])-1);
106 112
         
@@ -126,7 +132,9 @@  discard block
 block discarded – undo
126 132
         $vehicle= new Vehicle();
127 133
         
128 134
         foreach($params as $key => $value) {
129
-            if ($key=="vehicle_id") continue; 
135
+            if ($key=="vehicle_id") {
136
+            	continue;
137
+            }
130 138
             if (property_exists($vehicle, $key)) {
131 139
                 if (isset($params->{$key})) {
132 140
                     $body[$key] = $params->{$key};
@@ -151,7 +159,9 @@  discard block
 block discarded – undo
151 159
         $vehicle= new Vehicle();
152 160
         
153 161
         foreach($params as $key => $value) {
154
-            if ($key=="vehicle_id") continue; 
162
+            if ($key=="vehicle_id") {
163
+            	continue;
164
+            }
155 165
             if (property_exists($vehicle, $key)) {
156 166
                 if (isset($params->{$key})) {
157 167
                     $body[$key] = $params->{$key};
Please login to merge, or discard this patch.
src/Route4Me/Member.php 3 patches
Indentation   +320 added lines, -320 removed lines patch added patch discarded remove patch
@@ -6,378 +6,378 @@
 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 $webiinar_date;
26
+	public $email_address;
27
+	public $first_name;
28
+	public $last_name;
29
+	public $phone_number;
30
+	public $company_name;
31
+	public $webiinar_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();
66
+	public static function fromArray(array $params) 
67
+	{
68
+		$member= new Member();
69 69
         
70
-        foreach($params as $key => $value) {
71
-            if (property_exists($member, $key)) {
72
-                $member->{$key} = $value;
73
-            }
74
-        }
70
+		foreach($params as $key => $value) {
71
+			if (property_exists($member, $key)) {
72
+				$member->{$key} = $value;
73
+			}
74
+		}
75 75
         
76
-        return $member;
77
-    }
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($body)
116
-    {
117
-        $response = Route4Me::makeRequst(array(
118
-            'url'    => Endpoint::VERIFY_DEVICE_LICENSE,
119
-            'method' => 'POST',
120
-            'query'  => array(
121
-                'device_id'   => isset($body->device_id)   ? $body->device_id : null,
122
-                'device_type' => isset($body->device_type) ? $body->device_type : null,
123
-            ),
124
-            'body'   => array(
125
-                'device_id'   => isset($body->device_id)   ? $body->device_id : null,
126
-                'device_type' => isset($body->device_type) ? $body->device_type : null,
127
-                'format'      => isset($body->format)      ? $body->format : null
128
-            )
115
+	public static function addDeviceRecord($body)
116
+	{
117
+		$response = Route4Me::makeRequst(array(
118
+			'url'    => Endpoint::VERIFY_DEVICE_LICENSE,
119
+			'method' => 'POST',
120
+			'query'  => array(
121
+				'device_id'   => isset($body->device_id)   ? $body->device_id : null,
122
+				'device_type' => isset($body->device_type) ? $body->device_type : null,
123
+			),
124
+			'body'   => array(
125
+				'device_id'   => isset($body->device_id)   ? $body->device_id : null,
126
+				'device_type' => isset($body->device_type) ? $body->device_type : null,
127
+				'format'      => isset($body->format)      ? $body->format : null
128
+			)
129 129
 
130
-        ));
130
+		));
131 131
         
132
-        return $response;
133
-    }
132
+		return $response;
133
+	}
134 134
     
135
-    public static function createMember($body)
136
-    {
137
-        $response = Route4Me::makeRequst(array(
138
-            'url'    => Endpoint::USER_V4,
139
-            'method' => 'POST',
140
-            'body'   => array(
141
-                'HIDE_ROUTED_ADDRESSES'  => isset($body->HIDE_ROUTED_ADDRESSES) ? $body->HIDE_ROUTED_ADDRESSES : null,
142
-                'member_phone'           => isset($body->member_phone) ? $body->member_phone : null,
143
-                'member_zipcode'         => isset($body->member_zipcode) ? $body->member_zipcode : null,
144
-                'route_count'            => isset($body->route_count) ? $body->route_count : null,
145
-                'member_email'           => isset($body->member_email) ? $body->member_email : null,
146
-                'HIDE_VISITED_ADDRESSES' => isset($body->HIDE_VISITED_ADDRESSES) ? $body->HIDE_VISITED_ADDRESSES : null,
147
-                'READONLY_USER'          => isset($body->READONLY_USER) ? $body->READONLY_USER : null,
148
-                'member_type'            => isset($body->member_type) ? $body->member_type : null,
149
-                'date_of_birth'          => isset($body->date_of_birth) ? $body->date_of_birth : null,
150
-                'member_first_name'      => isset($body->member_first_name) ? $body->member_first_name : null,
151
-                'member_password'        => isset($body->member_password) ? $body->member_password : null,
152
-                'HIDE_NONFUTURE_ROUTES'  => isset($body->HIDE_NONFUTURE_ROUTES) ? $body->HIDE_NONFUTURE_ROUTES : null,
153
-                'member_last_name'       => isset($body->member_last_name) ? $body->member_last_name : null,
154
-                'SHOW_ALL_VEHICLES'      => isset($body->SHOW_ALL_VEHICLES) ? $body->SHOW_ALL_VEHICLES : null,
155
-                'SHOW_ALL_DRIVERS'       => isset($body->SHOW_ALL_DRIVERS) ? $body->SHOW_ALL_DRIVERS : null
156
-            )
157
-        ));
135
+	public static function createMember($body)
136
+	{
137
+		$response = Route4Me::makeRequst(array(
138
+			'url'    => Endpoint::USER_V4,
139
+			'method' => 'POST',
140
+			'body'   => array(
141
+				'HIDE_ROUTED_ADDRESSES'  => isset($body->HIDE_ROUTED_ADDRESSES) ? $body->HIDE_ROUTED_ADDRESSES : null,
142
+				'member_phone'           => isset($body->member_phone) ? $body->member_phone : null,
143
+				'member_zipcode'         => isset($body->member_zipcode) ? $body->member_zipcode : null,
144
+				'route_count'            => isset($body->route_count) ? $body->route_count : null,
145
+				'member_email'           => isset($body->member_email) ? $body->member_email : null,
146
+				'HIDE_VISITED_ADDRESSES' => isset($body->HIDE_VISITED_ADDRESSES) ? $body->HIDE_VISITED_ADDRESSES : null,
147
+				'READONLY_USER'          => isset($body->READONLY_USER) ? $body->READONLY_USER : null,
148
+				'member_type'            => isset($body->member_type) ? $body->member_type : null,
149
+				'date_of_birth'          => isset($body->date_of_birth) ? $body->date_of_birth : null,
150
+				'member_first_name'      => isset($body->member_first_name) ? $body->member_first_name : null,
151
+				'member_password'        => isset($body->member_password) ? $body->member_password : null,
152
+				'HIDE_NONFUTURE_ROUTES'  => isset($body->HIDE_NONFUTURE_ROUTES) ? $body->HIDE_NONFUTURE_ROUTES : null,
153
+				'member_last_name'       => isset($body->member_last_name) ? $body->member_last_name : null,
154
+				'SHOW_ALL_VEHICLES'      => isset($body->SHOW_ALL_VEHICLES) ? $body->SHOW_ALL_VEHICLES : null,
155
+				'SHOW_ALL_DRIVERS'       => isset($body->SHOW_ALL_DRIVERS) ? $body->SHOW_ALL_DRIVERS : null
156
+			)
157
+		));
158 158
         
159
-        return $response;
160
-    }
159
+		return $response;
160
+	}
161 161
 
162
-    public static function getRandomMemberByType($memberType)
163
-    {
164
-        $members = self::getUsers();
162
+	public static function getRandomMemberByType($memberType)
163
+	{
164
+		$members = self::getUsers();
165 165
         
166
-        if (is_null($members)) return null;
167
-        if (!isset($members['results'])) return null;
166
+		if (is_null($members)) return null;
167
+		if (!isset($members['results'])) return null;
168 168
         
169
-        $memberIDs = array();
169
+		$memberIDs = array();
170 170
         
171
-        foreach ($members['results'] as $memb) {
172
-            if (isset($memb['member_id']) && isset($memb['member_type'])) {
173
-                if ($memberType==$memb['member_type']) $memberIDs[]=$memb['member_id'];
174
-            }
175
-        }
171
+		foreach ($members['results'] as $memb) {
172
+			if (isset($memb['member_id']) && isset($memb['member_type'])) {
173
+				if ($memberType==$memb['member_type']) $memberIDs[]=$memb['member_id'];
174
+			}
175
+		}
176 176
         
177
-        if (sizeof($memberIDs)<1) return null;
177
+		if (sizeof($memberIDs)<1) return null;
178 178
         
179
-        $randomIndex = rand(0, sizeof($memberIDs)-1);
179
+		$randomIndex = rand(0, sizeof($memberIDs)-1);
180 180
         
181
-        return $memberIDs[$randomIndex];
182
-    }
181
+		return $memberIDs[$randomIndex];
182
+	}
183 183
 
184 184
 
185
-    public static function updateMember($body)
186
-    {
187
-        $response = Route4Me::makeRequst(array(
188
-            'url'    => Endpoint::USER_V4,
189
-            'method' => 'PUT',
190
-            'body'   => array(
191
-                'member_id'              => isset($body->member_id) ? $body->member_id : null,
192
-                'member_phone'           => isset($body->member_phone) ? $body->member_phone : null,
193
-                'HIDE_ROUTED_ADDRESSES'  => isset($body->HIDE_ROUTED_ADDRESSES) ? $body->HIDE_ROUTED_ADDRESSES : null,
194
-                'member_zipcode'         => isset($body->member_zipcode) ? $body->member_zipcode : null,
195
-                'route_count'            => isset($body->route_count) ? $body->route_count : null,
196
-                'member_email'           => isset($body->member_email) ? $body->member_email : null,
197
-                'HIDE_VISITED_ADDRESSES' => isset($body->HIDE_VISITED_ADDRESSES) ? $body->HIDE_VISITED_ADDRESSES : null,
198
-                'READONLY_USER'          => isset($body->READONLY_USER) ? $body->READONLY_USER : null,
199
-                'date_of_birth'          => isset($body->date_of_birth) ? $body->date_of_birth : null,
200
-                'member_first_name'      => isset($body->member_first_name) ? $body->member_first_name : null,
201
-                'member_password'        => isset($body->member_password) ? $body->member_password : null,
202
-                'HIDE_NONFUTURE_ROUTES'  => isset($body->HIDE_NONFUTURE_ROUTES) ? $body->HIDE_NONFUTURE_ROUTES : null,
203
-                'member_last_name'       => isset($body->member_last_name) ? $body->member_last_name : null,
204
-                'SHOW_ALL_VEHICLES'      => isset($body->SHOW_ALL_VEHICLES) ? $body->SHOW_ALL_VEHICLES : null,
205
-                'SHOW_ALL_DRIVERS'       => isset($body->SHOW_ALL_DRIVERS) ? $body->SHOW_ALL_DRIVERS : null
206
-            )
185
+	public static function updateMember($body)
186
+	{
187
+		$response = Route4Me::makeRequst(array(
188
+			'url'    => Endpoint::USER_V4,
189
+			'method' => 'PUT',
190
+			'body'   => array(
191
+				'member_id'              => isset($body->member_id) ? $body->member_id : null,
192
+				'member_phone'           => isset($body->member_phone) ? $body->member_phone : null,
193
+				'HIDE_ROUTED_ADDRESSES'  => isset($body->HIDE_ROUTED_ADDRESSES) ? $body->HIDE_ROUTED_ADDRESSES : null,
194
+				'member_zipcode'         => isset($body->member_zipcode) ? $body->member_zipcode : null,
195
+				'route_count'            => isset($body->route_count) ? $body->route_count : null,
196
+				'member_email'           => isset($body->member_email) ? $body->member_email : null,
197
+				'HIDE_VISITED_ADDRESSES' => isset($body->HIDE_VISITED_ADDRESSES) ? $body->HIDE_VISITED_ADDRESSES : null,
198
+				'READONLY_USER'          => isset($body->READONLY_USER) ? $body->READONLY_USER : null,
199
+				'date_of_birth'          => isset($body->date_of_birth) ? $body->date_of_birth : null,
200
+				'member_first_name'      => isset($body->member_first_name) ? $body->member_first_name : null,
201
+				'member_password'        => isset($body->member_password) ? $body->member_password : null,
202
+				'HIDE_NONFUTURE_ROUTES'  => isset($body->HIDE_NONFUTURE_ROUTES) ? $body->HIDE_NONFUTURE_ROUTES : null,
203
+				'member_last_name'       => isset($body->member_last_name) ? $body->member_last_name : null,
204
+				'SHOW_ALL_VEHICLES'      => isset($body->SHOW_ALL_VEHICLES) ? $body->SHOW_ALL_VEHICLES : null,
205
+				'SHOW_ALL_DRIVERS'       => isset($body->SHOW_ALL_DRIVERS) ? $body->SHOW_ALL_DRIVERS : null
206
+			)
207 207
 
208
-        ));
208
+		));
209 209
         
210
-        return $response;
211
-    }
210
+		return $response;
211
+	}
212 212
 
213
-    public static function deleteMember($body)
214
-    {
215
-        $response = Route4Me::makeRequst(array(
216
-            'url'    => Endpoint::USER_V4,
217
-            'method' => 'DELETE',
218
-            'body'   => array(
219
-                'member_id' =>  isset($body->member_id) ? $body->member_id : null
220
-            )
213
+	public static function deleteMember($body)
214
+	{
215
+		$response = Route4Me::makeRequst(array(
216
+			'url'    => Endpoint::USER_V4,
217
+			'method' => 'DELETE',
218
+			'body'   => array(
219
+				'member_id' =>  isset($body->member_id) ? $body->member_id : null
220
+			)
221 221
 
222
-        ));
222
+		));
223 223
         
224
-        return $response;
225
-    }
224
+		return $response;
225
+	}
226 226
     
227
-    public static function newAccountRegistration($body)
228
-    {
229
-        $response = Route4Me::makeRequst(array(
230
-            'url'    => Endpoint::REGISTER_ACTION,
231
-            'method' => 'POST',
232
-            'query'  => array(
233
-                'plan' => isset($body->plan) ? $body->plan : null
234
-            ),
235
-            'body'   => array(
236
-                'strEmail'                        => isset($body->strEmail) ? $body->strEmail : null,
237
-                'strPassword_1'                   => isset($body->strPassword_1) ? $body->strPassword_1 : null,
238
-                'strPassword_2'                   => isset($body->strPassword_2) ? $body->strPassword_2 : null,
239
-                'strFirstName'                    => isset($body->strFirstName) ? $body->strFirstName : null,
240
-                'strLastName'                     => isset($body->strLastName) ? $body->strLastName : null,
241
-                'format'                          => isset($body->format) ? $body->format : null,
242
-                'strIndustry'                     => isset($body->strIndustry) ? $body->strIndustry : null,
243
-                'chkTerms'                        => isset($body->chkTerms) ? $body->chkTerms : null,
244
-                'device_type'                     => isset($body->device_type) ? $body->device_type : null,
245
-                'strSubAccountType'               => isset($body->strSubAccountType) ? $body->strSubAccountType : null,
246
-                'blDisableMarketing'              => isset($body->blDisableMarketing) ? $body->blDisableMarketing : false,
247
-                'blDisableAccountActivationEmail' => isset($body->blDisableAccountActivationEmail) 
248
-                                                     ? $body->blDisableAccountActivationEmail : false
249
-            ),
250
-            'HTTPHEADER'  => 'Content-Type: multipart/form-data'
251
-        ));
227
+	public static function newAccountRegistration($body)
228
+	{
229
+		$response = Route4Me::makeRequst(array(
230
+			'url'    => Endpoint::REGISTER_ACTION,
231
+			'method' => 'POST',
232
+			'query'  => array(
233
+				'plan' => isset($body->plan) ? $body->plan : null
234
+			),
235
+			'body'   => array(
236
+				'strEmail'                        => isset($body->strEmail) ? $body->strEmail : null,
237
+				'strPassword_1'                   => isset($body->strPassword_1) ? $body->strPassword_1 : null,
238
+				'strPassword_2'                   => isset($body->strPassword_2) ? $body->strPassword_2 : null,
239
+				'strFirstName'                    => isset($body->strFirstName) ? $body->strFirstName : null,
240
+				'strLastName'                     => isset($body->strLastName) ? $body->strLastName : null,
241
+				'format'                          => isset($body->format) ? $body->format : null,
242
+				'strIndustry'                     => isset($body->strIndustry) ? $body->strIndustry : null,
243
+				'chkTerms'                        => isset($body->chkTerms) ? $body->chkTerms : null,
244
+				'device_type'                     => isset($body->device_type) ? $body->device_type : null,
245
+				'strSubAccountType'               => isset($body->strSubAccountType) ? $body->strSubAccountType : null,
246
+				'blDisableMarketing'              => isset($body->blDisableMarketing) ? $body->blDisableMarketing : false,
247
+				'blDisableAccountActivationEmail' => isset($body->blDisableAccountActivationEmail) 
248
+													 ? $body->blDisableAccountActivationEmail : false
249
+			),
250
+			'HTTPHEADER'  => 'Content-Type: multipart/form-data'
251
+		));
252 252
         
253
-        return $response;
254
-    }
253
+		return $response;
254
+	}
255 255
     
256
-    public static function validateSession($params)
257
-    {
258
-        $response = Route4Me::makeRequst(array(
259
-            'url'    => Endpoint::VALIDATE_SESSION,
260
-            'method' => 'GET',
261
-            'query'  => array(
262
-                'session_guid' => isset($params->session_guid) ? $params->session_guid : null,
263
-                'member_id'    => isset($params->member_id) ? $params->member_id : null,
264
-                'format'       => isset($params->format) ? $params->format : null
265
-            )
266
-        ));
256
+	public static function validateSession($params)
257
+	{
258
+		$response = Route4Me::makeRequst(array(
259
+			'url'    => Endpoint::VALIDATE_SESSION,
260
+			'method' => 'GET',
261
+			'query'  => array(
262
+				'session_guid' => isset($params->session_guid) ? $params->session_guid : null,
263
+				'member_id'    => isset($params->member_id) ? $params->member_id : null,
264
+				'format'       => isset($params->format) ? $params->format : null
265
+			)
266
+		));
267 267
         
268
-        return $response;
269
-    }
268
+		return $response;
269
+	}
270 270
     
271
-    public static function memberAuthentication($body)
272
-    {
273
-        $response = Route4Me::makeRequst(array(
274
-            'url'    => Endpoint::AUTHENTICATE,
275
-            'method' => 'POST',
276
-            'body'   => array(
277
-                'strEmail'    => isset($body->strEmail) ? $body->strEmail : null,
278
-                'strPassword' => isset($body->strPassword) ? $body->strPassword : null,
279
-                'format'      => isset($body->format) ? $body->format : null
280
-            ),
281
-            'HTTPHEADER'  => 'Content-Type: multipart/form-data'
282
-        ));
271
+	public static function memberAuthentication($body)
272
+	{
273
+		$response = Route4Me::makeRequst(array(
274
+			'url'    => Endpoint::AUTHENTICATE,
275
+			'method' => 'POST',
276
+			'body'   => array(
277
+				'strEmail'    => isset($body->strEmail) ? $body->strEmail : null,
278
+				'strPassword' => isset($body->strPassword) ? $body->strPassword : null,
279
+				'format'      => isset($body->format) ? $body->format : null
280
+			),
281
+			'HTTPHEADER'  => 'Content-Type: multipart/form-data'
282
+		));
283 283
         
284
-        return $response;
285
-    }
284
+		return $response;
285
+	}
286 286
     
287
-    public static function webinarRegistration($body)
288
-    {
289
-        $response = Route4Me::makeRequst(array(
290
-            'url'    => Endpoint::WEBINAR_REGISTER,
291
-            'method' => 'POST',
292
-            'body'   => array(
293
-                'email_address'  => isset($body->email_address) ? $body->email_address : null,
294
-                'first_name'     => isset($body->first_name) ? $body->first_name : null,
295
-                'last_name'      => isset($body->last_name) ? $body->last_name : null,
296
-                'phone_number'   => isset($body->phone_number) ? $body->phone_number : null,
297
-                'phone_number'   => isset($body->phone_number) ? $body->phone_number : null,
298
-                'member_id'      => isset($body->member_id) ? $body->member_id : null,
299
-                'webiinar_date'  => isset($body->webiinar_date) ? $body->webiinar_date : null,
300
-            )
287
+	public static function webinarRegistration($body)
288
+	{
289
+		$response = Route4Me::makeRequst(array(
290
+			'url'    => Endpoint::WEBINAR_REGISTER,
291
+			'method' => 'POST',
292
+			'body'   => array(
293
+				'email_address'  => isset($body->email_address) ? $body->email_address : null,
294
+				'first_name'     => isset($body->first_name) ? $body->first_name : null,
295
+				'last_name'      => isset($body->last_name) ? $body->last_name : null,
296
+				'phone_number'   => isset($body->phone_number) ? $body->phone_number : null,
297
+				'phone_number'   => isset($body->phone_number) ? $body->phone_number : null,
298
+				'member_id'      => isset($body->member_id) ? $body->member_id : null,
299
+				'webiinar_date'  => isset($body->webiinar_date) ? $body->webiinar_date : null,
300
+			)
301 301
 
302
-        ));
302
+		));
303 303
         
304
-        return $response;
305
-    }
304
+		return $response;
305
+	}
306 306
     
307
-    public static function purchaseUserLicense($body)
308
-    {
309
-        $response = Route4Me::makeRequst(array(
310
-            'url'    => Endpoint::USER_LICENSE,
311
-            'method' => 'POST',
312
-            'query'  => array(
313
-                'device_id'         => isset($body->device_id) ? $body->device_id : null
314
-            ),
315
-            'body'   => array(
316
-                'member_id'         => isset($body->member_id) ? $body->member_id : null,
317
-                'session_guid'      => isset($body->session_guid) ? $body->session_guid : null,
318
-                'device_id'         => isset($body->device_id) ? $body->device_id : null,
319
-                'device_type'       => isset($body->device_type) ? $body->device_type : null,
320
-                'subscription_name' => isset($body->subscription_name) ? $body->subscription_name : null,
321
-                'token'             => isset($body->token) ? $body->token : null,
322
-                'payload'           => isset($body->payload) ? $body->payload : null,
323
-                'format'            => isset($body->format) ? $body->format : null,
324
-            )
325
-        ));
307
+	public static function purchaseUserLicense($body)
308
+	{
309
+		$response = Route4Me::makeRequst(array(
310
+			'url'    => Endpoint::USER_LICENSE,
311
+			'method' => 'POST',
312
+			'query'  => array(
313
+				'device_id'         => isset($body->device_id) ? $body->device_id : null
314
+			),
315
+			'body'   => array(
316
+				'member_id'         => isset($body->member_id) ? $body->member_id : null,
317
+				'session_guid'      => isset($body->session_guid) ? $body->session_guid : null,
318
+				'device_id'         => isset($body->device_id) ? $body->device_id : null,
319
+				'device_type'       => isset($body->device_type) ? $body->device_type : null,
320
+				'subscription_name' => isset($body->subscription_name) ? $body->subscription_name : null,
321
+				'token'             => isset($body->token) ? $body->token : null,
322
+				'payload'           => isset($body->payload) ? $body->payload : null,
323
+				'format'            => isset($body->format) ? $body->format : null,
324
+			)
325
+		));
326 326
         
327
-        return $response;
328
-    }
327
+		return $response;
328
+	}
329 329
     
330
-    public static function newMemberConfigKey($body)
331
-    {
332
-        $response = Route4Me::makeRequst(array(
333
-            'url'    => Endpoint::CONFIGURATION_SETTINGS,
334
-            'method' => 'POST',
335
-            'body'   => array(
336
-                'config_key'   => isset($body->config_key) ? $body->config_key : null,
337
-                'config_value' => isset($body->config_value) ? $body->config_value : null
338
-            )
339
-        ));
330
+	public static function newMemberConfigKey($body)
331
+	{
332
+		$response = Route4Me::makeRequst(array(
333
+			'url'    => Endpoint::CONFIGURATION_SETTINGS,
334
+			'method' => 'POST',
335
+			'body'   => array(
336
+				'config_key'   => isset($body->config_key) ? $body->config_key : null,
337
+				'config_value' => isset($body->config_value) ? $body->config_value : null
338
+			)
339
+		));
340 340
         
341
-        return $response;
342
-    }
341
+		return $response;
342
+	}
343 343
     
344
-    public static function removeMemberConfigKey($body)
345
-    {
346
-        $response = Route4Me::makeRequst(array(
347
-            'url'    => Endpoint::CONFIGURATION_SETTINGS,
348
-            'method' => 'DELETE',
349
-            'body'   => array(
350
-                'config_key' =>  isset($body->config_key) ? $body->config_key : null
351
-            )
352
-        ));
344
+	public static function removeMemberConfigKey($body)
345
+	{
346
+		$response = Route4Me::makeRequst(array(
347
+			'url'    => Endpoint::CONFIGURATION_SETTINGS,
348
+			'method' => 'DELETE',
349
+			'body'   => array(
350
+				'config_key' =>  isset($body->config_key) ? $body->config_key : null
351
+			)
352
+		));
353 353
         
354
-        return $response;
355
-    }
354
+		return $response;
355
+	}
356 356
     
357
-    public static function getMemberConfigData($body)
358
-    {
359
-        $response = Route4Me::makeRequst(array(
360
-            'url'    => Endpoint::CONFIGURATION_SETTINGS,
361
-            'method' => 'GET',
362
-            'query'  => array(
363
-                'config_key' =>  isset($body->config_key) ? $body->config_key : null
364
-            )
365
-        ));
357
+	public static function getMemberConfigData($body)
358
+	{
359
+		$response = Route4Me::makeRequst(array(
360
+			'url'    => Endpoint::CONFIGURATION_SETTINGS,
361
+			'method' => 'GET',
362
+			'query'  => array(
363
+				'config_key' =>  isset($body->config_key) ? $body->config_key : null
364
+			)
365
+		));
366 366
         
367
-        return $response;
368
-    }
367
+		return $response;
368
+	}
369 369
 
370
-    public static function updateMemberConfigKey($body)
371
-    {
372
-        $response = Route4Me::makeRequst(array(
373
-            'url'    => Endpoint::CONFIGURATION_SETTINGS,
374
-            'method' => 'PUT',
375
-            'body'   => array(
376
-                'config_key'   => isset($body->config_key) ? $body->config_key : null,
377
-                'config_value' => isset($body->config_value) ? $body->config_value : null
378
-            )
379
-        ));
370
+	public static function updateMemberConfigKey($body)
371
+	{
372
+		$response = Route4Me::makeRequst(array(
373
+			'url'    => Endpoint::CONFIGURATION_SETTINGS,
374
+			'method' => 'PUT',
375
+			'body'   => array(
376
+				'config_key'   => isset($body->config_key) ? $body->config_key : null,
377
+				'config_value' => isset($body->config_value) ? $body->config_value : null
378
+			)
379
+		));
380 380
         
381
-        return $response;
382
-    }
381
+		return $response;
382
+	}
383 383
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
     
66 66
     public static function fromArray(array $params) 
67 67
     {
68
-        $member= new Member();
68
+        $member = new Member();
69 69
         
70
-        foreach($params as $key => $value) {
70
+        foreach ($params as $key => $value) {
71 71
             if (property_exists($member, $key)) {
72 72
                 $member->{$key} = $value;
73 73
             }
@@ -118,13 +118,13 @@  discard block
 block discarded – undo
118 118
             'url'    => Endpoint::VERIFY_DEVICE_LICENSE,
119 119
             'method' => 'POST',
120 120
             'query'  => array(
121
-                'device_id'   => isset($body->device_id)   ? $body->device_id : null,
121
+                'device_id'   => isset($body->device_id) ? $body->device_id : null,
122 122
                 'device_type' => isset($body->device_type) ? $body->device_type : null,
123 123
             ),
124 124
             'body'   => array(
125
-                'device_id'   => isset($body->device_id)   ? $body->device_id : null,
125
+                'device_id'   => isset($body->device_id) ? $body->device_id : null,
126 126
                 'device_type' => isset($body->device_type) ? $body->device_type : null,
127
-                'format'      => isset($body->format)      ? $body->format : null
127
+                'format'      => isset($body->format) ? $body->format : null
128 128
             )
129 129
 
130 130
         ));
@@ -170,13 +170,13 @@  discard block
 block discarded – undo
170 170
         
171 171
         foreach ($members['results'] as $memb) {
172 172
             if (isset($memb['member_id']) && isset($memb['member_type'])) {
173
-                if ($memberType==$memb['member_type']) $memberIDs[]=$memb['member_id'];
173
+                if ($memberType==$memb['member_type']) $memberIDs[] = $memb['member_id'];
174 174
             }
175 175
         }
176 176
         
177 177
         if (sizeof($memberIDs)<1) return null;
178 178
         
179
-        $randomIndex = rand(0, sizeof($memberIDs)-1);
179
+        $randomIndex = rand(0, sizeof($memberIDs) - 1);
180 180
         
181 181
         return $memberIDs[$randomIndex];
182 182
     }
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -163,18 +163,26 @@
 block discarded – undo
163 163
     {
164 164
         $members = self::getUsers();
165 165
         
166
-        if (is_null($members)) return null;
167
-        if (!isset($members['results'])) return null;
166
+        if (is_null($members)) {
167
+        	return null;
168
+        }
169
+        if (!isset($members['results'])) {
170
+        	return null;
171
+        }
168 172
         
169 173
         $memberIDs = array();
170 174
         
171 175
         foreach ($members['results'] as $memb) {
172 176
             if (isset($memb['member_id']) && isset($memb['member_type'])) {
173
-                if ($memberType==$memb['member_type']) $memberIDs[]=$memb['member_id'];
177
+                if ($memberType==$memb['member_type']) {
178
+                	$memberIDs[]=$memb['member_id'];
179
+                }
174 180
             }
175 181
         }
176 182
         
177
-        if (sizeof($memberIDs)<1) return null;
183
+        if (sizeof($memberIDs)<1) {
184
+        	return null;
185
+        }
178 186
         
179 187
         $randomIndex = rand(0, sizeof($memberIDs)-1);
180 188
         
Please login to merge, or discard this patch.
src/Route4Me/AvoidanceZone.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 
8 8
 class AvoidanceZone extends Common
9 9
 {
10
-    public $territory_id;  // Avoidance zone id
10
+    public $territory_id; // Avoidance zone id
11 11
     public $territory_name; 
12 12
     public $territory_color;
13 13
     public $orders;
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         
31 31
         $avoidanceZoneParameters = new AvoidanceZone();
32 32
         
33
-        foreach($params as $key => $value) {
33
+        foreach ($params as $key => $value) {
34 34
             if (property_exists($avoidanceZoneParameters, $key)) {
35 35
                 $avoidanceZoneParameters->{$key} = $value;
36 36
             }
Please login to merge, or discard this patch.
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -7,107 +7,107 @@
 block discarded – undo
7 7
 
8 8
 class AvoidanceZone extends Common
9 9
 {
10
-    public $territory_id;  // Avoidance zone id
11
-    public $territory_name; 
12
-    public $territory_color;
13
-    public $orders;
14
-    public $member_id;
15
-    public $territory; // Territory parameters
10
+	public $territory_id;  // Avoidance zone id
11
+	public $territory_name; 
12
+	public $territory_color;
13
+	public $orders;
14
+	public $member_id;
15
+	public $territory; // Territory parameters
16 16
     
17
-    public static function fromArray(array $params) 
18
-    {
19
-        if (!isset($params['territory_name'])) {
20
-            throw new BadParam('Territory name must be provided');
21
-        }
17
+	public static function fromArray(array $params) 
18
+	{
19
+		if (!isset($params['territory_name'])) {
20
+			throw new BadParam('Territory name must be provided');
21
+		}
22 22
         
23
-        if (!isset($params['territory_color'])) {
24
-            throw new BadParam('Territory color must be provided');
25
-        }
23
+		if (!isset($params['territory_color'])) {
24
+			throw new BadParam('Territory color must be provided');
25
+		}
26 26
         
27
-        if (!isset($params['territory'])) {
28
-            throw new BadParam('Territory must be provided');
29
-        }
27
+		if (!isset($params['territory'])) {
28
+			throw new BadParam('Territory must be provided');
29
+		}
30 30
         
31
-        $avoidanceZoneParameters = new AvoidanceZone();
31
+		$avoidanceZoneParameters = new AvoidanceZone();
32 32
         
33
-        foreach($params as $key => $value) {
34
-            if (property_exists($avoidanceZoneParameters, $key)) {
35
-                $avoidanceZoneParameters->{$key} = $value;
36
-            }
37
-        }
33
+		foreach($params as $key => $value) {
34
+			if (property_exists($avoidanceZoneParameters, $key)) {
35
+				$avoidanceZoneParameters->{$key} = $value;
36
+			}
37
+		}
38 38
         
39
-        return $avoidanceZoneParameters;
40
-    }
39
+		return $avoidanceZoneParameters;
40
+	}
41 41
     
42
-    public static function getAvoidanceZone($territory_id)
43
-    {
44
-        $avoidanceZone = Route4Me::makeRequst(array(
45
-            'url'    => Endpoint::AVOIDANCE_ZONE,
46
-            'method' => 'GET',
47
-            'query'  => array(
48
-                'territory_id' => $territory_id
49
-            )
50
-        ));
42
+	public static function getAvoidanceZone($territory_id)
43
+	{
44
+		$avoidanceZone = Route4Me::makeRequst(array(
45
+			'url'    => Endpoint::AVOIDANCE_ZONE,
46
+			'method' => 'GET',
47
+			'query'  => array(
48
+				'territory_id' => $territory_id
49
+			)
50
+		));
51 51
 
52
-        return $avoidanceZone;
53
-    }
52
+		return $avoidanceZone;
53
+	}
54 54
     
55
-    public static function getAvoidanceZones($params)
56
-    {
57
-        $avoidanceZones = Route4Me::makeRequst(array(
58
-            'url'    => Endpoint::AVOIDANCE_ZONE,
59
-            'method' => 'GET',
60
-            'query'  => array(
61
-                'offset'  => isset($params->offset) ? $params->offset : null,
62
-                'limit'   => isset($params->limit) ? $params->limit : null,
63
-            )
64
-        ));
55
+	public static function getAvoidanceZones($params)
56
+	{
57
+		$avoidanceZones = Route4Me::makeRequst(array(
58
+			'url'    => Endpoint::AVOIDANCE_ZONE,
59
+			'method' => 'GET',
60
+			'query'  => array(
61
+				'offset'  => isset($params->offset) ? $params->offset : null,
62
+				'limit'   => isset($params->limit) ? $params->limit : null,
63
+			)
64
+		));
65 65
 
66
-        return $avoidanceZones;
67
-    }
66
+		return $avoidanceZones;
67
+	}
68 68
 
69
-    public static function addAvoidanceZone($params)
70
-    {
71
-        $terParams = array();
69
+	public static function addAvoidanceZone($params)
70
+	{
71
+		$terParams = array();
72 72
 
73
-        if (isset($params->territory['type'])) $terParams['type'] = $params->territory['type'];
74
-        if (isset($params->territory['data'])) $terParams['data'] = $params->territory['data'];
73
+		if (isset($params->territory['type'])) $terParams['type'] = $params->territory['type'];
74
+		if (isset($params->territory['data'])) $terParams['data'] = $params->territory['data'];
75 75
 
76
-        $abContacts = Route4Me::makeRequst(array(
77
-            'url'    => Endpoint::AVOIDANCE_ZONE,
78
-            'method' => 'POST',
79
-            'body'  => array(
80
-                'territory_name'  => isset($params->territory_name) ? $params->territory_name : null,
81
-                'territory_color' => isset($params->territory_color) ? $params->territory_color : null,
82
-                'territory'       => $terParams
83
-            )
84
-        ));
76
+		$abContacts = Route4Me::makeRequst(array(
77
+			'url'    => Endpoint::AVOIDANCE_ZONE,
78
+			'method' => 'POST',
79
+			'body'  => array(
80
+				'territory_name'  => isset($params->territory_name) ? $params->territory_name : null,
81
+				'territory_color' => isset($params->territory_color) ? $params->territory_color : null,
82
+				'territory'       => $terParams
83
+			)
84
+		));
85 85
 
86
-        return $abContacts;
87
-    }
86
+		return $abContacts;
87
+	}
88 88
     
89
-    public function deleteAvoidanceZone($territory_id)
90
-    {
91
-        $result = Route4Me::makeRequst(array(
92
-            'url'    => Endpoint::AVOIDANCE_ZONE,
93
-            'method' => 'DELETEARRAY',
94
-            'query'  => array(
95
-                'territory_id' => $territory_id
96
-            )
97
-        ));
89
+	public function deleteAvoidanceZone($territory_id)
90
+	{
91
+		$result = Route4Me::makeRequst(array(
92
+			'url'    => Endpoint::AVOIDANCE_ZONE,
93
+			'method' => 'DELETEARRAY',
94
+			'query'  => array(
95
+				'territory_id' => $territory_id
96
+			)
97
+		));
98 98
 
99
-        return $result;
100
-    }
99
+		return $result;
100
+	}
101 101
     
102
-    public function updateAvoidanceZone($params)
103
-    {
104
-        $avoidanceZone = Route4Me::makeRequst(array(
105
-            'url'    => Endpoint::AVOIDANCE_ZONE,
106
-            'method' => 'PUT',
107
-            'body'   => $params,
102
+	public function updateAvoidanceZone($params)
103
+	{
104
+		$avoidanceZone = Route4Me::makeRequst(array(
105
+			'url'    => Endpoint::AVOIDANCE_ZONE,
106
+			'method' => 'PUT',
107
+			'body'   => $params,
108 108
 
109
-        ));
109
+		));
110 110
 
111
-        return $avoidanceZone;
112
-    }
111
+		return $avoidanceZone;
112
+	}
113 113
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,8 +70,12 @@
 block discarded – undo
70 70
     {
71 71
         $terParams = array();
72 72
 
73
-        if (isset($params->territory['type'])) $terParams['type'] = $params->territory['type'];
74
-        if (isset($params->territory['data'])) $terParams['data'] = $params->territory['data'];
73
+        if (isset($params->territory['type'])) {
74
+        	$terParams['type'] = $params->territory['type'];
75
+        }
76
+        if (isset($params->territory['data'])) {
77
+        	$terParams['data'] = $params->territory['data'];
78
+        }
75 79
 
76 80
         $abContacts = Route4Me::makeRequst(array(
77 81
             'url'    => Endpoint::AVOIDANCE_ZONE,
Please login to merge, or discard this patch.
src/Route4Me/Address.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Route4Me;
3 3
 
4
-use Route4Me\Exception\BadParam;
5 4
 use Route4Me\Route4Me;
6 5
 use Route4Me\Common;
7 6
 use Route4Me\Enum\Endpoint;
Please login to merge, or discard this patch.
Indentation   +274 added lines, -274 removed lines patch added patch discarded remove patch
@@ -8,315 +8,315 @@
 block discarded – undo
8 8
 
9 9
 class Address extends Common
10 10
 {
11
-    public $route_destination_id;
12
-    public $alias;
13
-    public $member_id;
14
-    public $address;
15
-    public $addressUpdate;
16
-    public $is_depot = false;
17
-    public $lat;
18
-    public $lng;
19
-    public $route_id;
20
-    public $original_route_id;
21
-    public $optimization_problem_id;
22
-    public $sequence_no;
23
-    public $geocoded;
24
-    public $preferred_geocoding;
25
-    public $failed_geocoding;
26
-    public $geocodings = array();
27
-    public $contact_id;
28
-    public $is_visited;
29
-    public $customer_po;
30
-    public $invoice_no;
31
-    public $reference_no;
32
-    public $order_no;
33
-    public $weight;
34
-    public $cost;
35
-    public $revenue;
36
-    public $cube;
37
-    public $pieces;
38
-    public $email;
39
-    public $phone;
40
-    public $tracking_number;
41
-    public $destination_note_count;
42
-    public $drive_time_to_next_destination;
43
-    public $distance_to_next_destination;
44
-    public $generated_time_window_start;
45
-    public $generated_time_window_end;
46
-    public $time_window_start;
47
-    public $time_window_end;
48
-    public $time;
49
-    public $notes;
50
-    public $timestamp_last_visited;
51
-    public $custom_fields = array();
52
-    public $manifest = array();
11
+	public $route_destination_id;
12
+	public $alias;
13
+	public $member_id;
14
+	public $address;
15
+	public $addressUpdate;
16
+	public $is_depot = false;
17
+	public $lat;
18
+	public $lng;
19
+	public $route_id;
20
+	public $original_route_id;
21
+	public $optimization_problem_id;
22
+	public $sequence_no;
23
+	public $geocoded;
24
+	public $preferred_geocoding;
25
+	public $failed_geocoding;
26
+	public $geocodings = array();
27
+	public $contact_id;
28
+	public $is_visited;
29
+	public $customer_po;
30
+	public $invoice_no;
31
+	public $reference_no;
32
+	public $order_no;
33
+	public $weight;
34
+	public $cost;
35
+	public $revenue;
36
+	public $cube;
37
+	public $pieces;
38
+	public $email;
39
+	public $phone;
40
+	public $tracking_number;
41
+	public $destination_note_count;
42
+	public $drive_time_to_next_destination;
43
+	public $distance_to_next_destination;
44
+	public $generated_time_window_start;
45
+	public $generated_time_window_end;
46
+	public $time_window_start;
47
+	public $time_window_end;
48
+	public $time;
49
+	public $notes;
50
+	public $timestamp_last_visited;
51
+	public $custom_fields = array();
52
+	public $manifest = array();
53 53
     
54
-    public $first_name;
55
-    public $last_name;
56
-    public $is_departed;
57
-    public $timestamp_last_departed;
58
-    public $order_id;
59
-    public $priority;
60
-    public $curbside_lat;
61
-    public $curbside_lng;
62
-    public $time_window_start_2;
63
-    public $time_window_end_2;
54
+	public $first_name;
55
+	public $last_name;
56
+	public $is_departed;
57
+	public $timestamp_last_departed;
58
+	public $order_id;
59
+	public $priority;
60
+	public $curbside_lat;
61
+	public $curbside_lng;
62
+	public $time_window_start_2;
63
+	public $time_window_end_2;
64 64
 
65
-    public static function fromArray(array $params)
66
-    {
67
-        $address = new Address();
68
-        foreach ($params as $key => $value) {
69
-            if (property_exists($address, $key)) {
70
-                $address->{$key} = $value;
71
-            }
72
-        }
65
+	public static function fromArray(array $params)
66
+	{
67
+		$address = new Address();
68
+		foreach ($params as $key => $value) {
69
+			if (property_exists($address, $key)) {
70
+				$address->{$key} = $value;
71
+			}
72
+		}
73 73
         
74
-        return $address;
75
-    }
74
+		return $address;
75
+	}
76 76
 
77
-    public static function getAddress($routeId, $addressId)
78
-    {
79
-        $address = Route4Me::makeRequst(array(
80
-            'url'    => Endpoint::ADDRESS_V4,
81
-            'method' => 'GET',
82
-            'query'  => array(
83
-                'route_id'             => $routeId,
84
-                'route_destination_id' => $addressId,
85
-            )
86
-        ));
77
+	public static function getAddress($routeId, $addressId)
78
+	{
79
+		$address = Route4Me::makeRequst(array(
80
+			'url'    => Endpoint::ADDRESS_V4,
81
+			'method' => 'GET',
82
+			'query'  => array(
83
+				'route_id'             => $routeId,
84
+				'route_destination_id' => $addressId,
85
+			)
86
+		));
87 87
     
88
-        return Address::fromArray($address);
89
-    }
88
+		return Address::fromArray($address);
89
+	}
90 90
     
91
-    /*Get notes from the specified route destination
91
+	/*Get notes from the specified route destination
92 92
      * Returns an address object with notes, if an address exists, otherwise - return null.
93 93
      */
94
-    public static function GetAddressesNotes($noteParams)
95
-    {
96
-        $address = Route4Me::makeRequst(array(
97
-            'url'    => Endpoint::ADDRESS_V4,
98
-            'method' => 'GET',
99
-            'query'  => array(
100
-                'route_id'             => isset($noteParams['route_id']) ? $noteParams['route_id'] : null, 
101
-                'route_destination_id' => isset($noteParams['route_destination_id']) 
102
-                                             ? $noteParams['route_destination_id'] : null,
103
-                'notes'                => 1,
104
-            )
105
-        ));
94
+	public static function GetAddressesNotes($noteParams)
95
+	{
96
+		$address = Route4Me::makeRequst(array(
97
+			'url'    => Endpoint::ADDRESS_V4,
98
+			'method' => 'GET',
99
+			'query'  => array(
100
+				'route_id'             => isset($noteParams['route_id']) ? $noteParams['route_id'] : null, 
101
+				'route_destination_id' => isset($noteParams['route_destination_id']) 
102
+											 ? $noteParams['route_destination_id'] : null,
103
+				'notes'                => 1,
104
+			)
105
+		));
106 106
     
107
-        return $address;
108
-    }
107
+		return $address;
108
+	}
109 109
 
110
-    public function update()
111
-    {
112
-        $addressUpdate = Route4Me::makeRequst(array(
113
-            'url'    => Endpoint::ADDRESS_V4,
114
-            'method' => 'PUT',
115
-            'body'   => $this->toArray(),
116
-            'query'  => array(
117
-                'route_id'             => $this->route_id,
118
-                'route_destination_id' => $this->route_destination_id,
119
-            ),
120
-        ));
110
+	public function update()
111
+	{
112
+		$addressUpdate = Route4Me::makeRequst(array(
113
+			'url'    => Endpoint::ADDRESS_V4,
114
+			'method' => 'PUT',
115
+			'body'   => $this->toArray(),
116
+			'query'  => array(
117
+				'route_id'             => $this->route_id,
118
+				'route_destination_id' => $this->route_destination_id,
119
+			),
120
+		));
121 121
     
122
-        return Address::fromArray($addressUpdate);
123
-    }
122
+		return Address::fromArray($addressUpdate);
123
+	}
124 124
     
125
-    public function markAddress($params, $body)
126
-    {
127
-        $result = Route4Me::makeRequst(array(
128
-            'url'    => Endpoint::ADDRESS_V4,
129
-            'method' => 'PUT',
130
-            'query'  => array(
131
-                'route_id'             => isset($params['route_id']) ? $params['route_id'] : null, 
132
-                'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
133
-            ),
134
-            'body'   => $body
135
-        ));
125
+	public function markAddress($params, $body)
126
+	{
127
+		$result = Route4Me::makeRequst(array(
128
+			'url'    => Endpoint::ADDRESS_V4,
129
+			'method' => 'PUT',
130
+			'query'  => array(
131
+				'route_id'             => isset($params['route_id']) ? $params['route_id'] : null, 
132
+				'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
133
+			),
134
+			'body'   => $body
135
+		));
136 136
     
137
-        return $result;
138
-    }
137
+		return $result;
138
+	}
139 139
     
140
-    public function markAsDeparted($params)
141
-    {
142
-        $address = Route4Me::makeRequst(array(
143
-            'url'    => Endpoint::MARK_ADDRESS_DEPARTED,
144
-            'method' => 'GET',
145
-            'query'  => array(
146
-                'route_id'     => isset($params['route_id']) ? $params['route_id'] : null,
147
-                'address_id'   => isset($params['address_id']) ? $params['address_id'] : null,
148
-                'is_departed'  => isset($params['is_departed']) ? $params['is_departed'] : null,
149
-                'member_id'    => isset($params['member_id']) ? $params['member_id'] : null,
150
-            ),
151
-        ));
140
+	public function markAsDeparted($params)
141
+	{
142
+		$address = Route4Me::makeRequst(array(
143
+			'url'    => Endpoint::MARK_ADDRESS_DEPARTED,
144
+			'method' => 'GET',
145
+			'query'  => array(
146
+				'route_id'     => isset($params['route_id']) ? $params['route_id'] : null,
147
+				'address_id'   => isset($params['address_id']) ? $params['address_id'] : null,
148
+				'is_departed'  => isset($params['is_departed']) ? $params['is_departed'] : null,
149
+				'member_id'    => isset($params['member_id']) ? $params['member_id'] : null,
150
+			),
151
+		));
152 152
     
153
-        return $address;
154
-    }
153
+		return $address;
154
+	}
155 155
     
156
-    public function markAsVisited($params)
157
-    {
158
-        $address = Route4Me::makeRequst(array(
159
-            'url'    => Endpoint::UPDATE_ADDRESS_VISITED,
160
-            'method' => 'GET',
161
-            'query'  => array(
162
-                'route_id'   => isset($params['route_id']) ? $params['route_id'] : null,
163
-                'address_id' => isset($params['address_id']) ? $params['address_id'] : null,
164
-                'member_id'  => isset($params['member_id']) ? $params['member_id'] : null,
165
-            ),
166
-            'body'  =>  array(
167
-                'is_visited' => isset($params['is_visited']) ? $params['is_visited'] : null
168
-            )
169
-        ));
156
+	public function markAsVisited($params)
157
+	{
158
+		$address = Route4Me::makeRequst(array(
159
+			'url'    => Endpoint::UPDATE_ADDRESS_VISITED,
160
+			'method' => 'GET',
161
+			'query'  => array(
162
+				'route_id'   => isset($params['route_id']) ? $params['route_id'] : null,
163
+				'address_id' => isset($params['address_id']) ? $params['address_id'] : null,
164
+				'member_id'  => isset($params['member_id']) ? $params['member_id'] : null,
165
+			),
166
+			'body'  =>  array(
167
+				'is_visited' => isset($params['is_visited']) ? $params['is_visited'] : null
168
+			)
169
+		));
170 170
     
171
-        return $address;
172
-    }
171
+		return $address;
172
+	}
173 173
 
174
-    public function delete()
175
-    {
176
-        $address = Route4Me::makeRequst(array(
177
-            'url'    => Endpoint::ADDRESS_V4,
178
-            'method' => 'DELETE',
179
-            'query'  => array(
180
-                'route_id'             => $this->route_id,
181
-                'route_destination_id' => $this->route_destination_id,
182
-            )
183
-        ));
174
+	public function delete()
175
+	{
176
+		$address = Route4Me::makeRequst(array(
177
+			'url'    => Endpoint::ADDRESS_V4,
178
+			'method' => 'DELETE',
179
+			'query'  => array(
180
+				'route_id'             => $this->route_id,
181
+				'route_destination_id' => $this->route_destination_id,
182
+			)
183
+		));
184 184
     
185
-        return (bool)$address['deleted'];
186
-    }
185
+		return (bool)$address['deleted'];
186
+	}
187 187
     
188
-    public function moveDestinationToRoute($params)
189
-    {
190
-        $result = Route4Me::makeRequst(array(
191
-            'url'    => Endpoint::MOVE_ROUTE_DESTINATION,
192
-            'method' => 'POST',
193
-            'body'  => array(
194
-                'to_route_id'          => isset($params['to_route_id']) ? $params['to_route_id'] : null,
195
-                'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
196
-                'after_destination_id' => isset($params['after_destination_id']) ? $params['after_destination_id'] : null
197
-            ),
198
-            'HTTPHEADER'  => 'Content-Type: multipart/form-data'
199
-        ));
188
+	public function moveDestinationToRoute($params)
189
+	{
190
+		$result = Route4Me::makeRequst(array(
191
+			'url'    => Endpoint::MOVE_ROUTE_DESTINATION,
192
+			'method' => 'POST',
193
+			'body'  => array(
194
+				'to_route_id'          => isset($params['to_route_id']) ? $params['to_route_id'] : null,
195
+				'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
196
+				'after_destination_id' => isset($params['after_destination_id']) ? $params['after_destination_id'] : null
197
+			),
198
+			'HTTPHEADER'  => 'Content-Type: multipart/form-data'
199
+		));
200 200
 
201
-        return $result;
202
-    }
201
+		return $result;
202
+	}
203 203
     
204
-    public function AddAddressNote($params)
205
-    {
206
-        $result = Route4Me::makeRequst(array(
207
-            'url'    => Endpoint::ROUTE_NOTES_ADD,
208
-            'method' => 'POST',
209
-            'query'  => array(
210
-                'route_id'     =>  isset($params['route_id']) ? $params['route_id'] : null,
211
-                'address_id'   =>  isset($params['address_id']) ? $params['address_id'] : null,
212
-                'dev_lat'      =>  isset($params['dev_lat']) ? $params['dev_lat'] : null,
213
-                'dev_lng'      =>  isset($params['dev_lng']) ? $params['dev_lng'] : null,
214
-                'device_type'  =>  isset($params['device_type']) ? $params['device_type'] : null
215
-            ),
216
-            'body'  => array(
217
-                'strNoteContents' => isset($params['strNoteContents']) ? $params['strNoteContents'] : null,
218
-                'strUpdateType'   => isset($params['strUpdateType']) ? $params['strUpdateType'] : null
219
-            ),
220
-            'HTTPHEADER'  => 'Content-Type: multipart/form-data'
221
-        ));
204
+	public function AddAddressNote($params)
205
+	{
206
+		$result = Route4Me::makeRequst(array(
207
+			'url'    => Endpoint::ROUTE_NOTES_ADD,
208
+			'method' => 'POST',
209
+			'query'  => array(
210
+				'route_id'     =>  isset($params['route_id']) ? $params['route_id'] : null,
211
+				'address_id'   =>  isset($params['address_id']) ? $params['address_id'] : null,
212
+				'dev_lat'      =>  isset($params['dev_lat']) ? $params['dev_lat'] : null,
213
+				'dev_lng'      =>  isset($params['dev_lng']) ? $params['dev_lng'] : null,
214
+				'device_type'  =>  isset($params['device_type']) ? $params['device_type'] : null
215
+			),
216
+			'body'  => array(
217
+				'strNoteContents' => isset($params['strNoteContents']) ? $params['strNoteContents'] : null,
218
+				'strUpdateType'   => isset($params['strUpdateType']) ? $params['strUpdateType'] : null
219
+			),
220
+			'HTTPHEADER'  => 'Content-Type: multipart/form-data'
221
+		));
222 222
 
223
-        return $result;
224
-    }
223
+		return $result;
224
+	}
225 225
 
226
-    public function AddNoteFile($params)
227
-    {
228
-        $result = Route4Me::fileUploadRequest(array(
229
-            'url'    => Endpoint::ROUTE_NOTES_ADD,
230
-            'method' => 'POST',
231
-            'query'  => array(
232
-                'route_id'      =>  isset($params['route_id']) ? $params['route_id'] : null,
233
-                'address_id'    =>  isset($params['address_id']) ? $params['address_id'] : null,
234
-                'dev_lat'       =>  isset($params['dev_lat']) ? $params['dev_lat'] : null,
235
-                'dev_lng'       =>  isset($params['dev_lng']) ? $params['dev_lng'] : null,
236
-                'device_type'   =>  isset($params['device_type']) ? $params['device_type'] : null,
237
-                'strUpdateType' =>  isset($params['strUpdateType']) ? $params['strUpdateType'] : null
238
-            ),
239
-            'body'  => array(
240
-                'strFilename' => isset($params['strFilename']) ? $params['strFilename'] : null
241
-            ),
242
-            'HTTPHEADER'  => 'Content-Type: multipart/form-data'
243
-        ));
226
+	public function AddNoteFile($params)
227
+	{
228
+		$result = Route4Me::fileUploadRequest(array(
229
+			'url'    => Endpoint::ROUTE_NOTES_ADD,
230
+			'method' => 'POST',
231
+			'query'  => array(
232
+				'route_id'      =>  isset($params['route_id']) ? $params['route_id'] : null,
233
+				'address_id'    =>  isset($params['address_id']) ? $params['address_id'] : null,
234
+				'dev_lat'       =>  isset($params['dev_lat']) ? $params['dev_lat'] : null,
235
+				'dev_lng'       =>  isset($params['dev_lng']) ? $params['dev_lng'] : null,
236
+				'device_type'   =>  isset($params['device_type']) ? $params['device_type'] : null,
237
+				'strUpdateType' =>  isset($params['strUpdateType']) ? $params['strUpdateType'] : null
238
+			),
239
+			'body'  => array(
240
+				'strFilename' => isset($params['strFilename']) ? $params['strFilename'] : null
241
+			),
242
+			'HTTPHEADER'  => 'Content-Type: multipart/form-data'
243
+		));
244 244
 
245
-        return $result;
246
-    }
245
+		return $result;
246
+	}
247 247
 
248
-    public function createCustomNoteType($params)
249
-    {
250
-        $result = Route4Me::makeRequst(array(
251
-            'url'    => Endpoint::NOTE_CUSTOM_TYPES_V4,
252
-            'method' => 'POST',
253
-            'body'   => array(
254
-                'type'   => isset($params['type']) ? $params['type'] : null,
255
-                'values' => isset($params['values']) ? $params['values'] : null
256
-            )
257
-        ));
248
+	public function createCustomNoteType($params)
249
+	{
250
+		$result = Route4Me::makeRequst(array(
251
+			'url'    => Endpoint::NOTE_CUSTOM_TYPES_V4,
252
+			'method' => 'POST',
253
+			'body'   => array(
254
+				'type'   => isset($params['type']) ? $params['type'] : null,
255
+				'values' => isset($params['values']) ? $params['values'] : null
256
+			)
257
+		));
258 258
 
259
-        return $result;
260
-    }
259
+		return $result;
260
+	}
261 261
     
262
-    public function removeCustomNoteType($params)
263
-    {
264
-        $result = Route4Me::makeRequst(array(
265
-            'url'    => Endpoint::NOTE_CUSTOM_TYPES_V4,
266
-            'method' => 'DELETE',
267
-            'body'   => array(
268
-                'id' => isset($params['id']) ? $params['id'] : null
269
-            )
270
-        ));
262
+	public function removeCustomNoteType($params)
263
+	{
264
+		$result = Route4Me::makeRequst(array(
265
+			'url'    => Endpoint::NOTE_CUSTOM_TYPES_V4,
266
+			'method' => 'DELETE',
267
+			'body'   => array(
268
+				'id' => isset($params['id']) ? $params['id'] : null
269
+			)
270
+		));
271 271
 
272
-        return $result;
273
-    }
272
+		return $result;
273
+	}
274 274
     
275
-    public function getAllCustomNoteTypes()
276
-    {
277
-        $result = Route4Me::makeRequst(array(
278
-            'url'    => Endpoint::NOTE_CUSTOM_TYPES_V4,
279
-            'method' => 'GET'
280
-        ));
275
+	public function getAllCustomNoteTypes()
276
+	{
277
+		$result = Route4Me::makeRequst(array(
278
+			'url'    => Endpoint::NOTE_CUSTOM_TYPES_V4,
279
+			'method' => 'GET'
280
+		));
281 281
 
282
-        return $result;
283
-    }
282
+		return $result;
283
+	}
284 284
     
285
-    public function addCustomNoteToRoute($params)
286
-    {
287
-        $customArray = array();
285
+	public function addCustomNoteToRoute($params)
286
+	{
287
+		$customArray = array();
288 288
         
289
-        foreach ($params as $key => $value) {
290
-            $kpos = strpos($key, "custom_note_type");
289
+		foreach ($params as $key => $value) {
290
+			$kpos = strpos($key, "custom_note_type");
291 291
             
292
-            if ($kpos!==false) {
293
-                $customArray[$key] = $value;
294
-            }
295
-        }
292
+			if ($kpos!==false) {
293
+				$customArray[$key] = $value;
294
+			}
295
+		}
296 296
         
297
-        $result = Route4Me::makeRequst(array(
298
-            'url'    => Endpoint::ROUTE_NOTES_ADD,
299
-            'method' => 'POST',
300
-            'query'  => array(
301
-                'route_id'      =>  isset($params['route_id']) ? $params['route_id'] : null,
302
-                'address_id'    =>  isset($params['address_id']) ? $params['address_id'] : null,
303
-                'format'        =>  isset($params['format']) ? $params['format'] : null,
304
-                'dev_lat'       =>  isset($params['dev_lat']) ? $params['dev_lat'] : null,
305
-                'dev_lng'       =>  isset($params['dev_lng']) ? $params['dev_lng'] : null
306
-            ),
307
-            'body'  => array_merge(array(
308
-                'strUpdateType'   =>  isset($params['strUpdateType']) ? $params['strUpdateType'] : null,
309
-                'strUpdateType'   =>  isset($params['strUpdateType']) ? $params['strUpdateType'] : null,
310
-                'strNoteContents' =>  isset($params['strNoteContents']) ? $params['strNoteContents'] : null
311
-            ), $customArray),
312
-            'HTTPHEADER'  => 'Content-Type: multipart/form-data'
313
-        ));
297
+		$result = Route4Me::makeRequst(array(
298
+			'url'    => Endpoint::ROUTE_NOTES_ADD,
299
+			'method' => 'POST',
300
+			'query'  => array(
301
+				'route_id'      =>  isset($params['route_id']) ? $params['route_id'] : null,
302
+				'address_id'    =>  isset($params['address_id']) ? $params['address_id'] : null,
303
+				'format'        =>  isset($params['format']) ? $params['format'] : null,
304
+				'dev_lat'       =>  isset($params['dev_lat']) ? $params['dev_lat'] : null,
305
+				'dev_lng'       =>  isset($params['dev_lng']) ? $params['dev_lng'] : null
306
+			),
307
+			'body'  => array_merge(array(
308
+				'strUpdateType'   =>  isset($params['strUpdateType']) ? $params['strUpdateType'] : null,
309
+				'strUpdateType'   =>  isset($params['strUpdateType']) ? $params['strUpdateType'] : null,
310
+				'strNoteContents' =>  isset($params['strNoteContents']) ? $params['strNoteContents'] : null
311
+			), $customArray),
312
+			'HTTPHEADER'  => 'Content-Type: multipart/form-data'
313
+		));
314 314
 
315
-        return $result;
316
-    }
315
+		return $result;
316
+	}
317 317
 
318
-    function getAddressId()
319
-    {
320
-        return $this->route_destination_id;
321
-    }
318
+	function getAddressId()
319
+	{
320
+		return $this->route_destination_id;
321
+	}
322 322
 }
Please login to merge, or discard this patch.
src/Route4Me/Route4Me.php 4 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -207,6 +207,7 @@
 block discarded – undo
207 207
 
208 208
     /**
209 209
      * @param $object: JSON object
210
+     * @param \SimpleXMLElement $object
210 211
      */
211 212
     public static function object2array($object)
212 213
     {
Please login to merge, or discard this patch.
Indentation   +284 added lines, -284 removed lines patch added patch discarded remove patch
@@ -7,343 +7,343 @@
 block discarded – undo
7 7
 
8 8
 class Route4Me
9 9
 {
10
-    static public $apiKey;
11
-    static public $baseUrl = Endpoint::BASE_URL;
10
+	static public $apiKey;
11
+	static public $baseUrl = Endpoint::BASE_URL;
12 12
 
13
-    public static function setApiKey($apiKey)
14
-    {
15
-        self::$apiKey = $apiKey;
16
-    }
13
+	public static function setApiKey($apiKey)
14
+	{
15
+		self::$apiKey = $apiKey;
16
+	}
17 17
 
18
-    public static function getApiKey()
19
-    {
20
-        return self::$apiKey;
21
-    }
18
+	public static function getApiKey()
19
+	{
20
+		return self::$apiKey;
21
+	}
22 22
 
23
-    public static function setBaseUrl($baseUrl)
24
-    {
25
-        self::$baseUrl = $baseUrl;
26
-    }
23
+	public static function setBaseUrl($baseUrl)
24
+	{
25
+		self::$baseUrl = $baseUrl;
26
+	}
27 27
 
28
-    public static function getBaseUrl()
29
-    {
30
-        return self::$baseUrl;
31
-    }
28
+	public static function getBaseUrl()
29
+	{
30
+		return self::$baseUrl;
31
+	}
32 32
     
33
-    public static function fileUploadRequest($options) {
34
-        $query = isset($options['query']) ? array_filter($options['query']) : array();
33
+	public static function fileUploadRequest($options) {
34
+		$query = isset($options['query']) ? array_filter($options['query']) : array();
35 35
 
36
-        if (sizeof($query)==0) {
37
-            return null;
36
+		if (sizeof($query)==0) {
37
+			return null;
38 38
             
39
-        }
39
+		}
40 40
         
41
-        $body = isset($options['body']) ? array_filter($options['body']) : null;
41
+		$body = isset($options['body']) ? array_filter($options['body']) : null;
42 42
             
43
-        $fname = isset($body['strFilename']) ? $body['strFilename'] : '';
43
+		$fname = isset($body['strFilename']) ? $body['strFilename'] : '';
44 44
         
45
-        if ($fname=='') {
46
-            return null;  
47
-        } 
45
+		if ($fname=='') {
46
+			return null;  
47
+		} 
48 48
 
49
-        $rpath = function_exists('curl_file_create') ? curl_file_create(realpath($fname)) : '@'.realpath($fname);
49
+		$rpath = function_exists('curl_file_create') ? curl_file_create(realpath($fname)) : '@'.realpath($fname);
50 50
         
51
-        $url = self::$baseUrl.$options['url'].'?'.http_build_query(array_merge(array('api_key' => self::getApiKey()), $query));
51
+		$url = self::$baseUrl.$options['url'].'?'.http_build_query(array_merge(array('api_key' => self::getApiKey()), $query));
52 52
         
53
-        $ch = curl_init($url);
53
+		$ch = curl_init($url);
54 54
         
55
-        $curlOpts = array(
56
-            CURLOPT_POST => true,
57
-            CURLOPT_RETURNTRANSFER => false,
58
-            CURLOPT_TIMEOUT        => 60,
59
-            CURLOPT_FOLLOWLOCATION => true,
60
-            CURLOPT_SSL_VERIFYHOST => FALSE,
61
-            CURLOPT_SSL_VERIFYPEER => FALSE
62
-        );
55
+		$curlOpts = array(
56
+			CURLOPT_POST => true,
57
+			CURLOPT_RETURNTRANSFER => false,
58
+			CURLOPT_TIMEOUT        => 60,
59
+			CURLOPT_FOLLOWLOCATION => true,
60
+			CURLOPT_SSL_VERIFYHOST => FALSE,
61
+			CURLOPT_SSL_VERIFYPEER => FALSE
62
+		);
63 63
         
64
-        curl_setopt_array($ch, $curlOpts);
64
+		curl_setopt_array($ch, $curlOpts);
65 65
         
66
-        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
66
+		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
67 67
         
68
-        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
69
-            "Content-Type: multipart/form-data",
70
-            'Content-Disposition: form-data; name="strFilename"'
71
-        ));
72
-        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
73
-        curl_setopt($ch, CURLOPT_POSTFIELDS, array('strFilename' => $rpath)); 
68
+		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
69
+			"Content-Type: multipart/form-data",
70
+			'Content-Disposition: form-data; name="strFilename"'
71
+		));
72
+		curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
73
+		curl_setopt($ch, CURLOPT_POSTFIELDS, array('strFilename' => $rpath)); 
74 74
         
75
-        $result = curl_exec($ch);
75
+		$result = curl_exec($ch);
76 76
 
77
-        $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
78
-        curl_close($ch);
77
+		$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
78
+		curl_close($ch);
79 79
 
80
-        $json = json_decode($result, true);
80
+		$json = json_decode($result, true);
81 81
         
82
-        if (200==$code) {
83
-            return $json;
84
-        } elseif (isset($json['errors'])) {
85
-            throw new ApiError(implode(', ', $json['errors']));
86
-        } else {
87
-            throw new ApiError('Something wrong');
88
-        }
89
-    }
82
+		if (200==$code) {
83
+			return $json;
84
+		} elseif (isset($json['errors'])) {
85
+			throw new ApiError(implode(', ', $json['errors']));
86
+		} else {
87
+			throw new ApiError('Something wrong');
88
+		}
89
+	}
90 90
 
91
-    public static function makeRequst($options) {
92
-        $errorHandler = new myErrorHandler();
91
+	public static function makeRequst($options) {
92
+		$errorHandler = new myErrorHandler();
93 93
         
94
-        $old_error_handler = set_error_handler(array($errorHandler, "proc_error"));
94
+		$old_error_handler = set_error_handler(array($errorHandler, "proc_error"));
95 95
         
96
-        $method = isset($options['method']) ? $options['method'] : 'GET';
97
-        $query = isset($options['query']) ? array_filter($options['query'], function($x) { return !is_null($x); } ) : array();
96
+		$method = isset($options['method']) ? $options['method'] : 'GET';
97
+		$query = isset($options['query']) ? array_filter($options['query'], function($x) { return !is_null($x); } ) : array();
98 98
 
99
-        $body = isset($options['body']) ? $options['body'] : null;
100
-        $file = isset($options['FILE']) ? $options['FILE'] : null;
101
-        $headers = array(
102
-            "User-Agent: Route4Me php-sdk"
103
-        );
99
+		$body = isset($options['body']) ? $options['body'] : null;
100
+		$file = isset($options['FILE']) ? $options['FILE'] : null;
101
+		$headers = array(
102
+			"User-Agent: Route4Me php-sdk"
103
+		);
104 104
         
105
-        if (isset($options['HTTPHEADER'])) {
106
-            $headers[] = $options['HTTPHEADER'];
107
-        }
105
+		if (isset($options['HTTPHEADER'])) {
106
+			$headers[] = $options['HTTPHEADER'];
107
+		}
108 108
          
109
-        if (isset($options['HTTPHEADERS'])) {
110
-            foreach ($options['HTTPHEADERS'] As $header) {
111
-                $headers[] = $header;
112
-            } 
113
-        }
109
+		if (isset($options['HTTPHEADERS'])) {
110
+			foreach ($options['HTTPHEADERS'] As $header) {
111
+				$headers[] = $header;
112
+			} 
113
+		}
114 114
 
115
-        $ch = curl_init();
115
+		$ch = curl_init();
116 116
         
117
-        $url = $options['url'].'?'.http_build_query(array_merge(
118
-            $query, array('api_key' => self::getApiKey())
119
-        ));
117
+		$url = $options['url'].'?'.http_build_query(array_merge(
118
+			$query, array('api_key' => self::getApiKey())
119
+		));
120 120
 
121
-        $baseUrl = self::getBaseUrl();
121
+		$baseUrl = self::getBaseUrl();
122 122
 
123
-        $curlOpts = arraY(
124
-            CURLOPT_URL            => $baseUrl.$url,
125
-            CURLOPT_RETURNTRANSFER => true,
126
-            CURLOPT_TIMEOUT        => 80,
127
-            CURLOPT_FOLLOWLOCATION => true,
128
-            CURLOPT_SSL_VERIFYHOST => FALSE,
129
-            CURLOPT_SSL_VERIFYPEER => FALSE,
130
-            CURLOPT_HTTPHEADER     => $headers
131
-        );
123
+		$curlOpts = arraY(
124
+			CURLOPT_URL            => $baseUrl.$url,
125
+			CURLOPT_RETURNTRANSFER => true,
126
+			CURLOPT_TIMEOUT        => 80,
127
+			CURLOPT_FOLLOWLOCATION => true,
128
+			CURLOPT_SSL_VERIFYHOST => FALSE,
129
+			CURLOPT_SSL_VERIFYPEER => FALSE,
130
+			CURLOPT_HTTPHEADER     => $headers
131
+		);
132 132
         
133
-        curl_setopt_array($ch, $curlOpts);
133
+		curl_setopt_array($ch, $curlOpts);
134 134
         
135
-        if ($file!=null) {
136
-            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
137
-            $fp=fopen($file, 'r');
138
-            curl_setopt($ch, CURLOPT_INFILE, $fp);
139
-            curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file));
140
-        }
135
+		if ($file!=null) {
136
+			curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
137
+			$fp=fopen($file, 'r');
138
+			curl_setopt($ch, CURLOPT_INFILE, $fp);
139
+			curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file));
140
+		}
141 141
 
142
-        switch ($method) {
143
-        case 'DELETE':
144
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
145
-            break;
146
-        case 'DELETEARRAY':
147
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
148
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
149
-            break;
150
-        case 'PUT':
151
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
152
-            break;
153
-        case 'POST':
154
-           if (isset($body)) {
155
-                $bodyData = json_encode($body);
156
-               if (isset($options['HTTPHEADER'])) {
157
-                  if (strpos($options['HTTPHEADER'], "multipart/form-data")>0) {
158
-                      $bodyData = $body;
159
-                  }
160
-               }
142
+		switch ($method) {
143
+		case 'DELETE':
144
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
145
+			break;
146
+		case 'DELETEARRAY':
147
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
148
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
149
+			break;
150
+		case 'PUT':
151
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
152
+			break;
153
+		case 'POST':
154
+		   if (isset($body)) {
155
+				$bodyData = json_encode($body);
156
+			   if (isset($options['HTTPHEADER'])) {
157
+				  if (strpos($options['HTTPHEADER'], "multipart/form-data")>0) {
158
+					  $bodyData = $body;
159
+				  }
160
+			   }
161 161
                
162
-               curl_setopt($ch, CURLOPT_POSTFIELDS, $bodyData); 
163
-            } 
164
-            break;
165
-        case 'ADD':
166
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
167
-        }
162
+			   curl_setopt($ch, CURLOPT_POSTFIELDS, $bodyData); 
163
+			} 
164
+			break;
165
+		case 'ADD':
166
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
167
+		}
168 168
 
169
-        if (is_numeric(array_search($method, array('DELETE', 'PUT')))) {
170
-            if (isset($body)) {
171
-                curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
172
-            } 
173
-        }
169
+		if (is_numeric(array_search($method, array('DELETE', 'PUT')))) {
170
+			if (isset($body)) {
171
+				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
172
+			} 
173
+		}
174 174
 
175
-        $result = curl_exec($ch);
175
+		$result = curl_exec($ch);
176 176
 
177
-        $isxml = FALSE;
178
-        $jxml = "";
179
-        if (strpos($result, '<?xml')>-1) {
180
-            $xml = simplexml_load_string($result);
181
-            //$jxml = json_encode($xml);
182
-            $jxml = self::object2array($xml);
183
-            $isxml = TRUE;
184
-        }
177
+		$isxml = FALSE;
178
+		$jxml = "";
179
+		if (strpos($result, '<?xml')>-1) {
180
+			$xml = simplexml_load_string($result);
181
+			//$jxml = json_encode($xml);
182
+			$jxml = self::object2array($xml);
183
+			$isxml = TRUE;
184
+		}
185 185
         
186
-        $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
187
-        curl_close($ch);
186
+		$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
187
+		curl_close($ch);
188 188
         
189
-        if (200==$code) {
190
-            if ($isxml) {
191
-                $json = $jxml;
192
-            } else {
193
-                $json = json_decode($result, true);
194
-            }
189
+		if (200==$code) {
190
+			if ($isxml) {
191
+				$json = $jxml;
192
+			} else {
193
+				$json = json_decode($result, true);
194
+			}
195 195
             
196
-            if (isset($json['errors'])) {
197
-                throw new ApiError(implode(', ', $json['errors']));
198
-            } else {
199
-                return $json;
200
-            }
201
-        }  elseif (409==$code) {
202
-            throw new ApiError('Wrong API key');
203
-        } else {
204
-            throw new ApiError('Something wrong');
205
-        }
206
-    }
196
+			if (isset($json['errors'])) {
197
+				throw new ApiError(implode(', ', $json['errors']));
198
+			} else {
199
+				return $json;
200
+			}
201
+		}  elseif (409==$code) {
202
+			throw new ApiError('Wrong API key');
203
+		} else {
204
+			throw new ApiError('Something wrong');
205
+		}
206
+	}
207 207
 
208
-    /**
209
-     * @param $object: JSON object
210
-     */
211
-    public static function object2array($object)
212
-    {
213
-        return @json_decode(@json_encode($object), 1);
214
-    }
208
+	/**
209
+	 * @param $object: JSON object
210
+	 */
211
+	public static function object2array($object)
212
+	{
213
+		return @json_decode(@json_encode($object), 1);
214
+	}
215 215
 
216
-    public static function makeUrlRequst($url, $options) {
217
-        $method = isset($options['method']) ? $options['method'] : 'GET';
218
-        $query = isset($options['query']) ?
219
-            array_filter($options['query'], function($x) { return !is_null($x); } ) : array();
220
-        $body = isset($options['body']) ? $options['body'] : null;
221
-        $ch = curl_init();
216
+	public static function makeUrlRequst($url, $options) {
217
+		$method = isset($options['method']) ? $options['method'] : 'GET';
218
+		$query = isset($options['query']) ?
219
+			array_filter($options['query'], function($x) { return !is_null($x); } ) : array();
220
+		$body = isset($options['body']) ? $options['body'] : null;
221
+		$ch = curl_init();
222 222
         
223
-        $curlOpts = arraY(
224
-            CURLOPT_URL            => $url,
225
-            CURLOPT_RETURNTRANSFER => true,
226
-            CURLOPT_TIMEOUT        => 60,
227
-            CURLOPT_FOLLOWLOCATION => true,
228
-            CURLOPT_SSL_VERIFYHOST => FALSE,
229
-            CURLOPT_SSL_VERIFYPEER => FALSE,
230
-            CURLOPT_HTTPHEADER     => array(
231
-                'User-Agent' => 'Route4Me php-sdk'
232
-            )
233
-        );
223
+		$curlOpts = arraY(
224
+			CURLOPT_URL            => $url,
225
+			CURLOPT_RETURNTRANSFER => true,
226
+			CURLOPT_TIMEOUT        => 60,
227
+			CURLOPT_FOLLOWLOCATION => true,
228
+			CURLOPT_SSL_VERIFYHOST => FALSE,
229
+			CURLOPT_SSL_VERIFYPEER => FALSE,
230
+			CURLOPT_HTTPHEADER     => array(
231
+				'User-Agent' => 'Route4Me php-sdk'
232
+			)
233
+		);
234 234
         
235
-        curl_setopt_array($ch, $curlOpts);
235
+		curl_setopt_array($ch, $curlOpts);
236 236
         
237
-        switch ($method) {
238
-        case 'DELETE':
239
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
240
-            break;
241
-        case 'DELETEARRAY':
242
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
243
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
244
-            break;
245
-        case 'PUT':
246
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
247
-            break;
248
-        case 'POST':
249
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); 
250
-            break;
251
-        case 'ADD':
252
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
253
-        }
237
+		switch ($method) {
238
+		case 'DELETE':
239
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
240
+			break;
241
+		case 'DELETEARRAY':
242
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
243
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
244
+			break;
245
+		case 'PUT':
246
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
247
+			break;
248
+		case 'POST':
249
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); 
250
+			break;
251
+		case 'ADD':
252
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
253
+		}
254 254
         
255
-        if (is_numeric(array_search($method, array('DELETE', 'PUT', 'POST')))) {
256
-            if (isset($body)) {
257
-                curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
258
-            } 
259
-        }
255
+		if (is_numeric(array_search($method, array('DELETE', 'PUT', 'POST')))) {
256
+			if (isset($body)) {
257
+				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
258
+			} 
259
+		}
260 260
 
261
-        $result = curl_exec($ch);
261
+		$result = curl_exec($ch);
262 262
         
263
-        $isxml = FALSE;
264
-        $jxml = "";
263
+		$isxml = FALSE;
264
+		$jxml = "";
265 265
         
266
-        if (strpos($result, '<?xml')>-1) {
267
-            $xml = simplexml_load_string($result);
268
-            $jxml = json_encode($xml);
269
-            $isxml = TRUE;
270
-        }
266
+		if (strpos($result, '<?xml')>-1) {
267
+			$xml = simplexml_load_string($result);
268
+			$jxml = json_encode($xml);
269
+			$isxml = TRUE;
270
+		}
271 271
         
272
-        $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
273
-        curl_close($ch);
272
+		$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
273
+		curl_close($ch);
274 274
         
275
-        if ($isxml) {
276
-            $json = $jxml;
277
-        } else {
278
-            $json = json_decode($result, true);
279
-        }
275
+		if ($isxml) {
276
+			$json = $jxml;
277
+		} else {
278
+			$json = json_decode($result, true);
279
+		}
280 280
         
281
-        if (200==$code) {
282
-            return $json;
283
-        } elseif (isset($json['errors'])) {
284
-            throw new ApiError(implode(', ', $json['errors']));
285
-        } else {
286
-            throw new ApiError('Something wrong');
287
-        }
288
-    }
281
+		if (200==$code) {
282
+			return $json;
283
+		} elseif (isset($json['errors'])) {
284
+			throw new ApiError(implode(', ', $json['errors']));
285
+		} else {
286
+			throw new ApiError('Something wrong');
287
+		}
288
+	}
289 289
     
290
-    /**
291
-     * Prints on the screen main keys and values of the array 
292
-     * @param $results: object to be printed on the screen.
293
-     * @param $deepPrinting: if true, object will be printed recursively.
294
-     */
295
-    public static function simplePrint($results, $deepPrinting = null)
296
-    {
297
-        if (isset($results)) {
298
-            if (is_array($results)) {
299
-                foreach ($results as $key=>$result) {
300
-                    if (is_array($result)) {
301
-                        foreach ($result as $key1=>$result1) {
302
-                            if (is_array($result1)) {
303
-                                  if ($deepPrinting) {
304
-                                      echo "<br>$key1 ------><br>";
305
-                                      Route4Me::simplePrint($result1, true);
306
-                                      echo "------<br>";
307
-                                  } else {
308
-                                      echo $key1." --> "."Array() <br>";
309
-                                  } 
310
-                            } else {
311
-                                if (is_object($result1)) {
312
-                                    if ($deepPrinting) {
313
-                                        echo "<br>$key1 ------><br>";
314
-                                        $oarray = (array)$result1;
315
-                                        Route4Me::simplePrint($oarray, true);
316
-                                        echo "------<br>";
317
-                                    } else {
318
-                                        echo $key1." --> "."Object <br>";
319
-                                    } 
320
-                                } else {
321
-                                    if (!is_null($result1)) {
322
-                                        echo $key1." --> ".$result1."<br>"; 
323
-                                    }   
324
-                                }
325
-                            }
326
-                        }
327
-                    } else {
328
-                        if (is_object($result)) {
329
-                            if ($deepPrinting) {
330
-                                echo "<br>$key ------><br>";
331
-                                $oarray = (array)$result;
332
-                                Route4Me::simplePrint($oarray, true);
333
-                                echo "------<br>";
334
-                            } else {
335
-                                echo $key." --> "."Object <br>";
336
-                            } 
337
-                        } else {
338
-                            if (!is_null($result)) {
339
-                                echo $key." --> ".$result."<br>";
340
-                            }
341
-                        }
290
+	/**
291
+	 * Prints on the screen main keys and values of the array 
292
+	 * @param $results: object to be printed on the screen.
293
+	 * @param $deepPrinting: if true, object will be printed recursively.
294
+	 */
295
+	public static function simplePrint($results, $deepPrinting = null)
296
+	{
297
+		if (isset($results)) {
298
+			if (is_array($results)) {
299
+				foreach ($results as $key=>$result) {
300
+					if (is_array($result)) {
301
+						foreach ($result as $key1=>$result1) {
302
+							if (is_array($result1)) {
303
+								  if ($deepPrinting) {
304
+									  echo "<br>$key1 ------><br>";
305
+									  Route4Me::simplePrint($result1, true);
306
+									  echo "------<br>";
307
+								  } else {
308
+									  echo $key1." --> "."Array() <br>";
309
+								  } 
310
+							} else {
311
+								if (is_object($result1)) {
312
+									if ($deepPrinting) {
313
+										echo "<br>$key1 ------><br>";
314
+										$oarray = (array)$result1;
315
+										Route4Me::simplePrint($oarray, true);
316
+										echo "------<br>";
317
+									} else {
318
+										echo $key1." --> "."Object <br>";
319
+									} 
320
+								} else {
321
+									if (!is_null($result1)) {
322
+										echo $key1." --> ".$result1."<br>"; 
323
+									}   
324
+								}
325
+							}
326
+						}
327
+					} else {
328
+						if (is_object($result)) {
329
+							if ($deepPrinting) {
330
+								echo "<br>$key ------><br>";
331
+								$oarray = (array)$result;
332
+								Route4Me::simplePrint($oarray, true);
333
+								echo "------<br>";
334
+							} else {
335
+								echo $key." --> "."Object <br>";
336
+							} 
337
+						} else {
338
+							if (!is_null($result)) {
339
+								echo $key." --> ".$result."<br>";
340
+							}
341
+						}
342 342
                         
343
-                    }
344
-                    //echo "<br>";
345
-                }
346
-            } 
347
-        }
348
-    }
343
+					}
344
+					//echo "<br>";
345
+				}
346
+			} 
347
+		}
348
+	}
349 349
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@
 block discarded – undo
134 134
         
135 135
         if ($file!=null) {
136 136
             curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
137
-            $fp=fopen($file, 'r');
137
+            $fp = fopen($file, 'r');
138 138
             curl_setopt($ch, CURLOPT_INFILE, $fp);
139 139
             curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file));
140 140
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -198,7 +198,7 @@
 block discarded – undo
198 198
             } else {
199 199
                 return $json;
200 200
             }
201
-        }  elseif (409==$code) {
201
+        } elseif (409==$code) {
202 202
             throw new ApiError('Wrong API key');
203 203
         } else {
204 204
             throw new ApiError('Something wrong');
Please login to merge, or discard this patch.
examples/Activities/GetActivities.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
 Route4Me::setApiKey('11111111111111111111111111111111');
15 15
 
16 16
 $activityParameters = ActivityParameters::fromArray(array(
17
-    "limit"  => 10,
18
-    "offset" => 0
17
+	"limit"  => 10,
18
+	"offset" => 0
19 19
 ));
20 20
 
21 21
 $activities = new ActivityParameters();
@@ -23,6 +23,6 @@  discard block
 block discarded – undo
23 23
 $results = $activities->getValue($actresults, "results");
24 24
 
25 25
 foreach ($results as $result) {
26
-    Route4Me::simplePrint($result);
27
-    echo "<br>";
26
+	Route4Me::simplePrint($result);
27
+	echo "<br>";
28 28
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Route4Me;
3 3
 
4
-$root = realpath(dirname(__FILE__) . '/../../');
4
+$root = realpath(dirname(__FILE__).'/../../');
5 5
 require $root.'/vendor/autoload.php';
6 6
 
7 7
 use Route4Me\Route4Me;
Please login to merge, or discard this patch.
examples/Activities/GetLastActivities.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
 Route4Me::setApiKey('11111111111111111111111111111111');
17 17
 
18 18
 $activityParameters = ActivityParameters::fromArray(array(
19
-    "limit"  => 10,
20
-    "offset" => 0,
21
-    "start"  => strtotime("-1 week")
19
+	"limit"  => 10,
20
+	"offset" => 0,
21
+	"start"  => strtotime("-1 week")
22 22
 ));
23 23
 
24 24
 $activities = new ActivityParameters();
@@ -26,6 +26,6 @@  discard block
 block discarded – undo
26 26
 $results = $activities->getValue($actresults, "results");
27 27
 
28 28
 foreach ($results as $result) {
29
-    Route4Me::simplePrint($result);
30
-    echo "<br>";
29
+	Route4Me::simplePrint($result);
30
+	echo "<br>";
31 31
 }
Please login to merge, or discard this patch.
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\Route;
Please login to merge, or discard this patch.
examples/Addresses/GetAddress.php 1 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\Route;
Please login to merge, or discard this patch.
examples/Addresses/RemoveRouteDestination.php 1 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\Route;
Please login to merge, or discard this patch.