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 ( b54c2e...66b33a )
by Oleg
01:58
created
examples/Routes/GetRoutePathPoints.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -23,23 +23,23 @@
 block discarded – undo
23 23
 
24 24
 // Get a route with the path points
25 25
 $params = array(
26
-    "route_path_output" => "Points",
27
-    "route_id"   => $route_id
26
+	"route_path_output" => "Points",
27
+	"route_id"   => $route_id
28 28
 );
29 29
 
30 30
 $routeResults = (array)$route->getRoutePoints($params);
31 31
 
32 32
 if (isset($routeResults['addresses'])) {
33
-    foreach ($routeResults['addresses'] as $key => $address) {
34
-        $araddress = (array)$address;
33
+	foreach ($routeResults['addresses'] as $key => $address) {
34
+		$araddress = (array)$address;
35 35
 
36
-        if (isset($araddress['route_destination_id'])) echo "route_destination_id=".$araddress['route_destination_id']."<br>";
36
+		if (isset($araddress['route_destination_id'])) echo "route_destination_id=".$araddress['route_destination_id']."<br>";
37 37
         
38
-        if (isset($araddress['path_to_next'])) {
39
-            echo "path_to_next:<br>";
40
-            Route4Me::simplePrint($araddress['path_to_next']);
41
-        }
38
+		if (isset($araddress['path_to_next'])) {
39
+			echo "path_to_next:<br>";
40
+			Route4Me::simplePrint($araddress['path_to_next']);
41
+		}
42 42
         
43
-        echo "<br>";
44
-    }
43
+		echo "<br>";
44
+	}
45 45
 }
Please login to merge, or discard this patch.
examples/Routes/GetRoutePathPointsCompressed.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -23,24 +23,24 @@
 block discarded – undo
23 23
 
24 24
 // Get a route with the path points
25 25
 $params = array(
26
-    "route_path_output"     => "Points",
27
-    "compress_path_points"  => TRUE,
28
-    "route_id"              => $route_id
26
+	"route_path_output"     => "Points",
27
+	"compress_path_points"  => TRUE,
28
+	"route_id"              => $route_id
29 29
 );
30 30
 
31 31
 $routeResults = (array)$route->getRoutePoints($params);
32 32
 
33 33
 if (isset($routeResults['addresses'])) {
34
-    foreach ($routeResults['addresses'] as $key => $address) {
35
-        $araddress = (array)$address;
34
+	foreach ($routeResults['addresses'] as $key => $address) {
35
+		$araddress = (array)$address;
36 36
 
37
-        if (isset($araddress['route_destination_id'])) echo "route_destination_id=".$araddress['route_destination_id']."<br>";
37
+		if (isset($araddress['route_destination_id'])) echo "route_destination_id=".$araddress['route_destination_id']."<br>";
38 38
         
39
-        if (isset($araddress['path_to_next'])) {
40
-            echo "path_to_next:<br>";
41
-            Route4Me::simplePrint((array)$araddress['path_to_next']);
42
-        }
39
+		if (isset($araddress['path_to_next'])) {
40
+			echo "path_to_next:<br>";
41
+			Route4Me::simplePrint((array)$araddress['path_to_next']);
42
+		}
43 43
         
44
-        echo "<br>";
45
-    }
44
+		echo "<br>";
45
+	}
46 46
 }
Please login to merge, or discard this patch.
examples/Routes/GetRouteDirections.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@
 block discarded – undo
23 23
   
24 24
 // Get a route with the directions
25 25
 $params = array(
26
-    "directions" => 1,
27
-    "route_id"   => $route_id
26
+	"directions" => 1,
27
+	"route_id"   => $route_id
28 28
 );
29 29
 
30 30
 $routeResults = (array)$route->getRoutePoints($params);
Please login to merge, or discard this patch.
src/Route4Me/Track.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@
 block discarded – undo
7 7
 
8 8
 class Track extends Common
9 9
 {
10
-    public static function set(TrackSetParams $params)
11
-    {
12
-        $allQueryFields = Route4Me::getObjectProperties(new TrackSetParams(), array('tx_id'));
10
+	public static function set(TrackSetParams $params)
11
+	{
12
+		$allQueryFields = Route4Me::getObjectProperties(new TrackSetParams(), array('tx_id'));
13 13
 
14
-        $json = Route4Me::makeRequst(array(
15
-            'url'    => Endpoint::TRACK_SET,
16
-            'method' => 'GET',
17
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
18
-        ));
14
+		$json = Route4Me::makeRequst(array(
15
+			'url'    => Endpoint::TRACK_SET,
16
+			'method' => 'GET',
17
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
18
+		));
19 19
 
20
-        return $json;
21
-    }
20
+		return $json;
21
+	}
22 22
 }
Please login to merge, or discard this patch.
src/Route4Me/Territory.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	
41 41
 	public static function getTerritory($params)
42 42
 	{
43
-	    $allQueryFields = array('territory_id', 'addresses');
43
+		$allQueryFields = array('territory_id', 'addresses');
44 44
         
45 45
 		$territory = Route4Me::makeRequst(array(
46 46
 			'url'    => Endpoint::TERRITORY_V4,
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	
54 54
 	public static function getTerritories($params)
55 55
 	{
56
-	    $allQueryFields = array('offset', 'limit', 'addresses');
56
+		$allQueryFields = array('offset', 'limit', 'addresses');
57 57
         
58 58
 		$response = Route4Me::makeRequst(array(
59 59
 			'url'    => Endpoint::TERRITORY_V4,
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
 	public static function addTerritory($params)
68 68
 	{
69
-	    $allBodyFields = array('territory_name', 'member_id', 'territory_color', 'territory');
69
+		$allBodyFields = array('territory_name', 'member_id', 'territory_color', 'territory');
70 70
         
71 71
 		$response = Route4Me::makeRequst(array(
72 72
 			'url'    => Endpoint::TERRITORY_V4,
@@ -92,14 +92,14 @@  discard block
 block discarded – undo
92 92
 	
93 93
 	public function updateTerritory($params)
94 94
 	{
95
-	    $allQueryFields = array('territory_id');
96
-        $allBodyFields = array('territory_name', 'member_id', 'territory_color', 'territory');
95
+		$allQueryFields = array('territory_id');
96
+		$allBodyFields = array('territory_name', 'member_id', 'territory_color', 'territory');
97 97
         
98 98
 		$response = Route4Me::makeRequst(array(
99 99
 			'url'    => Endpoint::TERRITORY_V4,
100 100
 			'method' => 'PUT',
101 101
 			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
102
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
102
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
103 103
 		));
104 104
 
105 105
 		return $response;
Please login to merge, or discard this patch.
src/Route4Me/Vehicle.php 1 patch
Indentation   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -6,157 +6,157 @@
 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
-        $allQueryFields = array('with_pagination', 'page', 'perPage');
78
+	public static function getVehicles($params)
79
+	{
80
+		$allQueryFields = array('with_pagination', 'page', 'perPage');
81 81
         
82
-        $response = Route4Me::makeRequst(array(
83
-            'url'    => Endpoint::VEHICLE_V4,
84
-            'method' => 'GET',
85
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
86
-        ));
82
+		$response = Route4Me::makeRequst(array(
83
+			'url'    => Endpoint::VEHICLE_V4,
84
+			'method' => 'GET',
85
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
86
+		));
87 87
 
88
-        return $response;
89
-    }
88
+		return $response;
89
+	}
90 90
     
91
-    public function getRandomVehicleId($page,$perPage)
92
-    {
93
-        $params = array(
94
-            'page'             => isset($page) ? $page : 1,
95
-            'perPage'          => isset($perPage) ? $perPage : 10,
96
-            'with_pagination'  => true
97
-        );
91
+	public function getRandomVehicleId($page,$perPage)
92
+	{
93
+		$params = array(
94
+			'page'             => isset($page) ? $page : 1,
95
+			'perPage'          => isset($perPage) ? $perPage : 10,
96
+			'with_pagination'  => true
97
+		);
98 98
         
99
-        $vehicles = $this->getVehicles($params);
99
+		$vehicles = $this->getVehicles($params);
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
-        $allBodyFields = Route4Me::getObjectProperties(new Vehicle(), array('vehicle_id'));
124
+		$allBodyFields = Route4Me::getObjectProperties(new Vehicle(), array('vehicle_id'));
125 125
         
126
-        $response = Route4Me::makeRequst(array(
127
-            'url'    => Endpoint::VEHICLE_V4 . '/' . $vehicleID,
128
-            'method' => 'PUT',
129
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
130
-            'HTTPHEADER'  => 'Content-Type: application/json'
131
-        ));
126
+		$response = Route4Me::makeRequst(array(
127
+			'url'    => Endpoint::VEHICLE_V4 . '/' . $vehicleID,
128
+			'method' => 'PUT',
129
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
130
+			'HTTPHEADER'  => 'Content-Type: application/json'
131
+		));
132 132
 
133
-        return $response;
134
-    }
133
+		return $response;
134
+	}
135 135
     
136
-    public function createVehicle($params)
137
-    {
138
-        $allBodyFields = Route4Me::getObjectProperties(new Vehicle(), array('vehicle_id'));
136
+	public function createVehicle($params)
137
+	{
138
+		$allBodyFields = Route4Me::getObjectProperties(new Vehicle(), array('vehicle_id'));
139 139
         
140
-        $response = Route4Me::makeRequst(array(
141
-            'url'    => Endpoint::VEHICLE_V4,
142
-            'method' => 'POST',
143
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
144
-            'HTTPHEADER'  => 'Content-Type: application/json'
145
-        ));
140
+		$response = Route4Me::makeRequst(array(
141
+			'url'    => Endpoint::VEHICLE_V4,
142
+			'method' => 'POST',
143
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
144
+			'HTTPHEADER'  => 'Content-Type: application/json'
145
+		));
146 146
 
147
-        return $response;
148
-    }
147
+		return $response;
148
+	}
149 149
     
150
-    public function removeVehicle($params)
151
-    {
152
-        $vehicleID = isset($params->vehicle_id) ? $params->vehicle_id : null;
150
+	public function removeVehicle($params)
151
+	{
152
+		$vehicleID = isset($params->vehicle_id) ? $params->vehicle_id : null;
153 153
         
154
-        $response = Route4Me::makeRequst(array(
155
-            'url'    => Endpoint::VEHICLE_V4 . '/' . $vehicleID,
156
-            'method' => 'DELETE',
157
-            'HTTPHEADER'  => 'Content-Type: application/json'
158
-        ));
154
+		$response = Route4Me::makeRequst(array(
155
+			'url'    => Endpoint::VEHICLE_V4 . '/' . $vehicleID,
156
+			'method' => 'DELETE',
157
+			'HTTPHEADER'  => 'Content-Type: application/json'
158
+		));
159 159
 
160
-        return $response;
161
-    }
160
+		return $response;
161
+	}
162 162
 }
Please login to merge, or discard this patch.
src/Route4Me/Route4Me.php 1 patch
Indentation   +347 added lines, -347 removed lines patch added patch discarded remove patch
@@ -7,415 +7,415 @@
 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
 
350
-    /**
351
-     * Generates query or body parameters.
352
-     * @param $allFields: all known fields could be used for parameters generation.
353
-     * @param $params: input parameters (array or object)
354
-     */
355
-    public static function generateRequestParameters($allFields, $params)
356
-    {
357
-        $generatedParams = array();
350
+	/**
351
+	 * Generates query or body parameters.
352
+	 * @param $allFields: all known fields could be used for parameters generation.
353
+	 * @param $params: input parameters (array or object)
354
+	 */
355
+	public static function generateRequestParameters($allFields, $params)
356
+	{
357
+		$generatedParams = array();
358 358
         
359
-        if (is_array($params)) {
360
-            foreach ($allFields as $field) {
361
-                if (isset($params[$field])) {
362
-                    $generatedParams[$field] = $params[$field];
363
-                }
364
-            }
365
-        } elseif (is_object($params)) {
366
-            foreach ($allFields as $field) {
367
-                if (isset($params->{$field})) {
368
-                    $generatedParams[$field] = $params->{$field};
369
-                }
370
-            }
371
-        }
359
+		if (is_array($params)) {
360
+			foreach ($allFields as $field) {
361
+				if (isset($params[$field])) {
362
+					$generatedParams[$field] = $params[$field];
363
+				}
364
+			}
365
+		} elseif (is_object($params)) {
366
+			foreach ($allFields as $field) {
367
+				if (isset($params->{$field})) {
368
+					$generatedParams[$field] = $params->{$field};
369
+				}
370
+			}
371
+		}
372 372
 
373
-        return $generatedParams;
374
-    }
373
+		return $generatedParams;
374
+	}
375 375
     
376
-    /**
377
-     * Returns an array of the object properties
378
-     * @param $object: An object.
379
-     * @param $exclude: array of the object parameters to be excluded from the returned array.
380
-     */
381
-    public static function getObjectProperties($object, $exclude)
382
-    {
383
-        $objectParameters = array();
376
+	/**
377
+	 * Returns an array of the object properties
378
+	 * @param $object: An object.
379
+	 * @param $exclude: array of the object parameters to be excluded from the returned array.
380
+	 */
381
+	public static function getObjectProperties($object, $exclude)
382
+	{
383
+		$objectParameters = array();
384 384
         
385
-        foreach (get_object_vars($object) as $key => $value) {
386
-            if (property_exists($object, $key)) {
387
-                if (!is_numeric(array_search($key, $exclude))) {
388
-                    array_push($objectParameters, $key);
389
-                }
390
-            }
391
-        }
385
+		foreach (get_object_vars($object) as $key => $value) {
386
+			if (property_exists($object, $key)) {
387
+				if (!is_numeric(array_search($key, $exclude))) {
388
+					array_push($objectParameters, $key);
389
+				}
390
+			}
391
+		}
392 392
         
393
-        return $objectParameters;
394
-    }
393
+		return $objectParameters;
394
+	}
395 395
     
396
-    /**
397
-     * Returns url path generated from the array of the fields and parameters.
398
-     * @param $allFields; array of the paossible fields (parameter names).
399
-     * @param $params: input parameters (array or object).
400
-     */
401
-    public static function generateUrlPath($allFields, $params)
402
-    {
403
-        $generatedPath = "";
396
+	/**
397
+	 * Returns url path generated from the array of the fields and parameters.
398
+	 * @param $allFields; array of the paossible fields (parameter names).
399
+	 * @param $params: input parameters (array or object).
400
+	 */
401
+	public static function generateUrlPath($allFields, $params)
402
+	{
403
+		$generatedPath = "";
404 404
 
405
-        if (is_array($params)) {
406
-            foreach ($allFields as $field) {
407
-                if (isset($params[$field])) {
408
-                    $generatedPath .= $params[$field].'/';
409
-                }
410
-            }
411
-        } elseif (is_object($params)) {
412
-            foreach ($allFields as $field) {
413
-                if (isset($params->{$field})) {
414
-                    $generatedPath .= $params->{$field}.'/';
415
-                }
416
-            }
417
-        }
405
+		if (is_array($params)) {
406
+			foreach ($allFields as $field) {
407
+				if (isset($params[$field])) {
408
+					$generatedPath .= $params[$field].'/';
409
+				}
410
+			}
411
+		} elseif (is_object($params)) {
412
+			foreach ($allFields as $field) {
413
+				if (isset($params->{$field})) {
414
+					$generatedPath .= $params->{$field}.'/';
415
+				}
416
+			}
417
+		}
418 418
         
419
-        return $generatedPath;
420
-    }
419
+		return $generatedPath;
420
+	}
421 421
 }
Please login to merge, or discard this patch.
src/Route4Me/Geocoding.php 1 patch
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -6,106 +6,106 @@
 block discarded – undo
6 6
 
7 7
 class Geocoding extends Common
8 8
 {
9
-    public $strExportFormat;
10
-    public $format;
11
-    public $addresses;
12
-    public $pk;
13
-    public $offset;
14
-    public $limit;
15
-    public $housenumber;
16
-    public $zipcode;
9
+	public $strExportFormat;
10
+	public $format;
11
+	public $addresses;
12
+	public $pk;
13
+	public $offset;
14
+	public $limit;
15
+	public $housenumber;
16
+	public $zipcode;
17 17
     
18
-    public static function fromArray(array $params) 
19
-    {
20
-        $geocoding = new Geocoding();
18
+	public static function fromArray(array $params) 
19
+	{
20
+		$geocoding = new Geocoding();
21 21
         
22
-        foreach($params as $key => $value) {
23
-            if (property_exists($geocoding, $key)) {
24
-                $geocoding->{$key} = $value;
25
-            }
26
-        }
22
+		foreach($params as $key => $value) {
23
+			if (property_exists($geocoding, $key)) {
24
+				$geocoding->{$key} = $value;
25
+			}
26
+		}
27 27
         
28
-        return $geocoding;
29
-    }
28
+		return $geocoding;
29
+	}
30 30
     
31
-    public static function forwardGeocoding($params)
32
-    {
33
-        $allBodyFields = array('strExportFormat', 'addresses');
31
+	public static function forwardGeocoding($params)
32
+	{
33
+		$allBodyFields = array('strExportFormat', 'addresses');
34 34
 
35
-        $fgCoding = Route4Me::makeRequst(array(
36
-            'url'    => Endpoint::GEOCODER,
37
-            'method' => 'POST',
38
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
39
-            'HTTPHEADER'  => 'Content-Type: multipart/form-data'
40
-        ));
35
+		$fgCoding = Route4Me::makeRequst(array(
36
+			'url'    => Endpoint::GEOCODER,
37
+			'method' => 'POST',
38
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
39
+			'HTTPHEADER'  => 'Content-Type: multipart/form-data'
40
+		));
41 41
         
42
-        return $fgCoding;
43
-    }
42
+		return $fgCoding;
43
+	}
44 44
     
45
-    public static function reverseGeocoding($params)
46
-    {
47
-        $allQueryFields = array('format', 'addresses', 'detailed');
45
+	public static function reverseGeocoding($params)
46
+	{
47
+		$allQueryFields = array('format', 'addresses', 'detailed');
48 48
 
49
-        $fgcoding = Route4Me::makeRequst(array(
50
-            'url'    => Endpoint::GEOCODER,
51
-            'method' => 'POST',
52
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
53
-        ));
49
+		$fgcoding = Route4Me::makeRequst(array(
50
+			'url'    => Endpoint::GEOCODER,
51
+			'method' => 'POST',
52
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
53
+		));
54 54
         
55
-        return $fgcoding;
56
-    }
55
+		return $fgcoding;
56
+	}
57 57
     
58
-    public static function getStreetData($params)
59
-    {
60
-        $url_query = Endpoint::STREET_DATA;
58
+	public static function getStreetData($params)
59
+	{
60
+		$url_query = Endpoint::STREET_DATA;
61 61
         
62
-        $allPathFields = array('pk', 'offset', 'limit');
62
+		$allPathFields = array('pk', 'offset', 'limit');
63 63
 
64
-        $url_query .= Route4Me::generateUrlPath($allPathFields, $params);
64
+		$url_query .= Route4Me::generateUrlPath($allPathFields, $params);
65 65
 
66
-        $query = array();
66
+		$query = array();
67 67
         
68
-        $response = Route4Me::makeUrlRequst($url_query, array(
69
-            'method' => 'GET',
70
-            'query'  => $query
71
-        ));
68
+		$response = Route4Me::makeUrlRequst($url_query, array(
69
+			'method' => 'GET',
70
+			'query'  => $query
71
+		));
72 72
         
73
-        return $response;
74
-    }
73
+		return $response;
74
+	}
75 75
     
76
-    public static function getZipCode($params)
77
-    {
78
-        $url_query = Endpoint::STREET_DATA_ZIPCODE;
76
+	public static function getZipCode($params)
77
+	{
78
+		$url_query = Endpoint::STREET_DATA_ZIPCODE;
79 79
         
80
-        $allPathFields = array('zipcode', 'offset', 'limit');
80
+		$allPathFields = array('zipcode', 'offset', 'limit');
81 81
 
82
-        $url_query .= Route4Me::generateUrlPath($allPathFields, $params);
82
+		$url_query .= Route4Me::generateUrlPath($allPathFields, $params);
83 83
 
84
-        $query = array();
84
+		$query = array();
85 85
         
86
-        $response = Route4Me::makeUrlRequst($url_query, array(
87
-            'method' => 'GET',
88
-            'query'  => $query
89
-        ));
86
+		$response = Route4Me::makeUrlRequst($url_query, array(
87
+			'method' => 'GET',
88
+			'query'  => $query
89
+		));
90 90
         
91
-        return $response;
92
-    }
91
+		return $response;
92
+	}
93 93
     
94
-    public static function getService($params)
95
-    {
96
-        $url_query = Endpoint::STREET_DATA_SERVICE;
94
+	public static function getService($params)
95
+	{
96
+		$url_query = Endpoint::STREET_DATA_SERVICE;
97 97
         
98
-        $allPathFields = array('zipcode', 'housenumber', 'offset', 'limit');
98
+		$allPathFields = array('zipcode', 'housenumber', 'offset', 'limit');
99 99
 
100
-        $url_query .= Route4Me::generateUrlPath($allPathFields, $params);
100
+		$url_query .= Route4Me::generateUrlPath($allPathFields, $params);
101 101
         
102
-        $query = array();
102
+		$query = array();
103 103
         
104
-        $response = Route4Me::makeUrlRequst($url_query, array(
105
-            'method' => 'GET',
106
-            'query'  => $query
107
-        ));
104
+		$response = Route4Me::makeUrlRequst($url_query, array(
105
+			'method' => 'GET',
106
+			'query'  => $query
107
+		));
108 108
         
109
-        return $response;
110
-    }
109
+		return $response;
110
+	}
111 111
 }
Please login to merge, or discard this patch.
src/Route4Me/Route.php 1 patch
Indentation   +336 added lines, -336 removed lines patch added patch discarded remove patch
@@ -9,409 +9,409 @@
 block discarded – undo
9 9
 
10 10
 class Route extends Common
11 11
 {
12
-    public $route_id;
13
-    public $member_id;
14
-    public $route_destination_id;
15
-    public $optimization_problem_id;
16
-    public $vehicle_alias;
17
-    public $driver_alias;
18
-    public $trip_distance;
19
-    public $mpg;
20
-    public $gas_price;
21
-    public $route_duration_sec;
22
-    public $destination_count;
23
-    public $parameters;
24
-    public $addresses = array();
25
-    public $links = array();
26
-    public $directions = array();
27
-    public $path = array();
28
-    public $tracking_history = array();
29
-    public $recipient_email;
30
-    public $httpheaders;
31
-    public $is_unrouted;
32
-    public $time;
12
+	public $route_id;
13
+	public $member_id;
14
+	public $route_destination_id;
15
+	public $optimization_problem_id;
16
+	public $vehicle_alias;
17
+	public $driver_alias;
18
+	public $trip_distance;
19
+	public $mpg;
20
+	public $gas_price;
21
+	public $route_duration_sec;
22
+	public $destination_count;
23
+	public $parameters;
24
+	public $addresses = array();
25
+	public $links = array();
26
+	public $directions = array();
27
+	public $path = array();
28
+	public $tracking_history = array();
29
+	public $recipient_email;
30
+	public $httpheaders;
31
+	public $is_unrouted;
32
+	public $time;
33 33
     
34
-    public $dev_lat;
35
-    public $dev_lng;
34
+	public $dev_lat;
35
+	public $dev_lng;
36 36
     
37
-    public $user_route_rating;
38
-    public $member_email;
39
-    public $member_first_name;
40
-    public $member_last_name;
41
-    public $channel_name;
42
-    public $route_cost;
43
-    public $route_revenue;
44
-    public $net_revenue_per_distance_unit;
45
-    public $created_timestamp;
46
-    public $planned_total_route_duration;
47
-    public $actual_travel_distance;
48
-    public $actual_travel_time;
49
-    public $actual_footsteps;
50
-    public $working_time;
51
-    public $driving_time;
52
-    public $idling_time;
53
-    public $paying_miles;
54
-    public $geofence_polygon_type;
55
-    public $geofence_polygon_size;
56
-    public $notes;
57
-    public $member_config_storage;
37
+	public $user_route_rating;
38
+	public $member_email;
39
+	public $member_first_name;
40
+	public $member_last_name;
41
+	public $channel_name;
42
+	public $route_cost;
43
+	public $route_revenue;
44
+	public $net_revenue_per_distance_unit;
45
+	public $created_timestamp;
46
+	public $planned_total_route_duration;
47
+	public $actual_travel_distance;
48
+	public $actual_travel_time;
49
+	public $actual_footsteps;
50
+	public $working_time;
51
+	public $driving_time;
52
+	public $idling_time;
53
+	public $paying_miles;
54
+	public $geofence_polygon_type;
55
+	public $geofence_polygon_size;
56
+	public $notes;
57
+	public $member_config_storage;
58 58
 
59
-    public static function fromArray(array $params) 
60
-    {
61
-        $route = new Route();
62
-        $route->route_id                = Common::getValue($params, 'route_id');
63
-        $route->member_id               = Common::getValue($params, 'member_id');
64
-        $route->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
65
-        $route->vehicle_alias           = Common::getValue($params, 'vehicle_alias');
66
-        $route->driver_alias            = Common::getValue($params, 'driver_alias');
67
-        $route->trip_distance           = Common::getValue($params, 'trip_distance');
68
-        $route->mpg                     = Common::getValue($params, 'mpg');
69
-        $route->gas_price               = Common::getValue($params, 'gas_price');
70
-        $route->route_duration_sec      = Common::getvalue($params, 'route_duration_sec');
71
-        $route->destination_count       = Common::getvalue($params, 'destination_count');
72
-        $route->is_unrouted             = Common::getvalue($params, 'is_unrouted');
59
+	public static function fromArray(array $params) 
60
+	{
61
+		$route = new Route();
62
+		$route->route_id                = Common::getValue($params, 'route_id');
63
+		$route->member_id               = Common::getValue($params, 'member_id');
64
+		$route->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
65
+		$route->vehicle_alias           = Common::getValue($params, 'vehicle_alias');
66
+		$route->driver_alias            = Common::getValue($params, 'driver_alias');
67
+		$route->trip_distance           = Common::getValue($params, 'trip_distance');
68
+		$route->mpg                     = Common::getValue($params, 'mpg');
69
+		$route->gas_price               = Common::getValue($params, 'gas_price');
70
+		$route->route_duration_sec      = Common::getvalue($params, 'route_duration_sec');
71
+		$route->destination_count       = Common::getvalue($params, 'destination_count');
72
+		$route->is_unrouted             = Common::getvalue($params, 'is_unrouted');
73 73
 
74
-        // Make RouteParameters
75
-        if (isset($params['parameters'])) {
76
-            $route->parameters = RouteParameters::fromArray($params['parameters']);
77
-        }
74
+		// Make RouteParameters
75
+		if (isset($params['parameters'])) {
76
+			$route->parameters = RouteParameters::fromArray($params['parameters']);
77
+		}
78 78
 
79
-        if (isset($params['addresses'])) {
80
-            $addresses = array();
81
-            foreach ($params['addresses'] as $address) {
82
-                $addresses[] = Address::fromArray($address);
83
-            }
79
+		if (isset($params['addresses'])) {
80
+			$addresses = array();
81
+			foreach ($params['addresses'] as $address) {
82
+				$addresses[] = Address::fromArray($address);
83
+			}
84 84
 
85
-            $route->addresses = $addresses;
86
-        }
85
+			$route->addresses = $addresses;
86
+		}
87 87
 
88
-        $route->links            = Common::getValue($params, 'links', array());
89
-        $route->directions       = Common::getValue($params, 'directions', array());
90
-        $route->path             = Common::getValue($params, 'path', array());
91
-        $route->tracking_history = Common::getValue($params, 'tracking_history', array());
88
+		$route->links            = Common::getValue($params, 'links', array());
89
+		$route->directions       = Common::getValue($params, 'directions', array());
90
+		$route->path             = Common::getValue($params, 'path', array());
91
+		$route->tracking_history = Common::getValue($params, 'tracking_history', array());
92 92
 
93
-        return $route;
94
-    }
93
+		return $route;
94
+	}
95 95
 
96
-    public static function getRoutes($params = null)
97
-    {
98
-        $allQueryFields = array('route_id', 'route_path_output', 'query', 'directions', 'device_tracking_history', 'limit', 'offset');
96
+	public static function getRoutes($params = null)
97
+	{
98
+		$allQueryFields = array('route_id', 'route_path_output', 'query', 'directions', 'device_tracking_history', 'limit', 'offset');
99 99
         
100
-        $result = Route4Me::makeRequst(array(
101
-            'url'    => Endpoint::ROUTE_V4,
102
-            'method' => 'GET',
103
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
104
-        ));
100
+		$result = Route4Me::makeRequst(array(
101
+			'url'    => Endpoint::ROUTE_V4,
102
+			'method' => 'GET',
103
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
104
+		));
105 105
 
106
-        if (isset($params['route_id'])) {
107
-            return Route::fromArray($result); die("");
108
-        } else {
109
-            $routes = array();
110
-            foreach ($result as $route) {
111
-                $routes[] = Route::fromArray($route);
112
-            }
113
-            return $routes;
114
-        }
115
-    }
106
+		if (isset($params['route_id'])) {
107
+			return Route::fromArray($result); die("");
108
+		} else {
109
+			$routes = array();
110
+			foreach ($result as $route) {
111
+				$routes[] = Route::fromArray($route);
112
+			}
113
+			return $routes;
114
+		}
115
+	}
116 116
 
117
-    public function getRoutePoints($params)
118
-    {
119
-        $allQueryFields = array('route_id', 'route_path_output', 'compress_path_points', 'directions');
117
+	public function getRoutePoints($params)
118
+	{
119
+		$allQueryFields = array('route_id', 'route_path_output', 'compress_path_points', 'directions');
120 120
         
121
-        $result = Route4Me::makeRequst(array(
122
-            'url'    => Endpoint::ROUTE_V4,
123
-            'method' => 'GET',
124
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
125
-        ));
121
+		$result = Route4Me::makeRequst(array(
122
+			'url'    => Endpoint::ROUTE_V4,
123
+			'method' => 'GET',
124
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
125
+		));
126 126
 
127
-        return $result;
128
-    }
127
+		return $result;
128
+	}
129 129
 
130
-    public function duplicateRoute($route_id)
131
-    {
132
-        $result = Route4Me::makeRequst(array(
133
-            'url'    => Endpoint::ROUTE_DUPLICATE,
134
-            'method' => 'GET',
135
-            'query'  => array(
136
-                'route_id' => $route_id,
137
-                'to'       => 'none',
138
-            )
139
-        ));
130
+	public function duplicateRoute($route_id)
131
+	{
132
+		$result = Route4Me::makeRequst(array(
133
+			'url'    => Endpoint::ROUTE_DUPLICATE,
134
+			'method' => 'GET',
135
+			'query'  => array(
136
+				'route_id' => $route_id,
137
+				'to'       => 'none',
138
+			)
139
+		));
140 140
         
141
-        return $result;
142
-    }
141
+		return $result;
142
+	}
143 143
     
144
-    public function resequenceRoute($params)
145
-    {
146
-        $allQueryFields = array('route_id', 'route_destination_id');
147
-        $allBodyFields = array('addresses');
144
+	public function resequenceRoute($params)
145
+	{
146
+		$allQueryFields = array('route_id', 'route_destination_id');
147
+		$allBodyFields = array('addresses');
148 148
         
149
-        $result = Route4Me::makeRequst(array(
150
-            'url'    => Endpoint::ROUTE_V4,
151
-            'method' => 'PUT',
152
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
153
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
154
-        ));
149
+		$result = Route4Me::makeRequst(array(
150
+			'url'    => Endpoint::ROUTE_V4,
151
+			'method' => 'PUT',
152
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
153
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
154
+		));
155 155
         
156
-        return $result;
157
-    }
156
+		return $result;
157
+	}
158 158
     
159
-    public function resequenceAllAddresses($params)
160
-    {
161
-        $allQueryFields = array('route_id', 'disable_optimization', 'optimize');
159
+	public function resequenceAllAddresses($params)
160
+	{
161
+		$allQueryFields = array('route_id', 'disable_optimization', 'optimize');
162 162
         
163
-        $result = Route4Me::makeRequst(array(
164
-            'url'    => Endpoint::REOPTIMIZE_V3_2,
165
-            'method' => 'GET',
166
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
167
-        ));
163
+		$result = Route4Me::makeRequst(array(
164
+			'url'    => Endpoint::REOPTIMIZE_V3_2,
165
+			'method' => 'GET',
166
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
167
+		));
168 168
         
169
-        return $result;
170
-    }
169
+		return $result;
170
+	}
171 171
 
172
-    public function mergeRoutes($params)
173
-    {
174
-        $allBodyFields = array('route_ids', 'depot_address', 'remove_origin', 'depot_lat',  'depot_lng');
172
+	public function mergeRoutes($params)
173
+	{
174
+		$allBodyFields = array('route_ids', 'depot_address', 'remove_origin', 'depot_lat',  'depot_lng');
175 175
         
176
-        $result = Route4Me::makeRequst(array(
177
-            'url'    => Endpoint::ROUTES_MERGE,
178
-            'method' => 'POST',
179
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
180
-            'HTTPHEADER'  => 'Content-Type: multipart/form-data'
181
-        ));
176
+		$result = Route4Me::makeRequst(array(
177
+			'url'    => Endpoint::ROUTES_MERGE,
178
+			'method' => 'POST',
179
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
180
+			'HTTPHEADER'  => 'Content-Type: multipart/form-data'
181
+		));
182 182
         
183
-        return $result;
184
-    }
183
+		return $result;
184
+	}
185 185
     
186
-    public function shareRoute($params)
187
-    {
188
-        $allQueryFields = array('route_id', 'response_format');
189
-        $allBodyFields = array('recipient_email');
186
+	public function shareRoute($params)
187
+	{
188
+		$allQueryFields = array('route_id', 'response_format');
189
+		$allBodyFields = array('recipient_email');
190 190
         
191
-        $result = Route4Me::makeRequst(array(
192
-            'url'    => Endpoint::ROUTE_SHARE,
193
-            'method' => 'POST',
194
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
195
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
196
-            'HTTPHEADER'  => 'Content-Type: multipart/form-data'
197
-        ));
191
+		$result = Route4Me::makeRequst(array(
192
+			'url'    => Endpoint::ROUTE_SHARE,
193
+			'method' => 'POST',
194
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
195
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
196
+			'HTTPHEADER'  => 'Content-Type: multipart/form-data'
197
+		));
198 198
         
199
-        return $result;
200
-    }
199
+		return $result;
200
+	}
201 201
     
202
-    // Returns random route_id from existing routes between $offset and $offset+$limit
203
-    public function getRandomRouteId($offset, $limit)
204
-    {
205
-        $params = array(
206
-            'offset' => !is_null($offset) ? $offset : 0,
207
-            'limit'  => !is_null($limit) ? $limit : 30
208
-        );
202
+	// Returns random route_id from existing routes between $offset and $offset+$limit
203
+	public function getRandomRouteId($offset, $limit)
204
+	{
205
+		$params = array(
206
+			'offset' => !is_null($offset) ? $offset : 0,
207
+			'limit'  => !is_null($limit) ? $limit : 30
208
+		);
209 209
         
210
-        $routes = $this->getRoutes($params);
210
+		$routes = $this->getRoutes($params);
211 211
         
212
-        if (is_null($routes) || sizeof($routes)<1) {
213
-            echo "<br> There are no routes in the account. Please, create the routes first. <br>";
214
-            return null;
215
-        } 
212
+		if (is_null($routes) || sizeof($routes)<1) {
213
+			echo "<br> There are no routes in the account. Please, create the routes first. <br>";
214
+			return null;
215
+		} 
216 216
         
217
-        $randomIndex = rand(0, sizeof($routes) - 1);
217
+		$randomIndex = rand(0, sizeof($routes) - 1);
218 218
         
219
-        return $routes[$randomIndex]->route_id;
220
-    }
219
+		return $routes[$randomIndex]->route_id;
220
+	}
221 221
 
222
-    public function update()
223
-    {
224
-        $route = Route4Me::makeRequst(array(
225
-            'url'    => Endpoint::ROUTE_V4,
226
-            'method' => 'PUT',
227
-            'query'  => array(
228
-                'route_id'  => isset($this->route_id) ? $this->route_id : null
229
-            ),
230
-            'body' => array(
231
-                'parameters' => $this->parameters,
232
-                ),
233
-            'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
234
-        ));
222
+	public function update()
223
+	{
224
+		$route = Route4Me::makeRequst(array(
225
+			'url'    => Endpoint::ROUTE_V4,
226
+			'method' => 'PUT',
227
+			'query'  => array(
228
+				'route_id'  => isset($this->route_id) ? $this->route_id : null
229
+			),
230
+			'body' => array(
231
+				'parameters' => $this->parameters,
232
+				),
233
+			'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
234
+		));
235 235
 
236
-        return Route::fromArray($route);
237
-    }
236
+		return Route::fromArray($route);
237
+	}
238 238
     
239
-    public function updateAddress($address = null)
240
-    {
241
-        $body = sizeof($this->addresses)<1 ? get_object_vars($this->parameters) 
242
-            : (isset($this->addresses[0]) ? $this->addresses[0] : get_object_vars($this->parameters));
239
+	public function updateAddress($address = null)
240
+	{
241
+		$body = sizeof($this->addresses)<1 ? get_object_vars($this->parameters) 
242
+			: (isset($this->addresses[0]) ? $this->addresses[0] : get_object_vars($this->parameters));
243 243
 
244
-        $result = Route4Me::makeRequst(array(
245
-            'url'    => Endpoint::ADDRESS_V4,
246
-            'method' => 'PUT',
247
-            'query'  => array(
248
-                'route_id'             => isset($this->route_id) ? $this->route_id : null,
249
-                'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
250
-            ),
251
-            'body'        => $body,
252
-            'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
253
-        ));
244
+		$result = Route4Me::makeRequst(array(
245
+			'url'    => Endpoint::ADDRESS_V4,
246
+			'method' => 'PUT',
247
+			'query'  => array(
248
+				'route_id'             => isset($this->route_id) ? $this->route_id : null,
249
+				'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
250
+			),
251
+			'body'        => $body,
252
+			'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
253
+		));
254 254
 
255
-        return $result;
256
-    }
255
+		return $result;
256
+	}
257 257
 
258
-    public function updateRouteAddress()
259
-    {
260
-        $result = Route4Me::makeRequst(array(
261
-            'url'    => Endpoint::ADDRESS_V4,
262
-            'method' => 'PUT',
263
-            'query'  => array(
264
-                'route_id'             => isset($this->route_id) ? $this->route_id : null,
265
-                'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
266
-            ),
267
-            'body'        => array(
268
-                "parameters" => isset($this->parameters) ? get_object_vars($this->parameters) : null,
269
-                "addresses"  => isset($this->addresses) ? $this->addresses : null
270
-            ),
271
-            'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
272
-        ));
258
+	public function updateRouteAddress()
259
+	{
260
+		$result = Route4Me::makeRequst(array(
261
+			'url'    => Endpoint::ADDRESS_V4,
262
+			'method' => 'PUT',
263
+			'query'  => array(
264
+				'route_id'             => isset($this->route_id) ? $this->route_id : null,
265
+				'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
266
+			),
267
+			'body'        => array(
268
+				"parameters" => isset($this->parameters) ? get_object_vars($this->parameters) : null,
269
+				"addresses"  => isset($this->addresses) ? $this->addresses : null
270
+			),
271
+			'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
272
+		));
273 273
 
274
-        return $result;
275
-    }
274
+		return $result;
275
+	}
276 276
 
277
-    public function addAddresses($params)
278
-    {
279
-        $allQueryFields = array('route_id');
280
-        $allBodyFields = array('addresses');
277
+	public function addAddresses($params)
278
+	{
279
+		$allQueryFields = array('route_id');
280
+		$allBodyFields = array('addresses');
281 281
         
282
-        $route = Route4Me::makeRequst(array(
283
-            'url'    => Endpoint::ROUTE_V4,
284
-            'method' => 'PUT',
285
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
286
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
287
-            'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
288
-        ));
282
+		$route = Route4Me::makeRequst(array(
283
+			'url'    => Endpoint::ROUTE_V4,
284
+			'method' => 'PUT',
285
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
286
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
287
+			'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
288
+		));
289 289
 
290
-        return Route::fromArray($route);
291
-    }
290
+		return Route::fromArray($route);
291
+	}
292 292
     
293
-    public function insertAddressOptimalPosition(array $params)
294
-    {
295
-        $allQueryFields = array('route_id');
296
-        $allBodyFields = array('addresses', 'optimal_position');
293
+	public function insertAddressOptimalPosition(array $params)
294
+	{
295
+		$allQueryFields = array('route_id');
296
+		$allBodyFields = array('addresses', 'optimal_position');
297 297
         
298
-        $route = Route4Me::makeRequst(array(
299
-            'url'    => Endpoint::ROUTE_V4,
300
-            'method' => 'PUT',
301
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
302
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
303
-        ));
298
+		$route = Route4Me::makeRequst(array(
299
+			'url'    => Endpoint::ROUTE_V4,
300
+			'method' => 'PUT',
301
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
302
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
303
+		));
304 304
 
305
-        return Route::fromArray($route);
306
-    }
305
+		return Route::fromArray($route);
306
+	}
307 307
     
308
-    public function addNoteFile($params)
309
-    {
310
-        $fname = isset($params['strFilename']) ? $params['strFilename'] : null;
311
-        $rpath = realpath($fname);
308
+	public function addNoteFile($params)
309
+	{
310
+		$fname = isset($params['strFilename']) ? $params['strFilename'] : null;
311
+		$rpath = realpath($fname);
312 312
         
313
-        $allQueryFields = array('route_id', 'address_id', 'dev_lat', 'dev_lng', 'device_type');
314
-        $allBodyFields = array('strUpdateType', 'strFilename', 'strNoteContents');
313
+		$allQueryFields = array('route_id', 'address_id', 'dev_lat', 'dev_lng', 'device_type');
314
+		$allBodyFields = array('strUpdateType', 'strFilename', 'strNoteContents');
315 315
         
316
-        $result = Route4Me::makeRequst(array(
317
-            'url'    => Endpoint::ROUTE_NOTES_ADD,
318
-            'method' => 'POST',
319
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
320
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
321
-            'FILE'   => $rpath,
322
-            'HTTPHEADER' => array(
323
-                'Content-Type: application/x-www-form-urlencoded'
324
-            )
325
-        ));
316
+		$result = Route4Me::makeRequst(array(
317
+			'url'    => Endpoint::ROUTE_NOTES_ADD,
318
+			'method' => 'POST',
319
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
320
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params),
321
+			'FILE'   => $rpath,
322
+			'HTTPHEADER' => array(
323
+				'Content-Type: application/x-www-form-urlencoded'
324
+			)
325
+		));
326 326
 
327
-        return $result;
328
-    }
327
+		return $result;
328
+	}
329 329
 
330
-    public function deleteRoutes($route_id)
331
-    {
332
-         $result = Route4Me::makeRequst(array(
333
-            'url'    => Endpoint::ROUTES_DELETE,
334
-            'method' => 'DELETE',
335
-            'query'  => array(
336
-                'route_id' => $route_id,
337
-            )
338
-        ));
330
+	public function deleteRoutes($route_id)
331
+	{
332
+		 $result = Route4Me::makeRequst(array(
333
+			'url'    => Endpoint::ROUTES_DELETE,
334
+			'method' => 'DELETE',
335
+			'query'  => array(
336
+				'route_id' => $route_id,
337
+			)
338
+		));
339 339
         
340
-        return $result;
341
-    }
340
+		return $result;
341
+	}
342 342
     
343
-    public function GetAddressesFromRoute($route_id)
344
-    {
345
-        $route1 = Route::getRoutes(array('route_id' => $route_id));
343
+	public function GetAddressesFromRoute($route_id)
344
+	{
345
+		$route1 = Route::getRoutes(array('route_id' => $route_id));
346 346
         
347
-        if (isset($route1)) {
348
-            return $route1->addresses;
349
-        } else {
350
-            return null;
351
-        }
352
-    }
347
+		if (isset($route1)) {
348
+			return $route1->addresses;
349
+		} else {
350
+			return null;
351
+		}
352
+	}
353 353
     
354
-    public function GetRandomAddressFromRoute($route_id)
355
-    {
356
-        $route1 = Route::getRoutes(array('route_id' => $route_id));
354
+	public function GetRandomAddressFromRoute($route_id)
355
+	{
356
+		$route1 = Route::getRoutes(array('route_id' => $route_id));
357 357
         
358
-        if (isset($route1)) {
359
-            $addresses = $route1->addresses;
358
+		if (isset($route1)) {
359
+			$addresses = $route1->addresses;
360 360
             
361
-            $rnd = rand(0, sizeof($addresses) - 1);
361
+			$rnd = rand(0, sizeof($addresses) - 1);
362 362
             
363
-            return $addresses[$rnd];
364
-        } else {
365
-            return null;
366
-        }
367
-    }
363
+			return $addresses[$rnd];
364
+		} else {
365
+			return null;
366
+		}
367
+	}
368 368
 
369
-    public function getRouteId()
370
-    {
371
-        return $this->route_id;
372
-    }
369
+	public function getRouteId()
370
+	{
371
+		return $this->route_id;
372
+	}
373 373
 
374
-    public function getOptimizationId()
375
-    {
376
-        return $this->optimization_problem_id;
377
-    }
374
+	public function getOptimizationId()
375
+	{
376
+		return $this->optimization_problem_id;
377
+	}
378 378
     
379
-    public function GetLastLocation(array $params)
380
-    {
381
-        $allQueryFields = array('route_id', 'device_tracking_history');
379
+	public function GetLastLocation(array $params)
380
+	{
381
+		$allQueryFields = array('route_id', 'device_tracking_history');
382 382
         
383
-        $route = Route4Me::makeRequst(array(
384
-            'url'    => Endpoint::ROUTE_V4,
385
-            'method' => 'GET',
386
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
387
-        ));
383
+		$route = Route4Me::makeRequst(array(
384
+			'url'    => Endpoint::ROUTE_V4,
385
+			'method' => 'GET',
386
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
387
+		));
388 388
 
389
-        return Route::fromArray($route);
390
-    }
389
+		return Route::fromArray($route);
390
+	}
391 391
     
392
-    public function GetTrackingHistoryFromTimeRange(array $params)
393
-    {
394
-        $allQueryFields = array('route_id', 'format', 'time_period', 'start_date', 'end_date');
392
+	public function GetTrackingHistoryFromTimeRange(array $params)
393
+	{
394
+		$allQueryFields = array('route_id', 'format', 'time_period', 'start_date', 'end_date');
395 395
         
396
-        $route = Route4Me::makeRequst(array(
397
-            'url'    => Endpoint::GET_DEVICE_LOCATION,
398
-            'method' => 'GET',
399
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
400
-        ));
396
+		$route = Route4Me::makeRequst(array(
397
+			'url'    => Endpoint::GET_DEVICE_LOCATION,
398
+			'method' => 'GET',
399
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
400
+		));
401 401
 
402
-        return $route;
403
-    }
402
+		return $route;
403
+	}
404 404
     
405
-    public function GetAssetTracking(array $params)
406
-    {
407
-        $allQueryFields = array('tracking');
405
+	public function GetAssetTracking(array $params)
406
+	{
407
+		$allQueryFields = array('tracking');
408 408
         
409
-        $route = Route4Me::makeRequst(array(
410
-            'url'    => Endpoint::STATUS_V4,
411
-            'method' => 'GET',
412
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
413
-        ));
409
+		$route = Route4Me::makeRequst(array(
410
+			'url'    => Endpoint::STATUS_V4,
411
+			'method' => 'GET',
412
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
413
+		));
414 414
 
415
-        return $route;
416
-    }
415
+		return $route;
416
+	}
417 417
 }
Please login to merge, or discard this patch.