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 ( 39430a...e623a9 )
by Oleg
02:28
created
examples/single_driver_round_trip.php 3 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -10,10 +10,8 @@
 block discarded – undo
10 10
 use Route4Me\Enum\DistanceUnit;
11 11
 use Route4Me\Enum\DeviceType;
12 12
 use Route4Me\Enum\TravelMode;
13
-use Route4Me\Enum\Metric;
14 13
 use Route4Me\RouteParameters;
15 14
 use Route4Me\Address;
16
-use Route4Me\Route;
17 15
 
18 16
 Route4Me::setApiKey('11111111111111111111111111111111');
19 17
 
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -23,19 +23,19 @@
 block discarded – undo
23 23
 
24 24
 $addresses = array();
25 25
 foreach($json as $address) {
26
-    $addresses[] = Address::fromArray($address);
26
+	$addresses[] = Address::fromArray($address);
27 27
 }
28 28
 
29 29
 $parameters = RouteParameters::fromArray(array(
30
-    "algorithm_type"          => AlgorithmType::TSP,
31
-    "distance_unit"           => DistanceUnit::MILES,
32
-    "device_type"             => DeviceType::WEB,
33
-    "optimize"                => OptimizationType::DISTANCE,
34
-    "travel_mode"             => TravelMode::DRIVING,
35
-    "route_max_duration"      => 86400,
36
-    "vehicle_capacity"        => 1,
37
-    "vehicle_max_distance_mi" => 10000,
38
-    "rt"                      => true
30
+	"algorithm_type"          => AlgorithmType::TSP,
31
+	"distance_unit"           => DistanceUnit::MILES,
32
+	"device_type"             => DeviceType::WEB,
33
+	"optimize"                => OptimizationType::DISTANCE,
34
+	"travel_mode"             => TravelMode::DRIVING,
35
+	"route_max_duration"      => 86400,
36
+	"vehicle_capacity"        => 1,
37
+	"vehicle_max_distance_mi" => 10000,
38
+	"rt"                      => true
39 39
 ));
40 40
 
41 41
 $optimizationParams = new OptimizationProblemParams;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 $json = array_slice($json, 0, 10);
23 23
 
24 24
 $addresses = array();
25
-foreach($json as $address) {
25
+foreach ($json as $address) {
26 26
     $addresses[] = Address::fromArray($address);
27 27
 }
28 28
 
Please login to merge, or discard this patch.
examples/SingleDriverMultipleTimeWindows.php 4 patches
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -7,14 +7,11 @@
 block discarded – undo
7 7
 use Route4Me\Enum\OptimizationType;
8 8
 use Route4Me\OptimizationProblem;
9 9
 use Route4Me\OptimizationProblemParams;
10
-use Route4Me\Enum\AlgorithmType;
11 10
 use Route4Me\Enum\DistanceUnit;
12 11
 use Route4Me\Enum\DeviceType;
13
-use Route4Me\Enum\TravelMode;
14 12
 use Route4Me\Enum\Metric;
15 13
 use Route4Me\RouteParameters;
16 14
 use Route4Me\Address;
17
-use Route4Me\Route;
18 15
 
19 16
 Route4Me::setApiKey('11111111111111111111111111111111');
20 17
 
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -23,18 +23,18 @@
 block discarded – undo
23 23
 
24 24
 $addresses = array();
25 25
 foreach($json as $address) {
26
-    $addresses[] = Address::fromArray($address);
26
+	$addresses[] = Address::fromArray($address);
27 27
 }
28 28
 
29 29
 $parameters = RouteParameters::fromArray(array(
30
-    "algorithm_type"          => Algorithmtype::TSP,
31
-    "route_name"			  => "Single Driver Multiple TimeWindows 12 Stops",
32
-    "route_date"			  => time() + 24*60*60,
33
-    "route_time"			  => 5 * 3600 + 30 * 60,
34
-    "distance_unit"           => DistanceUnit::MILES,
35
-    "device_type"             => DeviceType::WEB,
36
-    "optimize"                => OptimizationType::DISTANCE,
37
-    "metric"                  => Metric::GEODESIC
30
+	"algorithm_type"          => Algorithmtype::TSP,
31
+	"route_name"			  => "Single Driver Multiple TimeWindows 12 Stops",
32
+	"route_date"			  => time() + 24*60*60,
33
+	"route_time"			  => 5 * 3600 + 30 * 60,
34
+	"distance_unit"           => DistanceUnit::MILES,
35
+	"device_type"             => DeviceType::WEB,
36
+	"optimize"                => OptimizationType::DISTANCE,
37
+	"metric"                  => Metric::GEODESIC
38 38
 ));
39 39
 
40 40
 $optimizationParams = new OptimizationProblemParams;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,14 +22,14 @@
 block discarded – undo
22 22
 $json = json_decode(file_get_contents('./addresses.json'), true);
23 23
 
24 24
 $addresses = array();
25
-foreach($json as $address) {
25
+foreach ($json as $address) {
26 26
     $addresses[] = Address::fromArray($address);
27 27
 }
28 28
 
29 29
 $parameters = RouteParameters::fromArray(array(
30 30
     "algorithm_type"          => Algorithmtype::TSP,
31 31
     "route_name"			  => "Single Driver Multiple TimeWindows 12 Stops",
32
-    "route_date"			  => time() + 24*60*60,
32
+    "route_date"			  => time() + 24 * 60 * 60,
33 33
     "route_time"			  => 5 * 3600 + 30 * 60,
34 34
     "distance_unit"           => DistanceUnit::MILES,
35 35
     "device_type"             => DeviceType::WEB,
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,8 +51,7 @@
 block discarded – undo
51 51
 	if (is_string($value))
52 52
 	{
53 53
 		echo $key." --> ".$value."<br>";
54
-	}
55
-	else 
54
+	} else 
56 55
 	{
57 56
 		echo "************ $key ************* <br>";
58 57
 		Route4Me::simplePrint((array)$value);
Please login to merge, or discard this patch.
examples/Tracking/AssetTracking.php 3 patches
Unused Use Statements   -4 removed lines patch added patch discarded remove patch
@@ -5,10 +5,6 @@
 block discarded – undo
5 5
 	
6 6
 	require $vdir.'/../vendor/autoload.php';
7 7
 	
8
-	use Route4Me\Enum\DeviceType;
9
-	use Route4Me\Enum\Format;
10
-	use Route4Me\TrackSetParams;
11
-	use Route4Me\Track;
12 8
 	use Route4Me\Route;
13 9
 	
14 10
 	// The example refers to the process of an asset tracking by sending HTTP parameters.
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
-	$vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
4
+	$vdir = $_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
5 5
 	
6 6
 	require $vdir.'/../vendor/autoload.php';
7 7
 	
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@
 block discarded – undo
25 25
 		if (is_array($value))
26 26
 		{
27 27
 			Route4Me::simplePrint($value);
28
-		}
29
-		else 
28
+		} else 
30 29
 		{
31 30
 			echo "$key => $value <br>";
32 31
 		}
Please login to merge, or discard this patch.
examples/Tracking/GetDeviceTrackingHistoryFromTimeRange.php 3 patches
Unused Use Statements   -4 removed lines patch added patch discarded remove patch
@@ -6,10 +6,6 @@
 block discarded – undo
6 6
 	require $vdir.'/../vendor/autoload.php';
7 7
 	//require __DIR__.'/../vendor/autoload.php';;
8 8
 	
9
-	use Route4Me\Enum\DeviceType;
10
-	use Route4Me\Enum\Format;
11
-	use Route4Me\TrackSetParams;
12
-	use Route4Me\Track;
13 9
 	use Route4Me\Route;
14 10
 	
15 11
 	Route4Me::setApiKey('11111111111111111111111111111111');
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
-	$vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
4
+	$vdir = $_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
5 5
 	
6 6
 	require $vdir.'/../vendor/autoload.php';
7 7
 	//require __DIR__.'/../vendor/autoload.php';;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@
 block discarded – undo
25 25
 		if (is_array($value))
26 26
 		{
27 27
 			Route4Me::simplePrint($value);
28
-		}
29
-		else 
28
+		} else 
30 29
 		{
31 30
 			echo "$key => $value <br>";
32 31
 		}
Please login to merge, or discard this patch.
src/Route4Me/Address.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use Route4Me\Exception\BadParam;
6 6
 use Route4Me\Route4Me;
7
-use GuzzleHttp\Client;
8 7
 use Route4Me\Common;
9 8
 
10 9
 class Address extends Common
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -10,9 +10,9 @@  discard block
 block discarded – undo
10 10
 class Address extends Common
11 11
 {
12 12
     static public $apiUrl = '/api.v4/address.php';
13
-	static public $apiUrlMove='/actions/route/move_route_destination.php';
14
-	static public $apiUrDeparted='/api/route/mark_address_departed.php';
15
-	static public $apiUrVisited='/actions/address/update_address_visited.php';
13
+	static public $apiUrlMove = '/actions/route/move_route_destination.php';
14
+	static public $apiUrDeparted = '/api/route/mark_address_departed.php';
15
+	static public $apiUrVisited = '/actions/address/update_address_visited.php';
16 16
 
17 17
     public $route_destination_id;
18 18
     public $alias;
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
         }*/
71 71
 
72 72
         $address = new Address();
73
-        foreach($params as $key => $value) {
73
+        foreach ($params as $key => $value) {
74 74
             if (property_exists($address, $key)) {
75 75
                 $address->{$key} = $value;
76 76
             }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
             'url'    => self::$apiUrl,
103 103
             'method' => 'GET',
104 104
             'query'  => array(
105
-                'route_id'             => isset($noteParams['route_id']) ? $noteParams['route_id']: null, 
105
+                'route_id'             => isset($noteParams['route_id']) ? $noteParams['route_id'] : null, 
106 106
                 'route_destination_id' => isset($noteParams['route_destination_id']) ? $noteParams['route_destination_id'] : null,
107 107
                 'notes' => 1,
108 108
             )
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
             'url'    => self::$apiUrl,
133 133
             'method' => 'PUT',
134 134
             'query'  => array(
135
-                'route_id'  => isset($params['route_id']) ? $params['route_id']: null, 
135
+                'route_id'  => isset($params['route_id']) ? $params['route_id'] : null, 
136 136
                 'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
137 137
             ),
138 138
             'body'   => $body
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
             'url'    => self::$apiUrDeparted,
148 148
             'method' => 'GET',
149 149
             'query'  => array(
150
-                'route_id'   => isset($params['route_id']) ? $params['route_id']: null,
151
-                'address_id'   => isset($params['address_id']) ? $params['address_id']: null,
152
-                'is_departed'   => isset($params['is_departed']) ? $params['is_departed']: null,
153
-                'member_id'   => isset($params['member_id']) ? $params['member_id']: null,
150
+                'route_id'   => isset($params['route_id']) ? $params['route_id'] : null,
151
+                'address_id'   => isset($params['address_id']) ? $params['address_id'] : null,
152
+                'is_departed'   => isset($params['is_departed']) ? $params['is_departed'] : null,
153
+                'member_id'   => isset($params['member_id']) ? $params['member_id'] : null,
154 154
             ),
155 155
         ));
156 156
 
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
             'url'    => self::$apiUrVisited,
164 164
             'method' => 'GET',
165 165
             'query'  => array(
166
-                'route_id'   => isset($params['route_id']) ? $params['route_id']: null,
167
-                'address_id'   => isset($params['address_id']) ? $params['address_id']: null,
168
-                'is_visited'   => isset($params['is_visited']) ? $params['is_visited']: null,
169
-                'member_id'   => isset($params['member_id']) ? $params['member_id']: null,
166
+                'route_id'   => isset($params['route_id']) ? $params['route_id'] : null,
167
+                'address_id'   => isset($params['address_id']) ? $params['address_id'] : null,
168
+                'is_visited'   => isset($params['is_visited']) ? $params['is_visited'] : null,
169
+                'member_id'   => isset($params['member_id']) ? $params['member_id'] : null,
170 170
             ),
171 171
         ));
172 172
 
Please login to merge, or discard this patch.
Indentation   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -9,56 +9,56 @@  discard block
 block discarded – undo
9 9
 
10 10
 class Address extends Common
11 11
 {
12
-    static public $apiUrl = '/api.v4/address.php';
12
+	static public $apiUrl = '/api.v4/address.php';
13 13
 	static public $apiUrlMove='/actions/route/move_route_destination.php';
14 14
 	static public $apiUrDeparted='/api/route/mark_address_departed.php';
15 15
 	static public $apiUrVisited='/actions/address/update_address_visited.php';
16 16
 
17
-    public $route_destination_id;
18
-    public $alias;
19
-    public $member_id;
20
-    public $address;
21
-    public $addressUpdate;
22
-    public $is_depot = false;
23
-    public $lat;
24
-    public $lng;
25
-    public $route_id;
26
-    public $original_route_id;
27
-    public $optimization_problem_id;
28
-    public $sequence_no;
29
-    public $geocoded;
30
-    public $preferred_geocoding;
31
-    public $failed_geocoding;
32
-    public $geocodings = array();
33
-    public $contact_id;
34
-    public $is_visited;
35
-    public $customer_po;
36
-    public $invoice_no;
37
-    public $reference_no;
38
-    public $order_no;
39
-    public $weight;
40
-    public $cost;
41
-    public $revenue;
42
-    public $cube;
43
-    public $pieces;
44
-    public $email;
45
-    public $phone;
46
-    public $destination_note_count;
47
-    public $drive_time_to_next_destination;
48
-    public $distance_to_next_destination;
49
-    public $generated_time_window_start;
50
-    public $generated_time_window_end;
51
-    public $time_window_start;
52
-    public $time_window_end;
53
-    public $time;
17
+	public $route_destination_id;
18
+	public $alias;
19
+	public $member_id;
20
+	public $address;
21
+	public $addressUpdate;
22
+	public $is_depot = false;
23
+	public $lat;
24
+	public $lng;
25
+	public $route_id;
26
+	public $original_route_id;
27
+	public $optimization_problem_id;
28
+	public $sequence_no;
29
+	public $geocoded;
30
+	public $preferred_geocoding;
31
+	public $failed_geocoding;
32
+	public $geocodings = array();
33
+	public $contact_id;
34
+	public $is_visited;
35
+	public $customer_po;
36
+	public $invoice_no;
37
+	public $reference_no;
38
+	public $order_no;
39
+	public $weight;
40
+	public $cost;
41
+	public $revenue;
42
+	public $cube;
43
+	public $pieces;
44
+	public $email;
45
+	public $phone;
46
+	public $destination_note_count;
47
+	public $drive_time_to_next_destination;
48
+	public $distance_to_next_destination;
49
+	public $generated_time_window_start;
50
+	public $generated_time_window_end;
51
+	public $time_window_start;
52
+	public $time_window_end;
53
+	public $time;
54 54
 	public $notes;
55
-    public $timestamp_last_visited;
56
-    public $custom_fields = array();
57
-    public $manifest = array();
55
+	public $timestamp_last_visited;
56
+	public $custom_fields = array();
57
+	public $manifest = array();
58 58
 
59
-    public static function fromArray(array $params)
60
-    {
61
-        /*if (!isset($params['address'])) {
59
+	public static function fromArray(array $params)
60
+	{
61
+		/*if (!isset($params['address'])) {
62 62
             throw new BadParam('address must be provided');
63 63
         }
64 64
 
@@ -70,142 +70,142 @@  discard block
 block discarded – undo
70 70
             throw new BadParam('lng must be provided');
71 71
         }*/
72 72
 
73
-        $address = new Address();
74
-        foreach($params as $key => $value) {
75
-            if (property_exists($address, $key)) {
76
-                $address->{$key} = $value;
77
-            }
78
-        }
73
+		$address = new Address();
74
+		foreach($params as $key => $value) {
75
+			if (property_exists($address, $key)) {
76
+				$address->{$key} = $value;
77
+			}
78
+		}
79
+
80
+		return $address;
81
+	}
79 82
 
80
-        return $address;
81
-    }
82
-
83
-    public static function getAddress($routeId, $addressId)
84
-    {
85
-        $address = Route4Me::makeRequst(array(
86
-            'url'    => self::$apiUrl,
87
-            'method' => 'GET',
88
-            'query'  => array(
89
-                'route_id'             => $routeId,
90
-                'route_destination_id' => $addressId,
91
-            )
92
-        ));
93
-
94
-        return Address::fromArray($address);
95
-    }
83
+	public static function getAddress($routeId, $addressId)
84
+	{
85
+		$address = Route4Me::makeRequst(array(
86
+			'url'    => self::$apiUrl,
87
+			'method' => 'GET',
88
+			'query'  => array(
89
+				'route_id'             => $routeId,
90
+				'route_destination_id' => $addressId,
91
+			)
92
+		));
93
+
94
+		return Address::fromArray($address);
95
+	}
96 96
 	
97 97
 	/*Get notes from the specified route destination
98 98
      * Returns an address object with notes, if an address exists, otherwise - return null.
99 99
      */
100
-    public static function GetAddressesNotes($noteParams)
101
-    {
102
-        $address = Route4Me::makeRequst(array(
103
-            'url'    => self::$apiUrl,
104
-            'method' => 'GET',
105
-            'query'  => array(
106
-                'route_id'             => isset($noteParams['route_id']) ? $noteParams['route_id']: null, 
107
-                'route_destination_id' => isset($noteParams['route_destination_id']) ? $noteParams['route_destination_id'] : null,
108
-                'notes' => 1,
109
-            )
110
-        ));
111
-
112
-        return $address;
113
-    }
114
-
115
-    public function update()
116
-    {
117
-        $addressUpdate = Route4Me::makeRequst(array(
118
-            'url'    => self::$apiUrl,
119
-            'method' => 'PUT',
120
-            'body'   => $this->toArray(),
121
-            'query'  => array(
122
-                'route_id'             => $this->route_id,
123
-                'route_destination_id' => $this->route_destination_id,
124
-            ),
125
-        ));
126
-
127
-        return Address::fromArray($addressUpdate);
128
-    }
100
+	public static function GetAddressesNotes($noteParams)
101
+	{
102
+		$address = Route4Me::makeRequst(array(
103
+			'url'    => self::$apiUrl,
104
+			'method' => 'GET',
105
+			'query'  => array(
106
+				'route_id'             => isset($noteParams['route_id']) ? $noteParams['route_id']: null, 
107
+				'route_destination_id' => isset($noteParams['route_destination_id']) ? $noteParams['route_destination_id'] : null,
108
+				'notes' => 1,
109
+			)
110
+		));
111
+
112
+		return $address;
113
+	}
114
+
115
+	public function update()
116
+	{
117
+		$addressUpdate = Route4Me::makeRequst(array(
118
+			'url'    => self::$apiUrl,
119
+			'method' => 'PUT',
120
+			'body'   => $this->toArray(),
121
+			'query'  => array(
122
+				'route_id'             => $this->route_id,
123
+				'route_destination_id' => $this->route_destination_id,
124
+			),
125
+		));
126
+
127
+		return Address::fromArray($addressUpdate);
128
+	}
129 129
 	
130 130
 	public function markAddress($params, $body)
131
-    {
132
-        $result = Route4Me::makeRequst(array(
133
-            'url'    => self::$apiUrl,
134
-            'method' => 'PUT',
135
-            'query'  => array(
136
-                'route_id'  => isset($params['route_id']) ? $params['route_id']: null, 
137
-                'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
138
-            ),
139
-            'body'   => $body
140
-        ));
141
-
142
-        return $result;
143
-    }
131
+	{
132
+		$result = Route4Me::makeRequst(array(
133
+			'url'    => self::$apiUrl,
134
+			'method' => 'PUT',
135
+			'query'  => array(
136
+				'route_id'  => isset($params['route_id']) ? $params['route_id']: null, 
137
+				'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
138
+			),
139
+			'body'   => $body
140
+		));
141
+
142
+		return $result;
143
+	}
144 144
 	
145 145
 	public function markAsDeparted($params)
146 146
 	{
147 147
 		$address = Route4Me::makeRequst(array(
148
-            'url'    => self::$apiUrDeparted,
149
-            'method' => 'GET',
150
-            'query'  => array(
151
-                'route_id'   => isset($params['route_id']) ? $params['route_id']: null,
152
-                'address_id'   => isset($params['address_id']) ? $params['address_id']: null,
153
-                'is_departed'   => isset($params['is_departed']) ? $params['is_departed']: null,
154
-                'member_id'   => isset($params['member_id']) ? $params['member_id']: null,
155
-            ),
156
-        ));
157
-
158
-        return $address;
148
+			'url'    => self::$apiUrDeparted,
149
+			'method' => 'GET',
150
+			'query'  => array(
151
+				'route_id'   => isset($params['route_id']) ? $params['route_id']: null,
152
+				'address_id'   => isset($params['address_id']) ? $params['address_id']: null,
153
+				'is_departed'   => isset($params['is_departed']) ? $params['is_departed']: null,
154
+				'member_id'   => isset($params['member_id']) ? $params['member_id']: null,
155
+			),
156
+		));
157
+
158
+		return $address;
159 159
 	}
160 160
 	
161 161
 	public function markAsVisited($params)
162 162
 	{
163 163
 		$address = Route4Me::makeRequst(array(
164
-            'url'    => self::$apiUrVisited,
165
-            'method' => 'GET',
166
-            'query'  => array(
167
-                'route_id'   => isset($params['route_id']) ? $params['route_id']: null,
168
-                'address_id'   => isset($params['address_id']) ? $params['address_id']: null,
169
-                'is_visited'   => isset($params['is_visited']) ? $params['is_visited']: null,
170
-                'member_id'   => isset($params['member_id']) ? $params['member_id']: null,
171
-            ),
172
-        ));
173
-
174
-        return $address;
164
+			'url'    => self::$apiUrVisited,
165
+			'method' => 'GET',
166
+			'query'  => array(
167
+				'route_id'   => isset($params['route_id']) ? $params['route_id']: null,
168
+				'address_id'   => isset($params['address_id']) ? $params['address_id']: null,
169
+				'is_visited'   => isset($params['is_visited']) ? $params['is_visited']: null,
170
+				'member_id'   => isset($params['member_id']) ? $params['member_id']: null,
171
+			),
172
+		));
173
+
174
+		return $address;
175 175
 	}
176 176
 
177
-    public function delete()
178
-    {
179
-        $address = Route4Me::makeRequst(array(
180
-            'url'    => self::$apiUrl,
181
-            'method' => 'DELETE',
182
-            'query'  => array(
183
-                'route_id'             => $this->route_id,
184
-                'route_destination_id' => $this->route_destination_id,
185
-            )
186
-        ));
187
-
188
-        return (bool)$address['deleted'];
189
-    }
177
+	public function delete()
178
+	{
179
+		$address = Route4Me::makeRequst(array(
180
+			'url'    => self::$apiUrl,
181
+			'method' => 'DELETE',
182
+			'query'  => array(
183
+				'route_id'             => $this->route_id,
184
+				'route_destination_id' => $this->route_destination_id,
185
+			)
186
+		));
187
+
188
+		return (bool)$address['deleted'];
189
+	}
190 190
 	
191 191
 	public function MoveDestinationToRoute($params)
192 192
 	{
193 193
 		$result = Route4Me::makeRequst(array(
194
-            'url'    => self::$apiUrlMove,
195
-            'method' => 'POST',
196
-            'query'  => array(
197
-                'to_route_id' => isset($params['to_route_id']) ? $params['to_route_id'] : null,
198
-                'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
199
-                'after_destination_id' => isset($params['after_destination_id']) ? $params['after_destination_id'] : null
200
-            )
201
-        ));
202
-
203
-        return $result;
194
+			'url'    => self::$apiUrlMove,
195
+			'method' => 'POST',
196
+			'query'  => array(
197
+				'to_route_id' => isset($params['to_route_id']) ? $params['to_route_id'] : null,
198
+				'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
199
+				'after_destination_id' => isset($params['after_destination_id']) ? $params['after_destination_id'] : null
200
+			)
201
+		));
202
+
203
+		return $result;
204 204
 		
205 205
 	}
206 206
 
207
-    function getAddressId()
208
-    {
209
-        return $this->route_destination_id;
210
-    }
207
+	function getAddressId()
208
+	{
209
+		return $this->route_destination_id;
210
+	}
211 211
 }
Please login to merge, or discard this patch.
src/Route4Me/OptimizationProblem.php 4 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,6 @@
 block discarded – undo
8 8
 use Route4Me\OptimizationProblemParams;
9 9
 use Route4Me\Route;
10 10
 use Route4Me\Route4Me;
11
-use GuzzleHttp\Client;
12 11
 
13 12
 class OptimizationProblem extends Common
14 13
 {
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -155,7 +155,9 @@  discard block
 block discarded – undo
155 155
 		
156 156
 		$optimizations = array();
157 157
             foreach($json as $optimization) {
158
-				if (gettype($optimization)!="array") continue;
158
+				if (gettype($optimization)!="array") {
159
+					continue;
160
+				}
159 161
 				foreach ($optimization as $otp1) {
160 162
 					$optimizations[] = $otp1;
161 163
 				}
@@ -169,7 +171,9 @@  discard block
 block discarded – undo
169 171
 	
170 172
 	public function getAddresses($opt_id)
171 173
 	{
172
-		if ($opt_id==null) return null;
174
+		if ($opt_id==null) {
175
+			return null;
176
+		}
173 177
 		
174 178
 		$params = array( "optimization_problem_id" => $opt_id );
175 179
 		
Please login to merge, or discard this patch.
Indentation   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -12,157 +12,157 @@  discard block
 block discarded – undo
12 12
 
13 13
 class OptimizationProblem extends Common
14 14
 {
15
-    static public $apiUrl = '/api.v4/optimization_problem.php';
15
+	static public $apiUrl = '/api.v4/optimization_problem.php';
16 16
 	static public $apiUrl_addr = '/api.v4/address.php';
17
-    static public $apiHybridUrl = '/api.v4/hybrid_date_optimization.php';
18
-    static public $apiHybridDepotUrl = '/api/change_hybrid_optimization_depot.php';
17
+	static public $apiHybridUrl = '/api.v4/hybrid_date_optimization.php';
18
+	static public $apiHybridDepotUrl = '/api/change_hybrid_optimization_depot.php';
19 19
 
20
-    public $optimization_problem_id;
21
-    public $user_errors = array();
22
-    public $state;
23
-    public $parameters;
24
-    public $sent_to_background;
25
-    public $addresses = array();
26
-    public $routes = array();
27
-    public $links = array();
20
+	public $optimization_problem_id;
21
+	public $user_errors = array();
22
+	public $state;
23
+	public $parameters;
24
+	public $sent_to_background;
25
+	public $addresses = array();
26
+	public $routes = array();
27
+	public $links = array();
28 28
 
29
-    function __construct()
30
-    {
31
-        $this->parameters = new RouteParameters;
32
-    }
29
+	function __construct()
30
+	{
31
+		$this->parameters = new RouteParameters;
32
+	}
33 33
 
34
-    public static function fromArray(array $params)
35
-    {
36
-        $problem = new OptimizationProblem;
37
-        $problem->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
38
-        $problem->user_errors = Common::getValue($params, 'user_errors', array());
39
-        $problem->state = Common::getValue($params, 'state', array());
40
-        $problem->sent_to_background = Common::getValue($params, 'sent_to_background', array());
41
-        $problem->links = Common::getValue($params, 'links', array());
34
+	public static function fromArray(array $params)
35
+	{
36
+		$problem = new OptimizationProblem;
37
+		$problem->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
38
+		$problem->user_errors = Common::getValue($params, 'user_errors', array());
39
+		$problem->state = Common::getValue($params, 'state', array());
40
+		$problem->sent_to_background = Common::getValue($params, 'sent_to_background', array());
41
+		$problem->links = Common::getValue($params, 'links', array());
42 42
 
43
-        if (isset($params['parameters'])) {
44
-            $problem->parameters = RouteParameters::fromArray($params['parameters']);
45
-        }
43
+		if (isset($params['parameters'])) {
44
+			$problem->parameters = RouteParameters::fromArray($params['parameters']);
45
+		}
46 46
 
47
-        if (isset($params['addresses'])) {
48
-            $addresses = array();
49
-            foreach ($params['addresses'] as $address) {
50
-                $addresses[] = Address::fromArray($address);
51
-            }
52
-            $problem->addresses = $addresses;
53
-        }
47
+		if (isset($params['addresses'])) {
48
+			$addresses = array();
49
+			foreach ($params['addresses'] as $address) {
50
+				$addresses[] = Address::fromArray($address);
51
+			}
52
+			$problem->addresses = $addresses;
53
+		}
54 54
 
55
-        if (isset($params['routes'])) {
56
-            $routes = array();
57
-            foreach ($params['routes'] as $route) {
58
-                $routes[] = Route::fromArray($route);
59
-            }
60
-            $problem->routes = $routes;
61
-        }
55
+		if (isset($params['routes'])) {
56
+			$routes = array();
57
+			foreach ($params['routes'] as $route) {
58
+				$routes[] = Route::fromArray($route);
59
+			}
60
+			$problem->routes = $routes;
61
+		}
62 62
 
63
-        return $problem;
64
-    }
63
+		return $problem;
64
+	}
65 65
 
66
-    public static function optimize(OptimizationProblemParams $params)
67
-    {
68
-        $optimize = Route4Me::makeRequst(array(
69
-            'url'    => self::$apiUrl,
70
-            'method' => 'POST',
71
-            'query'  => array(
72
-                'redirect'               => isset($params->redirect) ? $params->redirect : null,
73
-                'directions'             => isset($params->directions) ? $params->directions: null, 
74
-                'format'                 => isset($params->format) ? $params->format: null,
75
-                'route_path_output'      => isset($params->route_path_output) ? $params->route_path_output: null,
76
-                'optimized_callback_url' => isset($params->optimized_callback_url) ? $params->optimized_callback_url: null
77
-            ),
78
-            'body'   => array(
79
-                'addresses'  => $params->getAddressesArray(),
80
-                'parameters' => $params->getParametersArray()
81
-            )
82
-        ));
66
+	public static function optimize(OptimizationProblemParams $params)
67
+	{
68
+		$optimize = Route4Me::makeRequst(array(
69
+			'url'    => self::$apiUrl,
70
+			'method' => 'POST',
71
+			'query'  => array(
72
+				'redirect'               => isset($params->redirect) ? $params->redirect : null,
73
+				'directions'             => isset($params->directions) ? $params->directions: null, 
74
+				'format'                 => isset($params->format) ? $params->format: null,
75
+				'route_path_output'      => isset($params->route_path_output) ? $params->route_path_output: null,
76
+				'optimized_callback_url' => isset($params->optimized_callback_url) ? $params->optimized_callback_url: null
77
+			),
78
+			'body'   => array(
79
+				'addresses'  => $params->getAddressesArray(),
80
+				'parameters' => $params->getParametersArray()
81
+			)
82
+		));
83 83
 
84
-        return OptimizationProblem::fromArray($optimize);
85
-    }
84
+		return OptimizationProblem::fromArray($optimize);
85
+	}
86 86
 
87
-    public static function get($params)
88
-    {
89
-        $optimize = Route4Me::makeRequst(array(
90
-            'url'    => self::$apiUrl,
91
-            'method' => 'GET',
92
-            'query'  => array(
93
-                'state' => isset($params['state']) ? $params['state'] : null,
94
-                'limit' => isset($params['limit']) ? $params['limit'] : null,
95
-                'offset' => isset($params['offset']) ? $params['offset'] : null,
96
-                'optimization_problem_id' => isset($params['optimization_problem_id']) 
97
-                    ? $params['optimization_problem_id'] : null,
98
-                'wait_for_final_state' => isset($params['wait_for_final_state']) 
99
-                    ? $params['wait_for_final_state'] : null,
100
-            )
101
-        ));
87
+	public static function get($params)
88
+	{
89
+		$optimize = Route4Me::makeRequst(array(
90
+			'url'    => self::$apiUrl,
91
+			'method' => 'GET',
92
+			'query'  => array(
93
+				'state' => isset($params['state']) ? $params['state'] : null,
94
+				'limit' => isset($params['limit']) ? $params['limit'] : null,
95
+				'offset' => isset($params['offset']) ? $params['offset'] : null,
96
+				'optimization_problem_id' => isset($params['optimization_problem_id']) 
97
+					? $params['optimization_problem_id'] : null,
98
+				'wait_for_final_state' => isset($params['wait_for_final_state']) 
99
+					? $params['wait_for_final_state'] : null,
100
+			)
101
+		));
102 102
 
103
-        if (isset($optimize['optimizations'])) {
104
-            $problems = array();
105
-            foreach($optimize['optimizations'] as $problem) {
106
-                $problems[] = OptimizationProblem::fromArray($problem);
107
-            }
108
-            return $problems;
109
-        } else {
110
-            return OptimizationProblem::fromArray($optimize);
111
-        }
112
-    }
103
+		if (isset($optimize['optimizations'])) {
104
+			$problems = array();
105
+			foreach($optimize['optimizations'] as $problem) {
106
+				$problems[] = OptimizationProblem::fromArray($problem);
107
+			}
108
+			return $problems;
109
+		} else {
110
+			return OptimizationProblem::fromArray($optimize);
111
+		}
112
+	}
113 113
 
114
-    public static function reoptimize($params)
115
-    {
116
-        $param = new OptimizationProblemParams;
117
-        $param->optimization_problem_id = isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null;
118
-        $param->reoptimize = 1;
114
+	public static function reoptimize($params)
115
+	{
116
+		$param = new OptimizationProblemParams;
117
+		$param->optimization_problem_id = isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null;
118
+		$param->reoptimize = 1;
119 119
 
120
-        return self::update((array)$param);
121
-    }
120
+		return self::update((array)$param);
121
+	}
122 122
 
123
-    public static function update($params)
124
-    {
123
+	public static function update($params)
124
+	{
125 125
 		$optimize = Route4Me::makeRequst(array(
126
-            'url'    => self::$apiUrl,
127
-            'method' => 'PUT',
128
-            'query'  => array(
129
-                'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
130
-                'addresses' => isset($params['addresses']) ? $params['addresses'] : null,
131
-                'reoptimize' => isset($params['reoptimize']) ? $params['reoptimize'] : null,
132
-            )
133
-        ));
126
+			'url'    => self::$apiUrl,
127
+			'method' => 'PUT',
128
+			'query'  => array(
129
+				'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
130
+				'addresses' => isset($params['addresses']) ? $params['addresses'] : null,
131
+				'reoptimize' => isset($params['reoptimize']) ? $params['reoptimize'] : null,
132
+			)
133
+		));
134 134
 		
135 135
 		return $optimize;
136
-    }
136
+	}
137 137
 
138
-    public function getOptimizationId()
139
-    {
140
-        return $this->optimization_problem_id;
141
-    }
138
+	public function getOptimizationId()
139
+	{
140
+		return $this->optimization_problem_id;
141
+	}
142 142
 
143
-    public function getRoutes()
144
-    {
145
-        return $this->routes;
146
-    }
143
+	public function getRoutes()
144
+	{
145
+		return $this->routes;
146
+	}
147 147
 	
148 148
 	public function getRandomOptimizationId($offset,$limit)
149 149
 	{
150 150
 		$query['limit'] = isset($params['limit']) ? $params['limit'] : 30;
151
-        $query['offset'] = isset($params['offset']) ? $params['offset'] : 0;
151
+		$query['offset'] = isset($params['offset']) ? $params['offset'] : 0;
152 152
 			
153 153
 		$json = Route4Me::makeRequst(array(
154
-            'url'    => self::$apiUrl,
155
-            'method' => 'GET',
156
-            'query'  => $query
157
-        ));
154
+			'url'    => self::$apiUrl,
155
+			'method' => 'GET',
156
+			'query'  => $query
157
+		));
158 158
 		
159 159
 		$optimizations = array();
160
-            foreach($json as $optimization) {
160
+			foreach($json as $optimization) {
161 161
 				if (gettype($optimization)!="array") continue;
162 162
 				foreach ($optimization as $otp1) {
163 163
 					$optimizations[] = $otp1;
164 164
 				}
165
-            }
165
+			}
166 166
 			
167 167
 			$num=rand(0,sizeof($optimizations)-1);
168 168
 			//echo "num=$num.<br>".sizeof($optimizations)."<br>";
@@ -202,13 +202,13 @@  discard block
 block discarded – undo
202 202
 	public function removeAddress($params)
203 203
 	{
204 204
 		$response = Route4Me::makeRequst(array(
205
-            'url'    => self::$apiUrl_addr,
206
-            'method' => 'DELETE',
207
-            'query'  => array(
208
-                'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
209
-                'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
210
-            )
211
-        ));
205
+			'url'    => self::$apiUrl_addr,
206
+			'method' => 'DELETE',
207
+			'query'  => array(
208
+				'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
209
+				'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
210
+			)
211
+		));
212 212
 		
213 213
 		return $response;
214 214
 	}
@@ -216,48 +216,48 @@  discard block
 block discarded – undo
216 216
 	public function removeOptimization($params)
217 217
 	{
218 218
 		$response = Route4Me::makeRequst(array(
219
-            'url'    => self::$apiUrl,
220
-            'method' => 'DELETE',
221
-            'query'  => array(
222
-                'redirect' => isset($params['redirect']) ? $params['redirect'] : null,
223
-            ),
224
-            'body'  => array(
219
+			'url'    => self::$apiUrl,
220
+			'method' => 'DELETE',
221
+			'query'  => array(
222
+				'redirect' => isset($params['redirect']) ? $params['redirect'] : null,
223
+			),
224
+			'body'  => array(
225 225
 				'optimization_problem_ids' => isset($params['optimization_problem_ids']) ? $params['optimization_problem_ids'] : null,
226 226
 			)
227
-        ));
227
+		));
228 228
 		
229 229
 		return $response;
230 230
 	}
231 231
     
232
-    public function getHybridOptimization($params)
233
-    {
234
-        $optimize = Route4Me::makeRequst(array(
235
-            'url'    => self::$apiHybridUrl,
236
-            'method' => 'GET',
237
-            'query'  => array(
238
-                'target_date_string' => isset($params['target_date_string']) ? $params['target_date_string'] : null,
239
-                'timezone_offset_minutes' => isset($params['timezone_offset_minutes']) ? $params['timezone_offset_minutes'] : null
240
-            )
241
-        ));
232
+	public function getHybridOptimization($params)
233
+	{
234
+		$optimize = Route4Me::makeRequst(array(
235
+			'url'    => self::$apiHybridUrl,
236
+			'method' => 'GET',
237
+			'query'  => array(
238
+				'target_date_string' => isset($params['target_date_string']) ? $params['target_date_string'] : null,
239
+				'timezone_offset_minutes' => isset($params['timezone_offset_minutes']) ? $params['timezone_offset_minutes'] : null
240
+			)
241
+		));
242 242
 
243
-        return $optimize;
244
-    }
243
+		return $optimize;
244
+	}
245 245
     
246
-    Public function addDepotsToHybrid($params)
247
-    {
248
-        $depots = Route4Me::makeRequst(array( 
249
-            'url'    => self::$apiHybridDepotUrl,
250
-            'method' => 'POST',
251
-            'query'  => array(
252
-                'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
253
-                ),
254
-            'body'  => array(
255
-                'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
256
-                'delete_old_depots' => isset($params['delete_old_depots']) ? $params['delete_old_depots'] : null,
257
-                'new_depots' => isset($params['new_depots']) ? $params['new_depots'] : null,
258
-            )
259
-        ));
246
+	Public function addDepotsToHybrid($params)
247
+	{
248
+		$depots = Route4Me::makeRequst(array( 
249
+			'url'    => self::$apiHybridDepotUrl,
250
+			'method' => 'POST',
251
+			'query'  => array(
252
+				'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
253
+				),
254
+			'body'  => array(
255
+				'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
256
+				'delete_old_depots' => isset($params['delete_old_depots']) ? $params['delete_old_depots'] : null,
257
+				'new_depots' => isset($params['new_depots']) ? $params['new_depots'] : null,
258
+			)
259
+		));
260 260
         
261
-        return $depots;
262
-    }
261
+		return $depots;
262
+	}
263 263
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
             'method' => 'POST',
71 71
             'query'  => array(
72 72
                 'redirect'               => isset($params->redirect) ? $params->redirect : null,
73
-                'directions'             => isset($params->directions) ? $params->directions: null, 
74
-                'format'                 => isset($params->format) ? $params->format: null,
75
-                'route_path_output'      => isset($params->route_path_output) ? $params->route_path_output: null,
76
-                'optimized_callback_url' => isset($params->optimized_callback_url) ? $params->optimized_callback_url: null
73
+                'directions'             => isset($params->directions) ? $params->directions : null, 
74
+                'format'                 => isset($params->format) ? $params->format : null,
75
+                'route_path_output'      => isset($params->route_path_output) ? $params->route_path_output : null,
76
+                'optimized_callback_url' => isset($params->optimized_callback_url) ? $params->optimized_callback_url : null
77 77
             ),
78 78
             'body'   => array(
79 79
                 'addresses'  => $params->getAddressesArray(),
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
         if (isset($optimize['optimizations'])) {
104 104
             $problems = array();
105
-            foreach($optimize['optimizations'] as $problem) {
105
+            foreach ($optimize['optimizations'] as $problem) {
106 106
                 $problems[] = OptimizationProblem::fromArray($problem);
107 107
             }
108 108
             return $problems;
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         return $this->routes;
146 146
     }
147 147
 	
148
-	public function getRandomOptimizationId($offset,$limit)
148
+	public function getRandomOptimizationId($offset, $limit)
149 149
 	{
150 150
 		$query['limit'] = isset($params['limit']) ? $params['limit'] : 30;
151 151
         $query['offset'] = isset($params['offset']) ? $params['offset'] : 0;
@@ -157,16 +157,16 @@  discard block
 block discarded – undo
157 157
         ));
158 158
 		
159 159
 		$optimizations = array();
160
-            foreach($json as $optimization) {
160
+            foreach ($json as $optimization) {
161 161
 				if (gettype($optimization)!="array") continue;
162 162
 				foreach ($optimization as $otp1) {
163 163
 					$optimizations[] = $otp1;
164 164
 				}
165 165
             }
166 166
 			
167
-			$num=rand(0,sizeof($optimizations)-1);
167
+			$num = rand(0, sizeof($optimizations) - 1);
168 168
 			//echo "num=$num.<br>".sizeof($optimizations)."<br>";
169
-			$rOptimization=$optimizations[$num];
169
+			$rOptimization = $optimizations[$num];
170 170
 			return $rOptimization;
171 171
 	}
172 172
 	
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	{
175 175
 		if ($opt_id==null) return null;
176 176
 		
177
-		$params = array( "optimization_problem_id" => $opt_id );
177
+		$params = array("optimization_problem_id" => $opt_id);
178 178
 		
179 179
 		$optimization = (array)$this->get($params);
180 180
 		
@@ -188,13 +188,13 @@  discard block
 block discarded – undo
188 188
 	{
189 189
 		$addresses = (array)$this->getAddresses($opt_id);
190 190
 		
191
-		if ($addresses == null) {
191
+		if ($addresses==null) {
192 192
 			echo "There are no addresses in this optimization!.. Try again.";
193 193
 			return null;
194 194
 		}
195 195
 		
196
-		$num=rand(0,sizeof($addresses)-1);
197
-		$rAddress=$addresses[$num];
196
+		$num = rand(0, sizeof($addresses) - 1);
197
+		$rAddress = $addresses[$num];
198 198
 		
199 199
 		return $rAddress;
200 200
 	}
Please login to merge, or discard this patch.
src/Route4Me/Route.php 4 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -4,10 +4,8 @@
 block discarded – undo
4 4
 
5 5
 use Route4Me\Common;
6 6
 use Route4Me\Address;
7
-use Route4Me\Exception\BadParam;
8 7
 use Route4Me\RouteParameters;
9 8
 use Route4Me\Route4Me;
10
-use GuzzleHttp\Client;
11 9
 
12 10
 class Route extends Common
13 11
 {
Please login to merge, or discard this patch.
Indentation   +274 added lines, -274 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 class Route extends Common
13 13
 {
14
-    static public $apiUrl = '/api.v4/route.php';
14
+	static public $apiUrl = '/api.v4/route.php';
15 15
 	static public $apiUrlAddress = '/api.v4/address.php';
16 16
 	static public $apiUrlDuplicate='/actions/duplicate_route.php';
17 17
 	static public $apiUrlDelete='/actions/delete_routes.php';
@@ -22,21 +22,21 @@  discard block
 block discarded – undo
22 22
 	static public $apiUrlAsset='/api.v4/status.php';
23 23
 	static public $apiUrlDeviceLocation='/api/track/get_device_location.php';
24 24
 	//static public $apiUrlMove='/actions/route/move_route_destination.php';
25
-    public $route_id;
25
+	public $route_id;
26 26
 	public $route_destination_id;
27
-    public $optimization_problem_id;
28
-    public $vehicle_alias;
29
-    public $driver_alias;
30
-    public $trip_distance;
31
-    public $mpg;
32
-    public $gas_price;
33
-    public $route_duration_sec;
34
-    public $parameters;
35
-    public $addresses = array();
36
-    public $links = array();
37
-    public $directions = array();
38
-    public $path = array();
39
-    public $tracking_history = array();
27
+	public $optimization_problem_id;
28
+	public $vehicle_alias;
29
+	public $driver_alias;
30
+	public $trip_distance;
31
+	public $mpg;
32
+	public $gas_price;
33
+	public $route_duration_sec;
34
+	public $parameters;
35
+	public $addresses = array();
36
+	public $links = array();
37
+	public $directions = array();
38
+	public $path = array();
39
+	public $tracking_history = array();
40 40
 	public $recipient_email;
41 41
 	public $httpheaders;
42 42
 	public $is_unrouted;
@@ -44,101 +44,101 @@  discard block
 block discarded – undo
44 44
 	public $dev_lat;
45 45
 	public $dev_lng;
46 46
 
47
-    public static function fromArray(array $params) 
48
-    {
49
-        $route = new Route();
50
-        $route->route_id = Common::getValue($params, 'route_id');
51
-        $route->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
52
-        $route->vehicle_alias = Common::getValue($params, 'vehicle_alias');
53
-        $route->driver_alias = Common::getValue($params, 'driver_alias');
54
-        $route->trip_distance = Common::getValue($params, 'trip_distance');
55
-        $route->mpg = Common::getValue($params, 'mpg');
56
-        $route->gas_price = Common::getValue($params, 'gas_price');
57
-        $route->route_duration_sec = Common::getvalue($params, 'route_duration_sec');
58
-        $route->is_unrouted = Common::getvalue($params, 'is_unrouted');
59
-
60
-        // Make RouteParameters
61
-        if (isset($params['parameters'])) {
62
-            $route->parameters = RouteParameters::fromArray($params['parameters']);
63
-        }
64
-
65
-        if (isset($params['addresses'])) {
66
-            $addresses = array();
67
-            foreach ($params['addresses'] as $address) {
68
-                $addresses[] = Address::fromArray($address);
69
-            }
70
-
71
-            $route->addresses = $addresses;
72
-        }
73
-
74
-        $route->links = Common::getValue($params, 'links', array());
75
-        $route->directions = Common::getValue($params, 'directions', array());
76
-        $route->path = Common::getValue($params, 'path', array());
77
-        $route->tracking_history = Common::getValue($params, 'tracking_history', array());
78
-
79
-        return $route;
80
-    }
81
-
82
-    public static function getRoutes($routeId=null, $params=null)
83
-    {
84
-        $query = array(
85
-            'api_key' => Route4Me::getApiKey()
86
-        );
87
-
88
-        if ($routeId) {
89
-            $query['route_id'] = implode(',', (array) $routeId);
90
-        }
91
-
92
-        if ($params) {
93
-            if (isset($params['directions'])) {
94
-                $query['directions'] = $params['directions'];
95
-            }
96
-
97
-            if (isset($params['route_path_output'])) {
98
-                $query['route_path_output'] = $params['route_path_output'];
99
-            }
100
-
101
-            if (isset($params['device_tracking_history'])) {
102
-                $query['device_tracking_history'] = $params['device_tracking_history'];
103
-            }
47
+	public static function fromArray(array $params) 
48
+	{
49
+		$route = new Route();
50
+		$route->route_id = Common::getValue($params, 'route_id');
51
+		$route->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
52
+		$route->vehicle_alias = Common::getValue($params, 'vehicle_alias');
53
+		$route->driver_alias = Common::getValue($params, 'driver_alias');
54
+		$route->trip_distance = Common::getValue($params, 'trip_distance');
55
+		$route->mpg = Common::getValue($params, 'mpg');
56
+		$route->gas_price = Common::getValue($params, 'gas_price');
57
+		$route->route_duration_sec = Common::getvalue($params, 'route_duration_sec');
58
+		$route->is_unrouted = Common::getvalue($params, 'is_unrouted');
59
+
60
+		// Make RouteParameters
61
+		if (isset($params['parameters'])) {
62
+			$route->parameters = RouteParameters::fromArray($params['parameters']);
63
+		}
64
+
65
+		if (isset($params['addresses'])) {
66
+			$addresses = array();
67
+			foreach ($params['addresses'] as $address) {
68
+				$addresses[] = Address::fromArray($address);
69
+			}
70
+
71
+			$route->addresses = $addresses;
72
+		}
73
+
74
+		$route->links = Common::getValue($params, 'links', array());
75
+		$route->directions = Common::getValue($params, 'directions', array());
76
+		$route->path = Common::getValue($params, 'path', array());
77
+		$route->tracking_history = Common::getValue($params, 'tracking_history', array());
78
+
79
+		return $route;
80
+	}
81
+
82
+	public static function getRoutes($routeId=null, $params=null)
83
+	{
84
+		$query = array(
85
+			'api_key' => Route4Me::getApiKey()
86
+		);
87
+
88
+		if ($routeId) {
89
+			$query['route_id'] = implode(',', (array) $routeId);
90
+		}
91
+
92
+		if ($params) {
93
+			if (isset($params['directions'])) {
94
+				$query['directions'] = $params['directions'];
95
+			}
96
+
97
+			if (isset($params['route_path_output'])) {
98
+				$query['route_path_output'] = $params['route_path_output'];
99
+			}
100
+
101
+			if (isset($params['device_tracking_history'])) {
102
+				$query['device_tracking_history'] = $params['device_tracking_history'];
103
+			}
104 104
 			
105 105
 			if (isset($params['query'])) {
106
-                $query['query'] = $params['query'];
107
-            }
106
+				$query['query'] = $params['query'];
107
+			}
108 108
 
109
-            $query['limit'] = isset($params['limit']) ? $params['limit'] : 30;
110
-            $query['offset'] = isset($params['offset']) ? $params['offset'] : 0;
111
-        }
112
-
113
-        $json = Route4Me::makeRequst(array(
114
-            'url'    => self::$apiUrl,
115
-            'method' => 'GET',
116
-            'query'  => $query
117
-        ));
109
+			$query['limit'] = isset($params['limit']) ? $params['limit'] : 30;
110
+			$query['offset'] = isset($params['offset']) ? $params['offset'] : 0;
111
+		}
118 112
 
119
-        if ($routeId) {
120
-            return Route::fromArray($json); die("");
121
-        } else {
122
-            $routes = array();
123
-            foreach($json as $route) {
124
-                $routes[] = Route::fromArray($route);
125
-            }
126
-            return $routes;
127
-        }
128
-    }
113
+		$json = Route4Me::makeRequst(array(
114
+			'url'    => self::$apiUrl,
115
+			'method' => 'GET',
116
+			'query'  => $query
117
+		));
118
+
119
+		if ($routeId) {
120
+			return Route::fromArray($json); die("");
121
+		} else {
122
+			$routes = array();
123
+			foreach($json as $route) {
124
+				$routes[] = Route::fromArray($route);
125
+			}
126
+			return $routes;
127
+		}
128
+	}
129 129
 
130 130
 	public function getRoutePoints($routeId, $params)
131 131
 	{
132 132
 		$result = Route4Me::makeRequst(array(
133
-            'url'    => self::$apiUrl,
134
-            'method' => 'GET',
135
-            'query'  => array(
136
-            	'api_key' => Route4Me::getApiKey(),
137
-                'route_id' => $routeId,
138
-                'route_path_output' => isset($params['route_path_output']) ? $params['route_path_output'] : null,
139
-                'directions' => isset($params['directions']) ? $params['directions'] : null,
140
-            )
141
-        ));
133
+			'url'    => self::$apiUrl,
134
+			'method' => 'GET',
135
+			'query'  => array(
136
+				'api_key' => Route4Me::getApiKey(),
137
+				'route_id' => $routeId,
138
+				'route_path_output' => isset($params['route_path_output']) ? $params['route_path_output'] : null,
139
+				'directions' => isset($params['directions']) ? $params['directions'] : null,
140
+			)
141
+		));
142 142
 
143 143
 		return $result;
144 144
 	}
@@ -146,14 +146,14 @@  discard block
 block discarded – undo
146 146
 	public function duplicateRoute($route_id)
147 147
 	{
148 148
 		$result = Route4Me::makeRequst(array(
149
-            'url'    => self::$apiUrlDuplicate,
150
-            'method' => 'GET',
151
-            'query'  => array(
152
-            	'api_key' => Route4Me::getApiKey(),
153
-                'route_id' => $route_id,
154
-                'to' => 'none',
155
-            )
156
-        ));
149
+			'url'    => self::$apiUrlDuplicate,
150
+			'method' => 'GET',
151
+			'query'  => array(
152
+				'api_key' => Route4Me::getApiKey(),
153
+				'route_id' => $route_id,
154
+				'to' => 'none',
155
+			)
156
+		));
157 157
 		
158 158
 		return $result;
159 159
 	}
@@ -161,17 +161,17 @@  discard block
 block discarded – undo
161 161
 	public function resequenceRoute($params)
162 162
 	{
163 163
 		$result = Route4Me::makeRequst(array(
164
-            'url'    => self::$apiUrl,
165
-            'method' => 'PUT',
166
-            'query'  => array(
167
-            	'api_key' => Route4Me::getApiKey(),
168
-                'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
169
-                'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
170
-            ),
171
-            'body'  => array(
164
+			'url'    => self::$apiUrl,
165
+			'method' => 'PUT',
166
+			'query'  => array(
167
+				'api_key' => Route4Me::getApiKey(),
168
+				'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
169
+				'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
170
+			),
171
+			'body'  => array(
172 172
 				'addresses' => isset($params['addresses']) ? $params['addresses'] : null,
173 173
 			)
174
-        ));
174
+		));
175 175
 		
176 176
 		return $result;
177 177
 	}
@@ -179,15 +179,15 @@  discard block
 block discarded – undo
179 179
 	public function resequenceAllAddresses($params)
180 180
 	{
181 181
 		$result = Route4Me::makeRequst(array(
182
-            'url'    => self::$apiUrlReseq,
183
-            'method' => 'GET',
184
-            'query'  => array(
185
-            	'api_key' => Route4Me::getApiKey(),
186
-                'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
187
-                'disable_optimization' => isset($params['disable_optimization']) ? $params['disable_optimization'] : null,
188
-                'optimize' => isset($params['optimize']) ? $params['optimize'] : null,
189
-            )
190
-        ));
182
+			'url'    => self::$apiUrlReseq,
183
+			'method' => 'GET',
184
+			'query'  => array(
185
+				'api_key' => Route4Me::getApiKey(),
186
+				'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
187
+				'disable_optimization' => isset($params['disable_optimization']) ? $params['disable_optimization'] : null,
188
+				'optimize' => isset($params['optimize']) ? $params['optimize'] : null,
189
+			)
190
+		));
191 191
 		
192 192
 		return $result;
193 193
 		
@@ -196,16 +196,16 @@  discard block
 block discarded – undo
196 196
 	public function mergeRoutes($params)
197 197
 	{
198 198
 		$result = Route4Me::makeRequst(array(
199
-            'url'    => self::$apiUrlMerge,
200
-            'method' => 'POST',
201
-            'query'  => array(
202
-            	'api_key' => Route4Me::getApiKey(),
203
-            ),
204
-            'body'  => array(
199
+			'url'    => self::$apiUrlMerge,
200
+			'method' => 'POST',
201
+			'query'  => array(
202
+				'api_key' => Route4Me::getApiKey(),
203
+			),
204
+			'body'  => array(
205 205
 				'route_ids' => isset($params['route_ids']) ? $params['route_ids'] : null,
206 206
 			),
207 207
 			'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
208
-        ));
208
+		));
209 209
 		
210 210
 		return $result;
211 211
 	}
@@ -213,17 +213,17 @@  discard block
 block discarded – undo
213 213
 	public function shareRoute($params)
214 214
 	{
215 215
 		$result = Route4Me::makeRequst(array(
216
-            'url'    => self::$apiUrlShare,
217
-            'method' => 'POST',
218
-            'query'  => array(
219
-            	'api_key' => Route4Me::getApiKey(),
220
-            	'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
221
-            ),
222
-            'body'  => array(
216
+			'url'    => self::$apiUrlShare,
217
+			'method' => 'POST',
218
+			'query'  => array(
219
+				'api_key' => Route4Me::getApiKey(),
220
+				'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
221
+			),
222
+			'body'  => array(
223 223
 				'recipient_email' => isset($params['recipient_email']) ? $params['recipient_email'] : null,
224 224
 			),
225 225
 			'Content-Type' => 'multipart/form-data'
226
-        ));
226
+		));
227 227
 		
228 228
 		return $result;
229 229
 	}
@@ -232,98 +232,98 @@  discard block
 block discarded – undo
232 232
 	public function getRandomRouteId($offset,$limit)
233 233
 	{
234 234
 		$query['limit'] = isset($params['limit']) ? $params['limit'] : 30;
235
-        $query['offset'] = isset($params['offset']) ? $params['offset'] : 0;
235
+		$query['offset'] = isset($params['offset']) ? $params['offset'] : 0;
236 236
 			
237 237
 		$json = Route4Me::makeRequst(array(
238
-            'url'    => self::$apiUrl,
239
-            'method' => 'GET',
240
-            'query'  => $query
241
-        ));
238
+			'url'    => self::$apiUrl,
239
+			'method' => 'GET',
240
+			'query'  => $query
241
+		));
242 242
         
243
-        if (sizeof($json)>0) {
244
-            $routes = array();
245
-            foreach($json as $route) {
246
-                $routes[] = Route::fromArray($route);
247
-            }
243
+		if (sizeof($json)>0) {
244
+			$routes = array();
245
+			foreach($json as $route) {
246
+				$routes[] = Route::fromArray($route);
247
+			}
248 248
             
249
-            $num=rand(0,sizeof($routes)-1);
250
-            $rRoute=(array)$routes[$num];
249
+			$num=rand(0,sizeof($routes)-1);
250
+			$rRoute=(array)$routes[$num];
251 251
             
252
-            if (is_array($rRoute)) 
253
-            {
254
-                return $rRoute["route_id"];
255
-            }
256
-            else return null;
257
-        } else return null;
252
+			if (is_array($rRoute)) 
253
+			{
254
+				return $rRoute["route_id"];
255
+			}
256
+			else return null;
257
+		} else return null;
258 258
 		
259 259
 		
260 260
 	}
261 261
 
262
-    public function update()
263
-    {
264
-        $route = Route4Me::makeRequst(array(
265
-            'url'    => self::$apiUrl,
266
-            'method' => 'PUT',
267
-            'query'  => array(
268
-                'route_id' => isset($this->route_id) ? $this->route_id : null,
269
-                'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
270
-            ),
271
-            'body' => array (
272
-            	'parameters' => $this->parameters,
273
-            	),
274
-            'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
275
-        ));
262
+	public function update()
263
+	{
264
+		$route = Route4Me::makeRequst(array(
265
+			'url'    => self::$apiUrl,
266
+			'method' => 'PUT',
267
+			'query'  => array(
268
+				'route_id' => isset($this->route_id) ? $this->route_id : null,
269
+				'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
270
+			),
271
+			'body' => array (
272
+				'parameters' => $this->parameters,
273
+				),
274
+			'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
275
+		));
276 276
 
277
-        return Route::fromArray($route);
278
-    }
277
+		return Route::fromArray($route);
278
+	}
279 279
 	
280 280
 	public function updateAddress()
281
-    {
282
-        $result = Route4Me::makeRequst(array(
283
-            'url'    => self::$apiUrlAddress,
284
-            'method' => 'PUT',
285
-            'query'  => array(
286
-                'route_id' => isset($this->route_id) ? $this->route_id : null,
287
-                'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
288
-            ),
289
-            'body' => get_object_vars($this->parameters),
290
-            'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
291
-        ));
281
+	{
282
+		$result = Route4Me::makeRequst(array(
283
+			'url'    => self::$apiUrlAddress,
284
+			'method' => 'PUT',
285
+			'query'  => array(
286
+				'route_id' => isset($this->route_id) ? $this->route_id : null,
287
+				'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
288
+			),
289
+			'body' => get_object_vars($this->parameters),
290
+			'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
291
+		));
292 292
 
293
-        return $result;
294
-    }
293
+		return $result;
294
+	}
295 295
 
296
-    public function addAddresses(array $params)
297
-    {
298
-        $route = Route4Me::makeRequst(array(
299
-            'url'    => self::$apiUrl,
300
-            'method' => 'PUT',
301
-            'query'  => array(
302
-            	'api_key' => Route4Me::getApiKey(),
303
-                'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
304
-                'addresses' => isset($params['addresses']) ? $params['addresses'] : null
305
-            )
306
-        ));
296
+	public function addAddresses(array $params)
297
+	{
298
+		$route = Route4Me::makeRequst(array(
299
+			'url'    => self::$apiUrl,
300
+			'method' => 'PUT',
301
+			'query'  => array(
302
+				'api_key' => Route4Me::getApiKey(),
303
+				'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
304
+				'addresses' => isset($params['addresses']) ? $params['addresses'] : null
305
+			)
306
+		));
307 307
 
308
-        return Route::fromArray($route);
309
-    }
308
+		return Route::fromArray($route);
309
+	}
310 310
 	
311 311
 	public function insertAddressOptimalPosition(array $params)
312 312
 	{
313 313
 		$route = Route4Me::makeRequst(array(
314
-            'url'    => self::$apiUrl,
315
-            'method' => 'PUT',
316
-            'query'  => array(
317
-            	'api_key' => Route4Me::getApiKey(),
318
-                'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
319
-            ),
320
-            'body'  => array(
314
+			'url'    => self::$apiUrl,
315
+			'method' => 'PUT',
316
+			'query'  => array(
317
+				'api_key' => Route4Me::getApiKey(),
318
+				'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
319
+			),
320
+			'body'  => array(
321 321
 				'addresses' => isset($params['addresses']) ? $params['addresses'] : null,
322 322
 				'optimal_position' => isset($params['optimal_position']) ? $params['optimal_position'] : null,
323 323
 			)
324
-        ));
324
+		));
325 325
 
326
-        return Route::fromArray($route);
326
+		return Route::fromArray($route);
327 327
 	}
328 328
 	
329 329
 	public function addNoteFile($params)
@@ -332,18 +332,18 @@  discard block
 block discarded – undo
332 332
 		$rpath = realpath($fname);
333 333
 		//echo $rpath;die("");
334 334
 		$result= Route4Me::makeRequst(array(
335
-            'url'    => self::$apiUrlNoteFile,
336
-            'method' => 'POST',
337
-            'query'  => array(
338
-            	'api_key' => Route4Me::getApiKey(),
339
-                'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
340
-                'address_id' => isset($params['address_id']) ? $params['address_id'] : null,
341
-                'dev_lat' => isset($params['dev_lat']) ? $params['dev_lat'] : null,
342
-                'dev_lng' => isset($params['dev_lng']) ? $params['dev_lng'] : null,
343
-                'device_type' => isset($params['device_type']) ? $params['device_type'] : null,
344
-                'dev_lng' => isset($params['dev_lng']) ? $params['dev_lng'] : null,
345
-            ),
346
-            'body'  => array(
335
+			'url'    => self::$apiUrlNoteFile,
336
+			'method' => 'POST',
337
+			'query'  => array(
338
+				'api_key' => Route4Me::getApiKey(),
339
+				'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
340
+				'address_id' => isset($params['address_id']) ? $params['address_id'] : null,
341
+				'dev_lat' => isset($params['dev_lat']) ? $params['dev_lat'] : null,
342
+				'dev_lng' => isset($params['dev_lng']) ? $params['dev_lng'] : null,
343
+				'device_type' => isset($params['device_type']) ? $params['device_type'] : null,
344
+				'dev_lng' => isset($params['dev_lng']) ? $params['dev_lng'] : null,
345
+			),
346
+			'body'  => array(
347 347
 				'strUpdateType' => isset($params['strUpdateType']) ? $params['strUpdateType'] : null,
348 348
 				'strFilename' => isset($params['strFilename']) ? $params['strFilename'] : null,
349 349
 				'strNoteContents' => isset($params['strNoteContents']) ? $params['strNoteContents'] : null,
@@ -353,18 +353,18 @@  discard block
 block discarded – undo
353 353
 			'HTTPHEADER' => array(
354 354
 				'Content-Type: application/x-www-form-urlencoded'
355 355
 			)
356
-        ));
356
+		));
357 357
 
358
-        return $result;
358
+		return $result;
359 359
 	}
360 360
 
361
-    public function delete($route_id)
362
-    {
363
-        $result = Route4Me::makeRequst(array(
364
-            'url'    => self::$apiUrl,
365
-            'method' => 'DELETE',
366
-            'query'  => array( 'route_id' => $route_id )
367
-        ));
361
+	public function delete($route_id)
362
+	{
363
+		$result = Route4Me::makeRequst(array(
364
+			'url'    => self::$apiUrl,
365
+			'method' => 'DELETE',
366
+			'query'  => array( 'route_id' => $route_id )
367
+		));
368 368
 		
369 369
 		// The code below doesn't work, altough this method is described as workable in REST API 
370 370
 		/*
@@ -377,8 +377,8 @@  discard block
 block discarded – undo
377 377
             )
378 378
         ));
379 379
 		*/
380
-        return $result;
381
-    }
380
+		return $result;
381
+	}
382 382
 	
383 383
 	public function GetAddressesFromRoute($route_id)
384 384
 	{
@@ -402,63 +402,63 @@  discard block
 block discarded – undo
402 402
 		} else { return null;}
403 403
 	}
404 404
 
405
-    public function getRouteId()
406
-    {
407
-        return $this->route_id;
408
-    }
405
+	public function getRouteId()
406
+	{
407
+		return $this->route_id;
408
+	}
409 409
 
410
-    public function getOptimizationId()
411
-    {
412
-        return $this->optimization_problem_id;
413
-    }
410
+	public function getOptimizationId()
411
+	{
412
+		return $this->optimization_problem_id;
413
+	}
414 414
 	
415 415
 	public function GetLastLocation(array $params)
416 416
 	{
417 417
 		$route = Route4Me::makeRequst(array(
418
-            'url'    => self::$apiUrl,
419
-            'method' => 'GET',
420
-            'query'  => array(
421
-            	'api_key' => Route4Me::getApiKey(),
422
-                'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
423
-                'device_tracking_history' => isset($params['device_tracking_history']) ? $params['device_tracking_history'] : null
424
-            )
425
-        ));
418
+			'url'    => self::$apiUrl,
419
+			'method' => 'GET',
420
+			'query'  => array(
421
+				'api_key' => Route4Me::getApiKey(),
422
+				'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
423
+				'device_tracking_history' => isset($params['device_tracking_history']) ? $params['device_tracking_history'] : null
424
+			)
425
+		));
426 426
 
427
-        return Route::fromArray($route);
427
+		return Route::fromArray($route);
428 428
 		
429 429
 	}
430 430
 	
431 431
 	public function GetTrackingHistoryFromTimeRange(array $params)
432 432
 	{
433 433
 		$route = Route4Me::makeRequst(array(
434
-            'url'    => self::$apiUrlDeviceLocation,
435
-            'method' => 'GET',
436
-            'query'  => array(
437
-            	'api_key' => Route4Me::getApiKey(),
438
-                'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
439
-                'format' => isset($params['format']) ? $params['format'] : null,
440
-                'time_period' => isset($params['time_period']) ? $params['time_period'] : null,
441
-                'start_date' => isset($params['start_date']) ? $params['start_date'] : null,
442
-                'end_date' => isset($params['end_date']) ? $params['end_date'] : null
443
-                )
444
-        ));
445
-
446
-        return $route;
434
+			'url'    => self::$apiUrlDeviceLocation,
435
+			'method' => 'GET',
436
+			'query'  => array(
437
+				'api_key' => Route4Me::getApiKey(),
438
+				'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
439
+				'format' => isset($params['format']) ? $params['format'] : null,
440
+				'time_period' => isset($params['time_period']) ? $params['time_period'] : null,
441
+				'start_date' => isset($params['start_date']) ? $params['start_date'] : null,
442
+				'end_date' => isset($params['end_date']) ? $params['end_date'] : null
443
+				)
444
+		));
445
+
446
+		return $route;
447 447
 		
448 448
 	}
449 449
 	
450 450
 	public function GetAssetTracking(array $params)
451 451
 	{
452 452
 		$route = Route4Me::makeRequst(array(
453
-            'url'    => self::$apiUrlAsset,
454
-            'method' => 'GET',
455
-            'query'  => array(
456
-            	'api_key' => Route4Me::getApiKey(),
457
-                'tracking' => isset($params['tracking']) ? $params['tracking'] : null
458
-                )
459
-        ));
460
-
461
-        return $route;
453
+			'url'    => self::$apiUrlAsset,
454
+			'method' => 'GET',
455
+			'query'  => array(
456
+				'api_key' => Route4Me::getApiKey(),
457
+				'tracking' => isset($params['tracking']) ? $params['tracking'] : null
458
+				)
459
+		));
460
+
461
+		return $route;
462 462
 		
463 463
 	}
464 464
 }
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@  discard block
 block discarded – undo
13 13
 {
14 14
     static public $apiUrl = '/api.v4/route.php';
15 15
 	static public $apiUrlAddress = '/api.v4/address.php';
16
-	static public $apiUrlDuplicate='/actions/duplicate_route.php';
17
-	static public $apiUrlDelete='/actions/delete_routes.php';
18
-	static public $apiUrlReseq='/api.v3/route/reoptimize_2.php';
19
-	static public $apiUrlMerge='/actions/merge_routes.php';
20
-	static public $apiUrlShare='/actions/route/share_route.php';
21
-	static public $apiUrlNoteFile='/actions/addRouteNotes.php';
22
-	static public $apiUrlAsset='/api.v4/status.php';
23
-	static public $apiUrlDeviceLocation='/api/track/get_device_location.php';
16
+	static public $apiUrlDuplicate = '/actions/duplicate_route.php';
17
+	static public $apiUrlDelete = '/actions/delete_routes.php';
18
+	static public $apiUrlReseq = '/api.v3/route/reoptimize_2.php';
19
+	static public $apiUrlMerge = '/actions/merge_routes.php';
20
+	static public $apiUrlShare = '/actions/route/share_route.php';
21
+	static public $apiUrlNoteFile = '/actions/addRouteNotes.php';
22
+	static public $apiUrlAsset = '/api.v4/status.php';
23
+	static public $apiUrlDeviceLocation = '/api/track/get_device_location.php';
24 24
 	//static public $apiUrlMove='/actions/route/move_route_destination.php';
25 25
     public $route_id;
26 26
 	public $route_destination_id;
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
         return $route;
80 80
     }
81 81
 
82
-    public static function getRoutes($routeId=null, $params=null)
82
+    public static function getRoutes($routeId = null, $params = null)
83 83
     {
84 84
         $query = array(
85 85
             'api_key' => Route4Me::getApiKey()
86 86
         );
87 87
 
88 88
         if ($routeId) {
89
-            $query['route_id'] = implode(',', (array) $routeId);
89
+            $query['route_id'] = implode(',', (array)$routeId);
90 90
         }
91 91
 
92 92
         if ($params) {
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
             return Route::fromArray($json); die("");
121 121
         } else {
122 122
             $routes = array();
123
-            foreach($json as $route) {
123
+            foreach ($json as $route) {
124 124
                 $routes[] = Route::fromArray($route);
125 125
             }
126 126
             return $routes;
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	}
230 230
 	
231 231
 	// Getting random route_id from existing routes between $offset and $offset+$limit
232
-	public function getRandomRouteId($offset,$limit)
232
+	public function getRandomRouteId($offset, $limit)
233 233
 	{
234 234
 		$query['limit'] = isset($params['limit']) ? $params['limit'] : 30;
235 235
         $query['offset'] = isset($params['offset']) ? $params['offset'] : 0;
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
         
243 243
         if (sizeof($json)>0) {
244 244
             $routes = array();
245
-            foreach($json as $route) {
245
+            foreach ($json as $route) {
246 246
                 $routes[] = Route::fromArray($route);
247 247
             }
248 248
             
249
-            $num=rand(0,sizeof($routes)-1);
250
-            $rRoute=(array)$routes[$num];
249
+            $num = rand(0, sizeof($routes) - 1);
250
+            $rRoute = (array)$routes[$num];
251 251
             
252 252
             if (is_array($rRoute)) 
253 253
             {
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
                 'route_id' => isset($this->route_id) ? $this->route_id : null,
269 269
                 'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
270 270
             ),
271
-            'body' => array (
271
+            'body' => array(
272 272
             	'parameters' => $this->parameters,
273 273
             	),
274 274
             'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 		$fname = isset($params['strFilename']) ? $params['strFilename'] : null;
332 332
 		$rpath = realpath($fname);
333 333
 		//echo $rpath;die("");
334
-		$result= Route4Me::makeRequst(array(
334
+		$result = Route4Me::makeRequst(array(
335 335
             'url'    => self::$apiUrlNoteFile,
336 336
             'method' => 'POST',
337 337
             'query'  => array(
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
         $result = Route4Me::makeRequst(array(
364 364
             'url'    => self::$apiUrl,
365 365
             'method' => 'DELETE',
366
-            'query'  => array( 'route_id' => $route_id )
366
+            'query'  => array('route_id' => $route_id)
367 367
         ));
368 368
 		
369 369
 		// The code below doesn't work, altough this method is described as workable in REST API 
@@ -382,24 +382,24 @@  discard block
 block discarded – undo
382 382
 	
383 383
 	public function GetAddressesFromRoute($route_id)
384 384
 	{
385
-		$route1=Route::getRoutes($route_id,null);
385
+		$route1 = Route::getRoutes($route_id, null);
386 386
 		if (isset($route1)) {
387 387
 			return $route1->addresses();
388
-		} else { return null;}
388
+		} else { return null; }
389 389
 	}
390 390
 	
391 391
 	public function GetRandomAddressFromRoute($route_id)
392 392
 	{
393
-		$route1=Route::getRoutes($route_id,null);
393
+		$route1 = Route::getRoutes($route_id, null);
394 394
 		
395 395
 		if (isset($route1)) {
396
-			$addresses=$route1->addresses;
396
+			$addresses = $route1->addresses;
397 397
 			
398
-			$rnd=rand(0,sizeof($addresses)-1);
398
+			$rnd = rand(0, sizeof($addresses) - 1);
399 399
 			
400 400
 			return $addresses[$rnd];
401 401
 			
402
-		} else { return null;}
402
+		} else { return null; }
403 403
 	}
404 404
 
405 405
     public function getRouteId()
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -252,9 +252,12 @@
 block discarded – undo
252 252
             if (is_array($rRoute)) 
253 253
             {
254 254
                 return $rRoute["route_id"];
255
+            } else {
256
+            	return null;
255 257
             }
256
-            else return null;
257
-        } else return null;
258
+        } else {
259
+        	return null;
260
+        }
258 261
 		
259 262
 		
260 263
 	}
Please login to merge, or discard this patch.
examples/Geocoding/get_street_adddresses_limit.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 	
4 4
 	$vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
5 5
 
6
-    require $vdir.'/../vendor/autoload.php';
6
+	require $vdir.'/../vendor/autoload.php';
7 7
 	
8 8
 	use Route4Me\Route4Me;
9 9
 	use Route4Me\Geocoding;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 	namespace Route4Me;
3 3
 	
4
-	$vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
4
+	$vdir = $_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
5 5
 
6 6
     require $vdir.'/../vendor/autoload.php';
7 7
 	
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	// Set the api key in the Route4me class
14 14
 	Route4Me::setApiKey('11111111111111111111111111111111');
15 15
 
16
-	$gcParameters=(array)Geocoding::fromArray(array(
16
+	$gcParameters = (array)Geocoding::fromArray(array(
17 17
 		"offset" => 0,
18 18
 		"limit" => 20
19 19
 	));
Please login to merge, or discard this patch.
examples/Geocoding/get_street_adddresses_all.php 2 patches
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
-	$vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
4
+	$vdir = $_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
5 5
 
6 6
     require $vdir.'/../vendor/autoload.php';
7 7
 	
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 	
4 4
 	$vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
5 5
 
6
-    require $vdir.'/../vendor/autoload.php';
6
+	require $vdir.'/../vendor/autoload.php';
7 7
 	
8 8
 	use Route4Me\Route4Me;
9 9
 	use Route4Me\Geocoding;
Please login to merge, or discard this patch.