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.
Completed
Branch Editing-Fixing (c4d168)
by Igor
03:30
created
examples/Optimizations/hybridOptimization.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,6 @@
 block discarded – undo
5 5
 require $root . '/vendor/autoload.php';
6 6
 
7 7
 use Route4Me\OptimizationProblem;
8
-use Route4Me\Route;
9 8
 use Route4Me\Route4Me;
10 9
 
11 10
 /* The example demonstrates process of creating a Hybrid Optimization using scheduling addresses and orders.
Please login to merge, or discard this patch.
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -45,22 +45,22 @@  discard block
 block discarded – undo
45 45
 $locationsFieldsMapping['monthly_nth_wwhat'] = 17;
46 46
 
47 47
 if (($handle = fopen("$source_file", "r")) !== FALSE) {
48
-        $oAbook = new AddressBookLocation();
48
+		$oAbook = new AddressBookLocation();
49 49
 
50
-        $results = $oAbook->addLocationsFromCsvFile($handle, $locationsFieldsMapping);
50
+		$results = $oAbook->addLocationsFromCsvFile($handle, $locationsFieldsMapping);
51 51
         
52
-        echo "Errors: <br><br>";
52
+		echo "Errors: <br><br>";
53 53
         
54
-        foreach ($results['fail'] as $evalue) {
55
-            echo $evalue."<br>";
56
-        }
54
+		foreach ($results['fail'] as $evalue) {
55
+			echo $evalue."<br>";
56
+		}
57 57
         
58
-        echo "Successes: <br><br>";
58
+		echo "Successes: <br><br>";
59 59
         
60
-        foreach ($results['success'] as $svalue) {
61
-            echo $svalue."<br>";
62
-        }
63
-    }
60
+		foreach ($results['success'] as $svalue) {
61
+			echo $svalue."<br>";
62
+		}
63
+	}
64 64
 
65 65
 /* Add orders with schedules from a CSV file  */
66 66
 
@@ -79,20 +79,20 @@  discard block
 block discarded – undo
79 79
 $ordersFieldsMapping['day_scheduled_for_YYMMDD'] = 8;
80 80
 
81 81
 if (($handle = fopen("$orders_file", "r")) !== FALSE) {
82
-    $order = new Order();
83
-    $results = $order->addOrdersFromCsvFile($handle, $ordersFieldsMapping);
82
+	$order = new Order();
83
+	$results = $order->addOrdersFromCsvFile($handle, $ordersFieldsMapping);
84 84
     
85
-    echo "Errors: <br><br>";
85
+	echo "Errors: <br><br>";
86 86
     
87
-    foreach ($results['fail'] as $evalue) {
88
-        echo $evalue."<br>";
89
-    }
87
+	foreach ($results['fail'] as $evalue) {
88
+		echo $evalue."<br>";
89
+	}
90 90
     
91
-    echo "Successes: <br><br>";
91
+	echo "Successes: <br><br>";
92 92
     
93
-    foreach ($results['success'] as $svalue) {
94
-        echo $svalue."<br>";
95
-    }
93
+	foreach ($results['success'] as $svalue) {
94
+		echo $svalue."<br>";
95
+	}
96 96
 }
97 97
 
98 98
 /* Get Hybrid Optimization */
@@ -101,65 +101,65 @@  discard block
 block discarded – undo
101 101
 $sched_date = date("Y-m-d", $ep);
102 102
 
103 103
 $hybridParams = array(
104
-    "target_date_string" => $sched_date,
105
-    "timezone_offset_minutes" => 480
104
+	"target_date_string" => $sched_date,
105
+	"timezone_offset_minutes" => 480
106 106
 );
107 107
 
108 108
 $optimization = new OptimizationProblem(); 
109 109
 $hybridOptimization = $optimization->getHybridOptimization($hybridParams);
110 110
 
111 111
 if ($hybridOptimization!=null) {
112
-    if (isset($hybridOptimization['optimization_problem_id'])) {
113
-        $optid = $hybridOptimization['optimization_problem_id'];
112
+	if (isset($hybridOptimization['optimization_problem_id'])) {
113
+		$optid = $hybridOptimization['optimization_problem_id'];
114 114
         
115
-        echo "Hibrid optimization with optimization_problem_id = $optid <br><br>";
115
+		echo "Hibrid optimization with optimization_problem_id = $optid <br><br>";
116 116
         
117
-        /* Add depots to the Hybrid Optimization */
118
-        $depotfile = "depots.csv";
117
+		/* Add depots to the Hybrid Optimization */
118
+		$depotfile = "depots.csv";
119 119
         
120
-        if (($handle = fopen("$depotfile", "r")) !== FALSE) {
121
-            $columns = fgetcsv($handle, $max_line_length, $delemietr);
120
+		if (($handle = fopen("$depotfile", "r")) !== FALSE) {
121
+			$columns = fgetcsv($handle, $max_line_length, $delemietr);
122 122
             
123
-            if (!$columns) {
124
-                $error['message'] = 'Empty';
125
-                 return ($error);
126
-            }
123
+			if (!$columns) {
124
+				$error['message'] = 'Empty';
125
+				 return ($error);
126
+			}
127 127
             
128
-            $depotsParams = array(
129
-                'optimization_problem_id' => $optid,
130
-                'delete_old_depots'       => true,
131
-            );
128
+			$depotsParams = array(
129
+				'optimization_problem_id' => $optid,
130
+				'delete_old_depots'       => true,
131
+			);
132 132
             
133
-            $iRow = 1;
134
-            $depotAddresses = array();
133
+			$iRow = 1;
134
+			$depotAddresses = array();
135 135
             
136
-            while (($rows = fgetcsv($handle, $max_line_length, $delemietr)) !== false) {
137
-                if ($rows[0] && $rows[1] && $rows[3] && array(null) !== $rows) {
138
-                    $depotAddress['lat'] = $rows[0];
139
-                    $depotAddress['lng'] = $rows[1];
140
-                    $depotAddress['address'] = $rows[3];   
141
-                    array_push($depotAddresses,$depotAddress);
142
-                }
143
-            }
136
+			while (($rows = fgetcsv($handle, $max_line_length, $delemietr)) !== false) {
137
+				if ($rows[0] && $rows[1] && $rows[3] && array(null) !== $rows) {
138
+					$depotAddress['lat'] = $rows[0];
139
+					$depotAddress['lng'] = $rows[1];
140
+					$depotAddress['address'] = $rows[3];   
141
+					array_push($depotAddresses,$depotAddress);
142
+				}
143
+			}
144 144
             
145
-            $depotsParams['new_depots'] = $depotAddresses;
145
+			$depotsParams['new_depots'] = $depotAddresses;
146 146
             
147
-            $optProblem = new OptimizationProblem();
147
+			$optProblem = new OptimizationProblem();
148 148
             
149
-            $resultDepots = $optProblem->addDepotsToHybrid($depotsParams);
149
+			$resultDepots = $optProblem->addDepotsToHybrid($depotsParams);
150 150
             
151
-            var_dump($resultDepots);
151
+			var_dump($resultDepots);
152 152
             
153
-            /* Reoptimize hybrid optimization */
153
+			/* Reoptimize hybrid optimization */
154 154
             
155
-            if ($resultDepots != null) {
156
-                $problemParams = array(
157
-                    'optimization_problem_id'  =>  $optid
158
-                );
159
-                $problem = OptimizationProblem::reoptimize($problemParams);
155
+			if ($resultDepots != null) {
156
+				$problemParams = array(
157
+					'optimization_problem_id'  =>  $optid
158
+				);
159
+				$problem = OptimizationProblem::reoptimize($problemParams);
160 160
                 
161
-                Route4Me::simplePrint($problem);
162
-            }
163
-        }
164
-    }
161
+				Route4Me::simplePrint($problem);
162
+			}
163
+		}
164
+	}
165 165
 }
Please login to merge, or discard this patch.
src/Route4Me/Address.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 
4 4
 use Route4Me\Exception\BadParam;
5 5
 use Route4Me\Route4Me;
6
-use GuzzleHttp\Client;
7 6
 use Route4Me\Common;
8 7
 use Route4Me\Enum\Endpoint;
9 8
 
Please login to merge, or discard this patch.
Indentation   +275 added lines, -275 removed lines patch added patch discarded remove patch
@@ -9,63 +9,63 @@  discard block
 block discarded – undo
9 9
 
10 10
 class Address extends Common
11 11
 {
12
-    public $route_destination_id;
13
-    public $alias;
14
-    public $member_id;
15
-    public $address;
16
-    public $addressUpdate;
17
-    public $is_depot = false;
18
-    public $lat;
19
-    public $lng;
20
-    public $route_id;
21
-    public $original_route_id;
22
-    public $optimization_problem_id;
23
-    public $sequence_no;
24
-    public $geocoded;
25
-    public $preferred_geocoding;
26
-    public $failed_geocoding;
27
-    public $geocodings = array();
28
-    public $contact_id;
29
-    public $is_visited;
30
-    public $customer_po;
31
-    public $invoice_no;
32
-    public $reference_no;
33
-    public $order_no;
34
-    public $weight;
35
-    public $cost;
36
-    public $revenue;
37
-    public $cube;
38
-    public $pieces;
39
-    public $email;
40
-    public $phone;
41
-    public $tracking_number;
42
-    public $destination_note_count;
43
-    public $drive_time_to_next_destination;
44
-    public $distance_to_next_destination;
45
-    public $generated_time_window_start;
46
-    public $generated_time_window_end;
47
-    public $time_window_start;
48
-    public $time_window_end;
49
-    public $time;
50
-    public $notes;
51
-    public $timestamp_last_visited;
52
-    public $custom_fields = array();
53
-    public $manifest = array();
12
+	public $route_destination_id;
13
+	public $alias;
14
+	public $member_id;
15
+	public $address;
16
+	public $addressUpdate;
17
+	public $is_depot = false;
18
+	public $lat;
19
+	public $lng;
20
+	public $route_id;
21
+	public $original_route_id;
22
+	public $optimization_problem_id;
23
+	public $sequence_no;
24
+	public $geocoded;
25
+	public $preferred_geocoding;
26
+	public $failed_geocoding;
27
+	public $geocodings = array();
28
+	public $contact_id;
29
+	public $is_visited;
30
+	public $customer_po;
31
+	public $invoice_no;
32
+	public $reference_no;
33
+	public $order_no;
34
+	public $weight;
35
+	public $cost;
36
+	public $revenue;
37
+	public $cube;
38
+	public $pieces;
39
+	public $email;
40
+	public $phone;
41
+	public $tracking_number;
42
+	public $destination_note_count;
43
+	public $drive_time_to_next_destination;
44
+	public $distance_to_next_destination;
45
+	public $generated_time_window_start;
46
+	public $generated_time_window_end;
47
+	public $time_window_start;
48
+	public $time_window_end;
49
+	public $time;
50
+	public $notes;
51
+	public $timestamp_last_visited;
52
+	public $custom_fields = array();
53
+	public $manifest = array();
54 54
     
55
-    public $first_name;
56
-    public $last_name;
57
-    public $is_departed;
58
-    public $timestamp_last_departed;
59
-    public $order_id;
60
-    public $priority;
61
-    public $curbside_lat;
62
-    public $curbside_lng;
63
-    public $time_window_start_2;
64
-    public $time_window_end_2;
55
+	public $first_name;
56
+	public $last_name;
57
+	public $is_departed;
58
+	public $timestamp_last_departed;
59
+	public $order_id;
60
+	public $priority;
61
+	public $curbside_lat;
62
+	public $curbside_lng;
63
+	public $time_window_start_2;
64
+	public $time_window_end_2;
65 65
 
66
-    public static function fromArray(array $params)
67
-    {
68
-        /*if (!isset($params['address'])) {
66
+	public static function fromArray(array $params)
67
+	{
68
+		/*if (!isset($params['address'])) {
69 69
             throw new BadParam('address must be provided');
70 70
         }
71 71
 
@@ -77,260 +77,260 @@  discard block
 block discarded – undo
77 77
             throw new BadParam('lng must be provided');
78 78
         }*/
79 79
 
80
-        $address = new Address();
81
-        foreach($params as $key => $value) {
82
-            if (property_exists($address, $key)) {
83
-                $address->{$key} = $value;
84
-            }
85
-        }
80
+		$address = new Address();
81
+		foreach($params as $key => $value) {
82
+			if (property_exists($address, $key)) {
83
+				$address->{$key} = $value;
84
+			}
85
+		}
86 86
 
87
-        return $address;
88
-    }
87
+		return $address;
88
+	}
89 89
 
90
-    public static function getAddress($routeId, $addressId)
91
-    {
92
-        $address = Route4Me::makeRequst(array(
93
-            'url'    => Endpoint::ADDRESS_V4,
94
-            'method' => 'GET',
95
-            'query'  => array(
96
-                'route_id'             => $routeId,
97
-                'route_destination_id' => $addressId,
98
-            )
99
-        ));
90
+	public static function getAddress($routeId, $addressId)
91
+	{
92
+		$address = Route4Me::makeRequst(array(
93
+			'url'    => Endpoint::ADDRESS_V4,
94
+			'method' => 'GET',
95
+			'query'  => array(
96
+				'route_id'             => $routeId,
97
+				'route_destination_id' => $addressId,
98
+			)
99
+		));
100 100
 
101
-        return Address::fromArray($address);
102
-    }
101
+		return Address::fromArray($address);
102
+	}
103 103
     
104
-    /*Get notes from the specified route destination
104
+	/*Get notes from the specified route destination
105 105
      * Returns an address object with notes, if an address exists, otherwise - return null.
106 106
      */
107
-    public static function GetAddressesNotes($noteParams)
108
-    {
109
-        $address = Route4Me::makeRequst(array(
110
-            'url'    => Endpoint::ADDRESS_V4,
111
-            'method' => 'GET',
112
-            'query'  => array(
113
-                'route_id'             => isset($noteParams['route_id']) ? $noteParams['route_id'] : null, 
114
-                'route_destination_id' => isset($noteParams['route_destination_id']) 
115
-                                             ? $noteParams['route_destination_id'] : null,
116
-                'notes'                => 1,
117
-            )
118
-        ));
107
+	public static function GetAddressesNotes($noteParams)
108
+	{
109
+		$address = Route4Me::makeRequst(array(
110
+			'url'    => Endpoint::ADDRESS_V4,
111
+			'method' => 'GET',
112
+			'query'  => array(
113
+				'route_id'             => isset($noteParams['route_id']) ? $noteParams['route_id'] : null, 
114
+				'route_destination_id' => isset($noteParams['route_destination_id']) 
115
+											 ? $noteParams['route_destination_id'] : null,
116
+				'notes'                => 1,
117
+			)
118
+		));
119 119
 
120
-        return $address;
121
-    }
120
+		return $address;
121
+	}
122 122
 
123
-    public function update()
124
-    {
125
-        $addressUpdate = Route4Me::makeRequst(array(
126
-            'url'    => Endpoint::ADDRESS_V4,
127
-            'method' => 'PUT',
128
-            'body'   => $this->toArray(),
129
-            'query'  => array(
130
-                'route_id'             => $this->route_id,
131
-                'route_destination_id' => $this->route_destination_id,
132
-            ),
133
-        ));
123
+	public function update()
124
+	{
125
+		$addressUpdate = Route4Me::makeRequst(array(
126
+			'url'    => Endpoint::ADDRESS_V4,
127
+			'method' => 'PUT',
128
+			'body'   => $this->toArray(),
129
+			'query'  => array(
130
+				'route_id'             => $this->route_id,
131
+				'route_destination_id' => $this->route_destination_id,
132
+			),
133
+		));
134 134
 
135
-        return Address::fromArray($addressUpdate);
136
-    }
135
+		return Address::fromArray($addressUpdate);
136
+	}
137 137
     
138
-    public function markAddress($params, $body)
139
-    {
140
-        $result = Route4Me::makeRequst(array(
141
-            'url'    => Endpoint::ADDRESS_V4,
142
-            'method' => 'PUT',
143
-            'query'  => array(
144
-                'route_id'             => isset($params['route_id']) ? $params['route_id'] : null, 
145
-                'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
146
-            ),
147
-            'body'   => $body
148
-        ));
138
+	public function markAddress($params, $body)
139
+	{
140
+		$result = Route4Me::makeRequst(array(
141
+			'url'    => Endpoint::ADDRESS_V4,
142
+			'method' => 'PUT',
143
+			'query'  => array(
144
+				'route_id'             => isset($params['route_id']) ? $params['route_id'] : null, 
145
+				'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
146
+			),
147
+			'body'   => $body
148
+		));
149 149
 
150
-        return $result;
151
-    }
150
+		return $result;
151
+	}
152 152
     
153
-    public function markAsDeparted($params)
154
-    {
155
-        $address = Route4Me::makeRequst(array(
156
-            'url'    => Endpoint::MARK_ADDRESS_DEPARTED,
157
-            'method' => 'GET',
158
-            'query'  => array(
159
-                'route_id'     => isset($params['route_id']) ? $params['route_id']: null,
160
-                'address_id'   => isset($params['address_id']) ? $params['address_id']: null,
161
-                'is_departed'  => isset($params['is_departed']) ? $params['is_departed']: null,
162
-                'member_id'    => isset($params['member_id']) ? $params['member_id']: null,
163
-            ),
164
-        ));
153
+	public function markAsDeparted($params)
154
+	{
155
+		$address = Route4Me::makeRequst(array(
156
+			'url'    => Endpoint::MARK_ADDRESS_DEPARTED,
157
+			'method' => 'GET',
158
+			'query'  => array(
159
+				'route_id'     => isset($params['route_id']) ? $params['route_id']: null,
160
+				'address_id'   => isset($params['address_id']) ? $params['address_id']: null,
161
+				'is_departed'  => isset($params['is_departed']) ? $params['is_departed']: null,
162
+				'member_id'    => isset($params['member_id']) ? $params['member_id']: null,
163
+			),
164
+		));
165 165
 
166
-        return $address;
167
-    }
166
+		return $address;
167
+	}
168 168
     
169
-    public function markAsVisited($params)
170
-    {
171
-        $address = Route4Me::makeRequst(array(
172
-            'url'    => Endpoint::UPDATE_ADDRESS_VISITED,
173
-            'method' => 'GET',
174
-            'query'  => array(
175
-                'route_id'   => isset($params['route_id']) ? $params['route_id'] : null,
176
-                'address_id' => isset($params['address_id']) ? $params['address_id'] : null,
177
-                'member_id'  => isset($params['member_id']) ? $params['member_id'] : null,
178
-            ),
179
-            'body'  =>  array(
180
-                'is_visited' => isset($params['is_visited']) ? $params['is_visited'] : null
181
-            )
182
-        ));
169
+	public function markAsVisited($params)
170
+	{
171
+		$address = Route4Me::makeRequst(array(
172
+			'url'    => Endpoint::UPDATE_ADDRESS_VISITED,
173
+			'method' => 'GET',
174
+			'query'  => array(
175
+				'route_id'   => isset($params['route_id']) ? $params['route_id'] : null,
176
+				'address_id' => isset($params['address_id']) ? $params['address_id'] : null,
177
+				'member_id'  => isset($params['member_id']) ? $params['member_id'] : null,
178
+			),
179
+			'body'  =>  array(
180
+				'is_visited' => isset($params['is_visited']) ? $params['is_visited'] : null
181
+			)
182
+		));
183 183
 
184
-        return $address;
185
-    }
184
+		return $address;
185
+	}
186 186
 
187
-    public function delete()
188
-    {
189
-        $address = Route4Me::makeRequst(array(
190
-            'url'    => Endpoint::ADDRESS_V4,
191
-            'method' => 'DELETE',
192
-            'query'  => array(
193
-                'route_id'             => $this->route_id,
194
-                'route_destination_id' => $this->route_destination_id,
195
-            )
196
-        ));
187
+	public function delete()
188
+	{
189
+		$address = Route4Me::makeRequst(array(
190
+			'url'    => Endpoint::ADDRESS_V4,
191
+			'method' => 'DELETE',
192
+			'query'  => array(
193
+				'route_id'             => $this->route_id,
194
+				'route_destination_id' => $this->route_destination_id,
195
+			)
196
+		));
197 197
 
198
-        return (bool)$address['deleted'];
199
-    }
198
+		return (bool)$address['deleted'];
199
+	}
200 200
     
201
-    public function moveDestinationToRoute($params)
202
-    {
203
-        $result = Route4Me::makeRequst(array(
204
-            'url'    => Endpoint::MOVE_ROUTE_DESTINATION,
205
-            'method' => 'POST',
206
-            'body'  => array(
207
-                'to_route_id'          => isset($params['to_route_id']) ? $params['to_route_id'] : null,
208
-                'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
209
-                'after_destination_id' => isset($params['after_destination_id']) ? $params['after_destination_id'] : null
210
-            ),
211
-            'HTTPHEADER'  => 'Content-Type: multipart/form-data'
212
-        ));
201
+	public function moveDestinationToRoute($params)
202
+	{
203
+		$result = Route4Me::makeRequst(array(
204
+			'url'    => Endpoint::MOVE_ROUTE_DESTINATION,
205
+			'method' => 'POST',
206
+			'body'  => array(
207
+				'to_route_id'          => isset($params['to_route_id']) ? $params['to_route_id'] : null,
208
+				'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
209
+				'after_destination_id' => isset($params['after_destination_id']) ? $params['after_destination_id'] : null
210
+			),
211
+			'HTTPHEADER'  => 'Content-Type: multipart/form-data'
212
+		));
213 213
 
214
-        return $result;
214
+		return $result;
215 215
         
216
-    }
216
+	}
217 217
     
218
-    public function AddAddressNote($params)
219
-    {
220
-        $result = Route4Me::makeRequst(array(
221
-            'url'    => Endpoint::ROUTE_NOTES_ADD,
222
-            'method' => 'POST',
223
-            'query'  => array(
224
-                'route_id'     =>  isset($params['route_id']) ? $params['route_id'] : null,
225
-                'address_id'   =>  isset($params['address_id']) ? $params['address_id'] : null,
226
-                'dev_lat'      =>  isset($params['dev_lat']) ? $params['dev_lat'] : null,
227
-                'dev_lng'      =>  isset($params['dev_lng']) ? $params['dev_lng'] : null,
228
-                'device_type'  =>  isset($params['device_type']) ? $params['device_type'] : null
229
-            ),
230
-            'body'  => array(
231
-                'strNoteContents' => isset($params['strNoteContents']) ? $params['strNoteContents'] : null,
232
-                'strUpdateType'   => isset($params['strUpdateType']) ? $params['strUpdateType'] : null
233
-            ),
234
-            'HTTPHEADER'  => 'Content-Type: multipart/form-data'
235
-        ));
218
+	public function AddAddressNote($params)
219
+	{
220
+		$result = Route4Me::makeRequst(array(
221
+			'url'    => Endpoint::ROUTE_NOTES_ADD,
222
+			'method' => 'POST',
223
+			'query'  => array(
224
+				'route_id'     =>  isset($params['route_id']) ? $params['route_id'] : null,
225
+				'address_id'   =>  isset($params['address_id']) ? $params['address_id'] : null,
226
+				'dev_lat'      =>  isset($params['dev_lat']) ? $params['dev_lat'] : null,
227
+				'dev_lng'      =>  isset($params['dev_lng']) ? $params['dev_lng'] : null,
228
+				'device_type'  =>  isset($params['device_type']) ? $params['device_type'] : null
229
+			),
230
+			'body'  => array(
231
+				'strNoteContents' => isset($params['strNoteContents']) ? $params['strNoteContents'] : null,
232
+				'strUpdateType'   => isset($params['strUpdateType']) ? $params['strUpdateType'] : null
233
+			),
234
+			'HTTPHEADER'  => 'Content-Type: multipart/form-data'
235
+		));
236 236
 
237
-        return $result;
238
-    }
237
+		return $result;
238
+	}
239 239
 
240
-    public function AddNoteFile($params)
241
-    {
242
-        $result = Route4Me::fileUploadRequest(array(
243
-            'url'    => Endpoint::ROUTE_NOTES_ADD,
244
-            'method' => 'POST',
245
-            'query'  => array(
246
-                'route_id'      =>  isset($params['route_id']) ? $params['route_id'] : null,
247
-                'address_id'    =>  isset($params['address_id']) ? $params['address_id'] : null,
248
-                'dev_lat'       =>  isset($params['dev_lat']) ? $params['dev_lat'] : null,
249
-                'dev_lng'       =>  isset($params['dev_lng']) ? $params['dev_lng'] : null,
250
-                'device_type'   =>  isset($params['device_type']) ? $params['device_type'] : null,
251
-                'strUpdateType' =>  isset($params['strUpdateType']) ? $params['strUpdateType'] : null
252
-            ),
253
-            'body'  => array(
254
-                'strFilename' => isset($params['strFilename']) ? $params['strFilename'] : null
255
-            ),
256
-            'HTTPHEADER'  => 'Content-Type: multipart/form-data'
257
-        ));
240
+	public function AddNoteFile($params)
241
+	{
242
+		$result = Route4Me::fileUploadRequest(array(
243
+			'url'    => Endpoint::ROUTE_NOTES_ADD,
244
+			'method' => 'POST',
245
+			'query'  => array(
246
+				'route_id'      =>  isset($params['route_id']) ? $params['route_id'] : null,
247
+				'address_id'    =>  isset($params['address_id']) ? $params['address_id'] : null,
248
+				'dev_lat'       =>  isset($params['dev_lat']) ? $params['dev_lat'] : null,
249
+				'dev_lng'       =>  isset($params['dev_lng']) ? $params['dev_lng'] : null,
250
+				'device_type'   =>  isset($params['device_type']) ? $params['device_type'] : null,
251
+				'strUpdateType' =>  isset($params['strUpdateType']) ? $params['strUpdateType'] : null
252
+			),
253
+			'body'  => array(
254
+				'strFilename' => isset($params['strFilename']) ? $params['strFilename'] : null
255
+			),
256
+			'HTTPHEADER'  => 'Content-Type: multipart/form-data'
257
+		));
258 258
 
259
-        return $result;
260
-    }
259
+		return $result;
260
+	}
261 261
 
262
-    public function createCustomNoteType($params)
263
-    {
264
-        $result = Route4Me::makeRequst(array(
265
-            'url'    => Endpoint::NOTE_CUSTOM_TYPES_V4,
266
-            'method' => 'POST',
267
-            'body'   => array(
268
-                'type'   => isset($params['type']) ? $params['type'] : null,
269
-                'values' => isset($params['values']) ? $params['values'] : null
270
-            )
271
-        ));
262
+	public function createCustomNoteType($params)
263
+	{
264
+		$result = Route4Me::makeRequst(array(
265
+			'url'    => Endpoint::NOTE_CUSTOM_TYPES_V4,
266
+			'method' => 'POST',
267
+			'body'   => array(
268
+				'type'   => isset($params['type']) ? $params['type'] : null,
269
+				'values' => isset($params['values']) ? $params['values'] : null
270
+			)
271
+		));
272 272
 
273
-        return $result;
274
-    }
273
+		return $result;
274
+	}
275 275
     
276
-    public function removeCustomNoteType($params)
277
-    {
278
-        $result = Route4Me::makeRequst(array(
279
-            'url'    => Endpoint::NOTE_CUSTOM_TYPES_V4,
280
-            'method' => 'DELETE',
281
-            'body'   => array(
282
-                'id' => isset($params['id']) ? $params['id'] : null
283
-            )
284
-        ));
276
+	public function removeCustomNoteType($params)
277
+	{
278
+		$result = Route4Me::makeRequst(array(
279
+			'url'    => Endpoint::NOTE_CUSTOM_TYPES_V4,
280
+			'method' => 'DELETE',
281
+			'body'   => array(
282
+				'id' => isset($params['id']) ? $params['id'] : null
283
+			)
284
+		));
285 285
 
286
-        return $result;
287
-    }
286
+		return $result;
287
+	}
288 288
     
289
-    public function getAllCustomNoteTypes()
290
-    {
291
-        $result = Route4Me::makeRequst(array(
292
-            'url'    => Endpoint::NOTE_CUSTOM_TYPES_V4,
293
-            'method' => 'GET'
294
-        ));
289
+	public function getAllCustomNoteTypes()
290
+	{
291
+		$result = Route4Me::makeRequst(array(
292
+			'url'    => Endpoint::NOTE_CUSTOM_TYPES_V4,
293
+			'method' => 'GET'
294
+		));
295 295
 
296
-        return $result;
297
-    }
296
+		return $result;
297
+	}
298 298
     
299
-    public function addCustomNoteToRoute($params)
300
-    {
301
-        $customArray = array();
299
+	public function addCustomNoteToRoute($params)
300
+	{
301
+		$customArray = array();
302 302
         
303
-        foreach ($params as $key => $value) {
304
-            $kpos = strpos($key, "custom_note_type");
303
+		foreach ($params as $key => $value) {
304
+			$kpos = strpos($key, "custom_note_type");
305 305
             
306
-            if ($kpos !== false) {
307
-                $customArray[$key]=$value;
308
-            }
309
-        }
306
+			if ($kpos !== false) {
307
+				$customArray[$key]=$value;
308
+			}
309
+		}
310 310
         
311
-        $result = Route4Me::makeRequst(array(
312
-            'url'    => Endpoint::ROUTE_NOTES_ADD,
313
-            'method' => 'POST',
314
-            'query'  => array(
315
-                'route_id'      =>  isset($params['route_id']) ? $params['route_id'] : null,
316
-                'address_id'    =>  isset($params['address_id']) ? $params['address_id'] : null,
317
-                'format'        =>  isset($params['format']) ? $params['format'] : null,
318
-                'dev_lat'       =>  isset($params['dev_lat']) ? $params['dev_lat'] : null,
319
-                'dev_lng'       =>  isset($params['dev_lng']) ? $params['dev_lng'] : null
320
-            ),
321
-            'body'  => array_merge(array(
322
-                'strUpdateType'   =>  isset($params['strUpdateType']) ? $params['strUpdateType'] : null,
323
-                'strUpdateType'   =>  isset($params['strUpdateType']) ? $params['strUpdateType'] : null,
324
-                'strNoteContents' =>  isset($params['strNoteContents']) ? $params['strNoteContents'] : null
325
-            ), $customArray),
326
-            'HTTPHEADER'  => 'Content-Type: multipart/form-data'
327
-        ));
311
+		$result = Route4Me::makeRequst(array(
312
+			'url'    => Endpoint::ROUTE_NOTES_ADD,
313
+			'method' => 'POST',
314
+			'query'  => array(
315
+				'route_id'      =>  isset($params['route_id']) ? $params['route_id'] : null,
316
+				'address_id'    =>  isset($params['address_id']) ? $params['address_id'] : null,
317
+				'format'        =>  isset($params['format']) ? $params['format'] : null,
318
+				'dev_lat'       =>  isset($params['dev_lat']) ? $params['dev_lat'] : null,
319
+				'dev_lng'       =>  isset($params['dev_lng']) ? $params['dev_lng'] : null
320
+			),
321
+			'body'  => array_merge(array(
322
+				'strUpdateType'   =>  isset($params['strUpdateType']) ? $params['strUpdateType'] : null,
323
+				'strUpdateType'   =>  isset($params['strUpdateType']) ? $params['strUpdateType'] : null,
324
+				'strNoteContents' =>  isset($params['strNoteContents']) ? $params['strNoteContents'] : null
325
+			), $customArray),
326
+			'HTTPHEADER'  => 'Content-Type: multipart/form-data'
327
+		));
328 328
 
329
-        return $result;
330
-    }
329
+		return $result;
330
+	}
331 331
 
332
-    function getAddressId()
333
-    {
334
-        return $this->route_destination_id;
335
-    }
332
+	function getAddressId()
333
+	{
334
+		return $this->route_destination_id;
335
+	}
336 336
 }
Please login to merge, or discard this patch.
src/Route4Me/OptimizationProblem.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,6 @@
 block discarded – undo
7 7
 use Route4Me\OptimizationProblemParams;
8 8
 use Route4Me\Route;
9 9
 use Route4Me\Route4Me;
10
-use GuzzleHttp\Client;
11 10
 use Route4Me\Enum\Endpoint;
12 11
 
13 12
 class OptimizationProblem extends Common
Please login to merge, or discard this patch.
Indentation   +216 added lines, -216 removed lines patch added patch discarded remove patch
@@ -12,267 +12,267 @@
 block discarded – undo
12 12
 
13 13
 class OptimizationProblem extends Common
14 14
 {
15
-    public $optimization_problem_id;
16
-    public $user_errors = array();
17
-    public $state;
18
-    public $optimization_errors = array();
19
-    public $parameters;
20
-    public $sent_to_background;
21
-    public $created_timestamp;
22
-    public $scheduled_for;
23
-    public $optimization_completed_timestamp;
24
-    public $addresses = array();
25
-    public $routes = array();
26
-    public $links = array();
15
+	public $optimization_problem_id;
16
+	public $user_errors = array();
17
+	public $state;
18
+	public $optimization_errors = array();
19
+	public $parameters;
20
+	public $sent_to_background;
21
+	public $created_timestamp;
22
+	public $scheduled_for;
23
+	public $optimization_completed_timestamp;
24
+	public $addresses = array();
25
+	public $routes = array();
26
+	public $links = array();
27 27
 
28
-    function __construct()
29
-    {
30
-        $this->parameters = new RouteParameters;
31
-    }
28
+	function __construct()
29
+	{
30
+		$this->parameters = new RouteParameters;
31
+	}
32 32
 
33
-    public static function fromArray(array $params)
34
-    {
35
-        $problem = new OptimizationProblem;
36
-        $problem->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
37
-        $problem->user_errors = Common::getValue($params, 'user_errors', array());
38
-        $problem->state = Common::getValue($params, 'state', array());
39
-        $problem->sent_to_background = Common::getValue($params, 'sent_to_background', array());
40
-        $problem->links = Common::getValue($params, 'links', array());
33
+	public static function fromArray(array $params)
34
+	{
35
+		$problem = new OptimizationProblem;
36
+		$problem->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
37
+		$problem->user_errors = Common::getValue($params, 'user_errors', array());
38
+		$problem->state = Common::getValue($params, 'state', array());
39
+		$problem->sent_to_background = Common::getValue($params, 'sent_to_background', array());
40
+		$problem->links = Common::getValue($params, 'links', array());
41 41
 
42
-        if (isset($params['parameters'])) {
43
-            $problem->parameters = RouteParameters::fromArray($params['parameters']);
44
-        }
42
+		if (isset($params['parameters'])) {
43
+			$problem->parameters = RouteParameters::fromArray($params['parameters']);
44
+		}
45 45
 
46
-        if (isset($params['addresses'])) {
47
-            $addresses = array();
46
+		if (isset($params['addresses'])) {
47
+			$addresses = array();
48 48
             
49
-            foreach ($params['addresses'] as $address) {
50
-                $addresses[] = Address::fromArray($address);
51
-            }
49
+			foreach ($params['addresses'] as $address) {
50
+				$addresses[] = Address::fromArray($address);
51
+			}
52 52
             
53
-            $problem->addresses = $addresses;
54
-        }
53
+			$problem->addresses = $addresses;
54
+		}
55 55
 
56
-        if (isset($params['routes'])) {
57
-            $routes = array();
56
+		if (isset($params['routes'])) {
57
+			$routes = array();
58 58
             
59
-            foreach ($params['routes'] as $route) {
60
-                $routes[] = Route::fromArray($route);
61
-            }
59
+			foreach ($params['routes'] as $route) {
60
+				$routes[] = Route::fromArray($route);
61
+			}
62 62
             
63
-            $problem->routes = $routes;
64
-        }
63
+			$problem->routes = $routes;
64
+		}
65 65
 
66
-        return $problem;
67
-    }
66
+		return $problem;
67
+	}
68 68
 
69
-    public static function optimize(OptimizationProblemParams $params)
70
-    {
71
-        $optimize = Route4Me::makeRequst(array(
72
-            'url'    => Endpoint::OPTIMIZATION_PROBLEM,
73
-            'method' => 'POST',
74
-            'query'  => array(
75
-                'redirect'               => isset($params->redirect) ? $params->redirect : null,
76
-                'directions'             => isset($params->directions) ? $params->directions : null, 
77
-                'format'                 => isset($params->format) ? $params->format : null,
78
-                'route_path_output'      => isset($params->route_path_output) ? $params->route_path_output : null,
79
-                'optimized_callback_url' => isset($params->optimized_callback_url) ? $params->optimized_callback_url : null
80
-            ),
81
-            'body'   => array(
82
-                'addresses'  => $params->getAddressesArray(),
83
-                'parameters' => $params->getParametersArray()
84
-            )
85
-        ));
69
+	public static function optimize(OptimizationProblemParams $params)
70
+	{
71
+		$optimize = Route4Me::makeRequst(array(
72
+			'url'    => Endpoint::OPTIMIZATION_PROBLEM,
73
+			'method' => 'POST',
74
+			'query'  => array(
75
+				'redirect'               => isset($params->redirect) ? $params->redirect : null,
76
+				'directions'             => isset($params->directions) ? $params->directions : null, 
77
+				'format'                 => isset($params->format) ? $params->format : null,
78
+				'route_path_output'      => isset($params->route_path_output) ? $params->route_path_output : null,
79
+				'optimized_callback_url' => isset($params->optimized_callback_url) ? $params->optimized_callback_url : null
80
+			),
81
+			'body'   => array(
82
+				'addresses'  => $params->getAddressesArray(),
83
+				'parameters' => $params->getParametersArray()
84
+			)
85
+		));
86 86
 
87
-        return OptimizationProblem::fromArray($optimize);
88
-    }
87
+		return OptimizationProblem::fromArray($optimize);
88
+	}
89 89
 
90
-    public static function get($params)
91
-    {
92
-        $optimize = Route4Me::makeRequst(array(
93
-            'url'    => Endpoint::OPTIMIZATION_PROBLEM,
94
-            'method' => 'GET',
95
-            'query'  => array(
96
-                'state'  => isset($params['state'])  ? $params['state'] : null,
97
-                'limit'  => isset($params['limit'])  ? $params['limit'] : null,
98
-                'offset' => isset($params['offset']) ? $params['offset'] : null,
99
-                'optimization_problem_id' => isset($params['optimization_problem_id']) 
100
-                    ? $params['optimization_problem_id'] : null,
101
-                'wait_for_final_state' => isset($params['wait_for_final_state']) 
102
-                    ? $params['wait_for_final_state'] : null,
103
-            )
104
-        ));
90
+	public static function get($params)
91
+	{
92
+		$optimize = Route4Me::makeRequst(array(
93
+			'url'    => Endpoint::OPTIMIZATION_PROBLEM,
94
+			'method' => 'GET',
95
+			'query'  => array(
96
+				'state'  => isset($params['state'])  ? $params['state'] : null,
97
+				'limit'  => isset($params['limit'])  ? $params['limit'] : null,
98
+				'offset' => isset($params['offset']) ? $params['offset'] : null,
99
+				'optimization_problem_id' => isset($params['optimization_problem_id']) 
100
+					? $params['optimization_problem_id'] : null,
101
+				'wait_for_final_state' => isset($params['wait_for_final_state']) 
102
+					? $params['wait_for_final_state'] : null,
103
+			)
104
+		));
105 105
 
106
-        if (isset($optimize['optimizations'])) {
107
-            $problems = array();
106
+		if (isset($optimize['optimizations'])) {
107
+			$problems = array();
108 108
             
109
-            foreach($optimize['optimizations'] as $problem) {
110
-                $problems[] = OptimizationProblem::fromArray($problem);
111
-            }
109
+			foreach($optimize['optimizations'] as $problem) {
110
+				$problems[] = OptimizationProblem::fromArray($problem);
111
+			}
112 112
             
113
-            return $problems;
114
-        } else {
115
-            return OptimizationProblem::fromArray($optimize);
116
-        }
117
-    }
113
+			return $problems;
114
+		} else {
115
+			return OptimizationProblem::fromArray($optimize);
116
+		}
117
+	}
118 118
 
119
-    public static function reoptimize($params)
120
-    {
121
-        $param = new OptimizationProblemParams;
122
-        $param->optimization_problem_id = isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null;
123
-        $param->reoptimize = 1;
119
+	public static function reoptimize($params)
120
+	{
121
+		$param = new OptimizationProblemParams;
122
+		$param->optimization_problem_id = isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null;
123
+		$param->reoptimize = 1;
124 124
 
125
-        return self::update((array)$param);
126
-    }
125
+		return self::update((array)$param);
126
+	}
127 127
 
128
-    public static function update($params)
129
-    {
130
-        $optimize = Route4Me::makeRequst(array(
131
-            'url'    => Endpoint::OPTIMIZATION_PROBLEM,
132
-            'method' => 'PUT',
133
-            'query'  => array(
134
-                'optimization_problem_id' => isset($params['optimization_problem_id'])
135
-                                               ? $params['optimization_problem_id'] : null,
136
-                'addresses'  => isset($params['addresses']) ? $params['addresses'] : null,
137
-                'reoptimize' => isset($params['reoptimize']) ? $params['reoptimize'] : null,
138
-            )
139
-        ));
128
+	public static function update($params)
129
+	{
130
+		$optimize = Route4Me::makeRequst(array(
131
+			'url'    => Endpoint::OPTIMIZATION_PROBLEM,
132
+			'method' => 'PUT',
133
+			'query'  => array(
134
+				'optimization_problem_id' => isset($params['optimization_problem_id'])
135
+											   ? $params['optimization_problem_id'] : null,
136
+				'addresses'  => isset($params['addresses']) ? $params['addresses'] : null,
137
+				'reoptimize' => isset($params['reoptimize']) ? $params['reoptimize'] : null,
138
+			)
139
+		));
140 140
         
141
-        return $optimize;
142
-    }
141
+		return $optimize;
142
+	}
143 143
 
144
-    public function getOptimizationId()
145
-    {
146
-        return $this->optimization_problem_id;
147
-    }
144
+	public function getOptimizationId()
145
+	{
146
+		return $this->optimization_problem_id;
147
+	}
148 148
 
149
-    public function getRoutes()
150
-    {
151
-        return $this->routes;
152
-    }
149
+	public function getRoutes()
150
+	{
151
+		return $this->routes;
152
+	}
153 153
     
154
-    public function getRandomOptimizationId($offset,$limit)
155
-    {
156
-        $query['limit'] = isset($params['limit']) ? $params['limit'] : 30;
157
-        $query['offset'] = isset($params['offset']) ? $params['offset'] : 0;
154
+	public function getRandomOptimizationId($offset,$limit)
155
+	{
156
+		$query['limit'] = isset($params['limit']) ? $params['limit'] : 30;
157
+		$query['offset'] = isset($params['offset']) ? $params['offset'] : 0;
158 158
             
159
-        $json = Route4Me::makeRequst(array(
160
-            'url'    => Endpoint::OPTIMIZATION_PROBLEM,
161
-            'method' => 'GET',
162
-            'query'  => $query
163
-        ));
159
+		$json = Route4Me::makeRequst(array(
160
+			'url'    => Endpoint::OPTIMIZATION_PROBLEM,
161
+			'method' => 'GET',
162
+			'query'  => $query
163
+		));
164 164
         
165
-        $optimizations = array();
166
-            foreach($json as $optimization) {
167
-                if (gettype($optimization)!="array") continue;
165
+		$optimizations = array();
166
+			foreach($json as $optimization) {
167
+				if (gettype($optimization)!="array") continue;
168 168
                 
169
-                foreach ($optimization as $otp1) {
170
-                    $optimizations[] = $otp1;
171
-                }
172
-            }
169
+				foreach ($optimization as $otp1) {
170
+					$optimizations[] = $otp1;
171
+				}
172
+			}
173 173
             
174
-            $num = rand(0,sizeof($optimizations)-1);
174
+			$num = rand(0,sizeof($optimizations)-1);
175 175
             
176
-            $rOptimization = $optimizations[$num];
176
+			$rOptimization = $optimizations[$num];
177 177
             
178
-            return $rOptimization['optimization_problem_id'];
179
-    }
178
+			return $rOptimization['optimization_problem_id'];
179
+	}
180 180
     
181
-    public function getAddresses($opt_id)
182
-    {
183
-        if ($opt_id == null) return null;
181
+	public function getAddresses($opt_id)
182
+	{
183
+		if ($opt_id == null) return null;
184 184
         
185
-        $params = array( "optimization_problem_id" => $opt_id );
185
+		$params = array( "optimization_problem_id" => $opt_id );
186 186
         
187
-        $optimization = (array)$this->get($params);
187
+		$optimization = (array)$this->get($params);
188 188
         
189
-        $addresses = $optimization["addresses"];
189
+		$addresses = $optimization["addresses"];
190 190
         
191
-        return $addresses;
192
-    }
191
+		return $addresses;
192
+	}
193 193
     
194
-    public function getRandomAddressFromOptimization($opt_id)
195
-    {
196
-        $addresses = (array)$this->getAddresses($opt_id);
194
+	public function getRandomAddressFromOptimization($opt_id)
195
+	{
196
+		$addresses = (array)$this->getAddresses($opt_id);
197 197
         
198
-        if ($addresses == null) {
199
-            echo "There are no addresses in this optimization!.. Try again.";
200
-            return null;
201
-        }
198
+		if ($addresses == null) {
199
+			echo "There are no addresses in this optimization!.. Try again.";
200
+			return null;
201
+		}
202 202
         
203
-        $num = rand(0,sizeof($addresses)-1);
203
+		$num = rand(0,sizeof($addresses)-1);
204 204
         
205
-        $rAddress = $addresses[$num];
205
+		$rAddress = $addresses[$num];
206 206
         
207
-        return $rAddress;
208
-    }
207
+		return $rAddress;
208
+	}
209 209
     
210
-    public function removeAddress($params)
211
-    {
212
-        $response = Route4Me::makeRequst(array(
213
-            'url'    => Endpoint::ADDRESS_V4,
214
-            'method' => 'DELETE',
215
-            'query'  => array(
216
-                'optimization_problem_id' => isset($params['optimization_problem_id'])
217
-                                               ? $params['optimization_problem_id'] : null,
218
-                'route_destination_id'    => isset($params['route_destination_id'])
219
-                                               ? $params['route_destination_id'] : null,
220
-            )
221
-        ));
210
+	public function removeAddress($params)
211
+	{
212
+		$response = Route4Me::makeRequst(array(
213
+			'url'    => Endpoint::ADDRESS_V4,
214
+			'method' => 'DELETE',
215
+			'query'  => array(
216
+				'optimization_problem_id' => isset($params['optimization_problem_id'])
217
+											   ? $params['optimization_problem_id'] : null,
218
+				'route_destination_id'    => isset($params['route_destination_id'])
219
+											   ? $params['route_destination_id'] : null,
220
+			)
221
+		));
222 222
         
223
-        return $response;
224
-    }
223
+		return $response;
224
+	}
225 225
     
226
-    public function removeOptimization($params)
227
-    {
228
-        $response = Route4Me::makeRequst(array(
229
-            'url'    => Endpoint::OPTIMIZATION_PROBLEM,
230
-            'method' => 'DELETE',
231
-            'query'  => array(
232
-                'redirect' => isset($params['redirect']) ? $params['redirect'] : null,
233
-            ),
234
-            'body'   => array(
235
-                'optimization_problem_ids' => isset($params['optimization_problem_ids'])
236
-                                                ? $params['optimization_problem_ids'] : null,
237
-            )
238
-        ));
226
+	public function removeOptimization($params)
227
+	{
228
+		$response = Route4Me::makeRequst(array(
229
+			'url'    => Endpoint::OPTIMIZATION_PROBLEM,
230
+			'method' => 'DELETE',
231
+			'query'  => array(
232
+				'redirect' => isset($params['redirect']) ? $params['redirect'] : null,
233
+			),
234
+			'body'   => array(
235
+				'optimization_problem_ids' => isset($params['optimization_problem_ids'])
236
+												? $params['optimization_problem_ids'] : null,
237
+			)
238
+		));
239 239
         
240
-        return $response;
241
-    }
240
+		return $response;
241
+	}
242 242
     
243
-    public function getHybridOptimization($params)
244
-    {
245
-        $optimize = Route4Me::makeRequst(array(
246
-            'url'    => Endpoint::HYBRID_DATE_OPTIMIZATION,
247
-            'method' => 'GET',
248
-            'query'  => array(
249
-                'target_date_string'      => isset($params['target_date_string'])
250
-                                               ? $params['target_date_string'] : null,
251
-                'timezone_offset_minutes' => isset($params['timezone_offset_minutes'])
252
-                                               ? $params['timezone_offset_minutes'] : null
253
-            )
254
-        ));
243
+	public function getHybridOptimization($params)
244
+	{
245
+		$optimize = Route4Me::makeRequst(array(
246
+			'url'    => Endpoint::HYBRID_DATE_OPTIMIZATION,
247
+			'method' => 'GET',
248
+			'query'  => array(
249
+				'target_date_string'      => isset($params['target_date_string'])
250
+											   ? $params['target_date_string'] : null,
251
+				'timezone_offset_minutes' => isset($params['timezone_offset_minutes'])
252
+											   ? $params['timezone_offset_minutes'] : null
253
+			)
254
+		));
255 255
 
256
-        return $optimize;
257
-    }
256
+		return $optimize;
257
+	}
258 258
     
259
-    Public function addDepotsToHybrid($params)
260
-    {
261
-        $depots = Route4Me::makeRequst(array( 
262
-            'url'    => Endpoint::CHANGE_HYBRID_OPTIMIZATION_DEPOT,
263
-            'method' => 'POST',
264
-            'query'  => array(
265
-                'optimization_problem_id' => isset($params['optimization_problem_id'])
266
-                                               ? $params['optimization_problem_id'] : null,
267
-                ),
268
-            'body'   => array(
269
-                'optimization_problem_id' => isset($params['optimization_problem_id'])
270
-                                               ? $params['optimization_problem_id'] : null,
271
-                'delete_old_depots'       => isset($params['delete_old_depots']) ? $params['delete_old_depots'] : null,
272
-                'new_depots'              => isset($params['new_depots']) ? $params['new_depots'] : null,
273
-            )
274
-        ));
259
+	Public function addDepotsToHybrid($params)
260
+	{
261
+		$depots = Route4Me::makeRequst(array( 
262
+			'url'    => Endpoint::CHANGE_HYBRID_OPTIMIZATION_DEPOT,
263
+			'method' => 'POST',
264
+			'query'  => array(
265
+				'optimization_problem_id' => isset($params['optimization_problem_id'])
266
+											   ? $params['optimization_problem_id'] : null,
267
+				),
268
+			'body'   => array(
269
+				'optimization_problem_id' => isset($params['optimization_problem_id'])
270
+											   ? $params['optimization_problem_id'] : null,
271
+				'delete_old_depots'       => isset($params['delete_old_depots']) ? $params['delete_old_depots'] : null,
272
+				'new_depots'              => isset($params['new_depots']) ? $params['new_depots'] : null,
273
+			)
274
+		));
275 275
         
276
-        return $depots;
277
-    }
276
+		return $depots;
277
+	}
278 278
 }
Please login to merge, or discard this patch.
src/Route4Me/Route.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -3,10 +3,8 @@
 block discarded – undo
3 3
 
4 4
 use Route4Me\Common;
5 5
 use Route4Me\Address;
6
-use Route4Me\Exception\BadParam;
7 6
 use Route4Me\RouteParameters;
8 7
 use Route4Me\Route4Me;
9
-use GuzzleHttp\Client;
10 8
 use Route4Me\Enum\Endpoint;
11 9
 
12 10
 class Route extends Common
Please login to merge, or discard this patch.
Indentation   +416 added lines, -416 removed lines patch added patch discarded remove patch
@@ -11,480 +11,480 @@
 block discarded – undo
11 11
 
12 12
 class Route extends Common
13 13
 {
14
-    public $route_id;
15
-    public $member_id;
16
-    public $route_destination_id;
17
-    public $optimization_problem_id;
18
-    public $vehicle_alias;
19
-    public $driver_alias;
20
-    public $trip_distance;
21
-    public $mpg;
22
-    public $gas_price;
23
-    public $route_duration_sec;
24
-    public $destination_count;
25
-    public $parameters;
26
-    public $addresses = array();
27
-    public $links = array();
28
-    public $directions = array();
29
-    public $path = array();
30
-    public $tracking_history = array();
31
-    public $recipient_email;
32
-    public $httpheaders;
33
-    public $is_unrouted;
34
-    public $time;
14
+	public $route_id;
15
+	public $member_id;
16
+	public $route_destination_id;
17
+	public $optimization_problem_id;
18
+	public $vehicle_alias;
19
+	public $driver_alias;
20
+	public $trip_distance;
21
+	public $mpg;
22
+	public $gas_price;
23
+	public $route_duration_sec;
24
+	public $destination_count;
25
+	public $parameters;
26
+	public $addresses = array();
27
+	public $links = array();
28
+	public $directions = array();
29
+	public $path = array();
30
+	public $tracking_history = array();
31
+	public $recipient_email;
32
+	public $httpheaders;
33
+	public $is_unrouted;
34
+	public $time;
35 35
     
36
-    public $dev_lat;
37
-    public $dev_lng;
36
+	public $dev_lat;
37
+	public $dev_lng;
38 38
     
39
-    public $user_route_rating;
40
-    public $member_email;
41
-    public $member_first_name;
42
-    public $member_last_name;
43
-    public $channel_name;
44
-    public $route_cost;
45
-    public $route_revenue;
46
-    public $net_revenue_per_distance_unit;
47
-    public $created_timestamp;
48
-    public $planned_total_route_duration;
49
-    public $actual_travel_distance;
50
-    public $actual_travel_time;
51
-    public $actual_footsteps;
52
-    public $working_time;
53
-    public $driving_time;
54
-    public $idling_time;
55
-    public $paying_miles;
56
-    public $geofence_polygon_type;
57
-    public $geofence_polygon_size;
58
-    public $notes;
59
-    public $member_config_storage;
39
+	public $user_route_rating;
40
+	public $member_email;
41
+	public $member_first_name;
42
+	public $member_last_name;
43
+	public $channel_name;
44
+	public $route_cost;
45
+	public $route_revenue;
46
+	public $net_revenue_per_distance_unit;
47
+	public $created_timestamp;
48
+	public $planned_total_route_duration;
49
+	public $actual_travel_distance;
50
+	public $actual_travel_time;
51
+	public $actual_footsteps;
52
+	public $working_time;
53
+	public $driving_time;
54
+	public $idling_time;
55
+	public $paying_miles;
56
+	public $geofence_polygon_type;
57
+	public $geofence_polygon_size;
58
+	public $notes;
59
+	public $member_config_storage;
60 60
 
61
-    public static function fromArray(array $params) 
62
-    {
63
-        $route = new Route();
64
-        $route->route_id                = Common::getValue($params, 'route_id');
65
-        $route->member_id               = Common::getValue($params, 'member_id');
66
-        $route->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
67
-        $route->vehicle_alias           = Common::getValue($params, 'vehicle_alias');
68
-        $route->driver_alias            = Common::getValue($params, 'driver_alias');
69
-        $route->trip_distance           = Common::getValue($params, 'trip_distance');
70
-        $route->mpg                     = Common::getValue($params, 'mpg');
71
-        $route->gas_price               = Common::getValue($params, 'gas_price');
72
-        $route->route_duration_sec      = Common::getvalue($params, 'route_duration_sec');
73
-        $route->destination_count       = Common::getvalue($params, 'destination_count');
74
-        $route->is_unrouted             = Common::getvalue($params, 'is_unrouted');
61
+	public static function fromArray(array $params) 
62
+	{
63
+		$route = new Route();
64
+		$route->route_id                = Common::getValue($params, 'route_id');
65
+		$route->member_id               = Common::getValue($params, 'member_id');
66
+		$route->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
67
+		$route->vehicle_alias           = Common::getValue($params, 'vehicle_alias');
68
+		$route->driver_alias            = Common::getValue($params, 'driver_alias');
69
+		$route->trip_distance           = Common::getValue($params, 'trip_distance');
70
+		$route->mpg                     = Common::getValue($params, 'mpg');
71
+		$route->gas_price               = Common::getValue($params, 'gas_price');
72
+		$route->route_duration_sec      = Common::getvalue($params, 'route_duration_sec');
73
+		$route->destination_count       = Common::getvalue($params, 'destination_count');
74
+		$route->is_unrouted             = Common::getvalue($params, 'is_unrouted');
75 75
 
76
-        // Make RouteParameters
77
-        if (isset($params['parameters'])) {
78
-            $route->parameters = RouteParameters::fromArray($params['parameters']);
79
-        }
76
+		// Make RouteParameters
77
+		if (isset($params['parameters'])) {
78
+			$route->parameters = RouteParameters::fromArray($params['parameters']);
79
+		}
80 80
 
81
-        if (isset($params['addresses'])) {
82
-            $addresses = array();
83
-            foreach ($params['addresses'] as $address) {
84
-                $addresses[] = Address::fromArray($address);
85
-            }
81
+		if (isset($params['addresses'])) {
82
+			$addresses = array();
83
+			foreach ($params['addresses'] as $address) {
84
+				$addresses[] = Address::fromArray($address);
85
+			}
86 86
 
87
-            $route->addresses = $addresses;
88
-        }
87
+			$route->addresses = $addresses;
88
+		}
89 89
 
90
-        $route->links            = Common::getValue($params, 'links', array());
91
-        $route->directions       = Common::getValue($params, 'directions', array());
92
-        $route->path             = Common::getValue($params, 'path', array());
93
-        $route->tracking_history = Common::getValue($params, 'tracking_history', array());
90
+		$route->links            = Common::getValue($params, 'links', array());
91
+		$route->directions       = Common::getValue($params, 'directions', array());
92
+		$route->path             = Common::getValue($params, 'path', array());
93
+		$route->tracking_history = Common::getValue($params, 'tracking_history', array());
94 94
 
95
-        return $route;
96
-    }
95
+		return $route;
96
+	}
97 97
 
98
-    public static function getRoutes($routeId=null, $params=null)
99
-    {
100
-        $result = Route4Me::makeRequst(array(
101
-            'url'    => Endpoint::ROUTE_V4,
102
-            'method' => 'GET',
103
-            'query'  => array(
104
-                'api_key'                  => Route4Me::getApiKey(),
105
-                'route_id'                 => !is_null($routeId) ? implode(',', (array) $routeId) : null,
106
-                'route_path_output'        => isset($params['route_path_output']) ? $params['route_path_output'] : null,
107
-                'query'                    => isset($params['query']) ? $params['query'] : null,
108
-                'directions'               => isset($params['directions']) ? $params['directions'] : null,
109
-                'device_tracking_history'  => isset($params['device_tracking_history']) ? $params['device_tracking_history'] : null,
110
-                'limit'                    => isset($params['limit']) ? $params['limit'] : null,
111
-                'offset'                   => isset($params['offset']) ? $params['offset'] : null
112
-            )
113
-        ));
98
+	public static function getRoutes($routeId=null, $params=null)
99
+	{
100
+		$result = Route4Me::makeRequst(array(
101
+			'url'    => Endpoint::ROUTE_V4,
102
+			'method' => 'GET',
103
+			'query'  => array(
104
+				'api_key'                  => Route4Me::getApiKey(),
105
+				'route_id'                 => !is_null($routeId) ? implode(',', (array) $routeId) : null,
106
+				'route_path_output'        => isset($params['route_path_output']) ? $params['route_path_output'] : null,
107
+				'query'                    => isset($params['query']) ? $params['query'] : null,
108
+				'directions'               => isset($params['directions']) ? $params['directions'] : null,
109
+				'device_tracking_history'  => isset($params['device_tracking_history']) ? $params['device_tracking_history'] : null,
110
+				'limit'                    => isset($params['limit']) ? $params['limit'] : null,
111
+				'offset'                   => isset($params['offset']) ? $params['offset'] : null
112
+			)
113
+		));
114 114
         
115
-        if ($routeId) {
116
-            return Route::fromArray($result); die("");
117
-        } else {
118
-            $routes = array();
119
-            foreach($result as $route) {
120
-                $routes[] = Route::fromArray($route);
121
-            }
122
-            return $routes;
123
-        }
124
-    }
115
+		if ($routeId) {
116
+			return Route::fromArray($result); die("");
117
+		} else {
118
+			$routes = array();
119
+			foreach($result as $route) {
120
+				$routes[] = Route::fromArray($route);
121
+			}
122
+			return $routes;
123
+		}
124
+	}
125 125
 
126
-    public function getRoutePoints($routeId, $params)
127
-    {
128
-        $result = Route4Me::makeRequst(array(
129
-            'url'    => Endpoint::ROUTE_V4,
130
-            'method' => 'GET',
131
-            'query'  => array(
132
-                'api_key'           => Route4Me::getApiKey(),
133
-                'route_id'          => $routeId,
134
-                'route_path_output' => isset($params['route_path_output']) ? $params['route_path_output'] : null,
135
-                'compress_path_points' => isset($params['compress_path_points']) ? $params['compress_path_points'] : null,
136
-                'directions'        => isset($params['directions']) ? $params['directions'] : null,
137
-            )
138
-        ));
126
+	public function getRoutePoints($routeId, $params)
127
+	{
128
+		$result = Route4Me::makeRequst(array(
129
+			'url'    => Endpoint::ROUTE_V4,
130
+			'method' => 'GET',
131
+			'query'  => array(
132
+				'api_key'           => Route4Me::getApiKey(),
133
+				'route_id'          => $routeId,
134
+				'route_path_output' => isset($params['route_path_output']) ? $params['route_path_output'] : null,
135
+				'compress_path_points' => isset($params['compress_path_points']) ? $params['compress_path_points'] : null,
136
+				'directions'        => isset($params['directions']) ? $params['directions'] : null,
137
+			)
138
+		));
139 139
 
140
-        return $result;
141
-    }
140
+		return $result;
141
+	}
142 142
 
143
-    public function duplicateRoute($route_id)
144
-    {
145
-        $result = Route4Me::makeRequst(array(
146
-            'url'    => Endpoint::ROUTE_DUPLICATE,
147
-            'method' => 'GET',
148
-            'query'  => array(
149
-                'api_key'  => Route4Me::getApiKey(),
150
-                'route_id' => $route_id,
151
-                'to'       => 'none',
152
-            )
153
-        ));
143
+	public function duplicateRoute($route_id)
144
+	{
145
+		$result = Route4Me::makeRequst(array(
146
+			'url'    => Endpoint::ROUTE_DUPLICATE,
147
+			'method' => 'GET',
148
+			'query'  => array(
149
+				'api_key'  => Route4Me::getApiKey(),
150
+				'route_id' => $route_id,
151
+				'to'       => 'none',
152
+			)
153
+		));
154 154
         
155
-        return $result;
156
-    }
155
+		return $result;
156
+	}
157 157
     
158
-    public function resequenceRoute($params)
159
-    {
160
-        $result = Route4Me::makeRequst(array(
161
-            'url'    => Endpoint::ROUTE_V4,
162
-            'method' => 'PUT',
163
-            'query'  => array(
164
-                'api_key'              => Route4Me::getApiKey(),
165
-                'route_id'             => isset($params['route_id']) ? $params['route_id'] : null,
166
-                'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
167
-            ),
168
-            'body'   => array(
169
-                'addresses' => isset($params['addresses']) ? $params['addresses'] : null,
170
-            )
171
-        ));
158
+	public function resequenceRoute($params)
159
+	{
160
+		$result = Route4Me::makeRequst(array(
161
+			'url'    => Endpoint::ROUTE_V4,
162
+			'method' => 'PUT',
163
+			'query'  => array(
164
+				'api_key'              => Route4Me::getApiKey(),
165
+				'route_id'             => isset($params['route_id']) ? $params['route_id'] : null,
166
+				'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
167
+			),
168
+			'body'   => array(
169
+				'addresses' => isset($params['addresses']) ? $params['addresses'] : null,
170
+			)
171
+		));
172 172
         
173
-        return $result;
174
-    }
173
+		return $result;
174
+	}
175 175
     
176
-    public function resequenceAllAddresses($params)
177
-    {
178
-        $result = Route4Me::makeRequst(array(
179
-            'url'    => Endpoint::REOPTIMIZE_V3_2,
180
-            'method' => 'GET',
181
-            'query'  => array(
182
-                'api_key'              => Route4Me::getApiKey(),
183
-                'route_id'             => isset($params['route_id']) ? $params['route_id'] : null,
184
-                'disable_optimization' => isset($params['disable_optimization']) ? $params['disable_optimization'] : null,
185
-                'optimize'             => isset($params['optimize']) ? $params['optimize'] : null,
186
-            )
187
-        ));
176
+	public function resequenceAllAddresses($params)
177
+	{
178
+		$result = Route4Me::makeRequst(array(
179
+			'url'    => Endpoint::REOPTIMIZE_V3_2,
180
+			'method' => 'GET',
181
+			'query'  => array(
182
+				'api_key'              => Route4Me::getApiKey(),
183
+				'route_id'             => isset($params['route_id']) ? $params['route_id'] : null,
184
+				'disable_optimization' => isset($params['disable_optimization']) ? $params['disable_optimization'] : null,
185
+				'optimize'             => isset($params['optimize']) ? $params['optimize'] : null,
186
+			)
187
+		));
188 188
         
189
-        return $result;
190
-    }
189
+		return $result;
190
+	}
191 191
 
192
-    public function mergeRoutes($params)
193
-    {
194
-        $result = Route4Me::makeRequst(array(
195
-            'url'    => Endpoint::ROUTES_MERGE,
196
-            'method' => 'POST',
197
-            'query'  => array(
198
-                'api_key' => Route4Me::getApiKey(),
199
-              ),
200
-            'body'   => array(
201
-                'route_ids'     => isset($params['route_ids']) ? $params['route_ids'] : null,
202
-                'depot_address' => isset($params['depot_address']) ? $params['depot_address'] : null,
203
-                'remove_origin' => isset($params['remove_origin']) ? $params['remove_origin'] : null,
204
-                'depot_lat'     => isset($params['depot_lat']) ? $params['depot_lat'] : null,
205
-                'depot_lat'     => isset($params['depot_lat']) ? $params['depot_lat'] : null
206
-              ),
207
-            'HTTPHEADER'  => 'Content-Type: multipart/form-data'
208
-        ));
192
+	public function mergeRoutes($params)
193
+	{
194
+		$result = Route4Me::makeRequst(array(
195
+			'url'    => Endpoint::ROUTES_MERGE,
196
+			'method' => 'POST',
197
+			'query'  => array(
198
+				'api_key' => Route4Me::getApiKey(),
199
+			  ),
200
+			'body'   => array(
201
+				'route_ids'     => isset($params['route_ids']) ? $params['route_ids'] : null,
202
+				'depot_address' => isset($params['depot_address']) ? $params['depot_address'] : null,
203
+				'remove_origin' => isset($params['remove_origin']) ? $params['remove_origin'] : null,
204
+				'depot_lat'     => isset($params['depot_lat']) ? $params['depot_lat'] : null,
205
+				'depot_lat'     => isset($params['depot_lat']) ? $params['depot_lat'] : null
206
+			  ),
207
+			'HTTPHEADER'  => 'Content-Type: multipart/form-data'
208
+		));
209 209
         
210
-        return $result;
211
-    }
210
+		return $result;
211
+	}
212 212
     
213
-    public function shareRoute($params)
214
-    {
215
-        $result = Route4Me::makeRequst(array(
216
-            'url'    => Endpoint::ROUTE_SHARE,
217
-            'method' => 'POST',
218
-            'query'  => array(
219
-                'api_key'         => Route4Me::getApiKey(),
220
-                'route_id'        => isset($params['route_id']) ? $params['route_id'] : null,
221
-                'response_format' => isset($params['response_format']) ? $params['response_format'] : null,
222
-            ),
223
-            'body'  => array(
224
-                'recipient_email' => isset($params['recipient_email']) ? $params['recipient_email'] : null,
225
-            ),
226
-            'HTTPHEADER'  => 'Content-Type: multipart/form-data'
227
-        ));
213
+	public function shareRoute($params)
214
+	{
215
+		$result = Route4Me::makeRequst(array(
216
+			'url'    => Endpoint::ROUTE_SHARE,
217
+			'method' => 'POST',
218
+			'query'  => array(
219
+				'api_key'         => Route4Me::getApiKey(),
220
+				'route_id'        => isset($params['route_id']) ? $params['route_id'] : null,
221
+				'response_format' => isset($params['response_format']) ? $params['response_format'] : null,
222
+			),
223
+			'body'  => array(
224
+				'recipient_email' => isset($params['recipient_email']) ? $params['recipient_email'] : null,
225
+			),
226
+			'HTTPHEADER'  => 'Content-Type: multipart/form-data'
227
+		));
228 228
         
229
-        return $result;
230
-    }
229
+		return $result;
230
+	}
231 231
     
232
-    // Returns random route_id from existing routes between $offset and $offset+$limit
233
-    public function getRandomRouteId($offset,$limit)
234
-    {
235
-        $query['limit'] = isset($params['limit']) ? $params['limit'] : 30;
236
-        $query['offset'] = isset($params['offset']) ? $params['offset'] : 0;
232
+	// Returns random route_id from existing routes between $offset and $offset+$limit
233
+	public function getRandomRouteId($offset,$limit)
234
+	{
235
+		$query['limit'] = isset($params['limit']) ? $params['limit'] : 30;
236
+		$query['offset'] = isset($params['offset']) ? $params['offset'] : 0;
237 237
             
238
-        $json = Route4Me::makeRequst(array(
239
-            'url'    => Endpoint::ROUTE_V4,
240
-            'method' => 'GET',
241
-            'query'  => $query
242
-        ));
238
+		$json = Route4Me::makeRequst(array(
239
+			'url'    => Endpoint::ROUTE_V4,
240
+			'method' => 'GET',
241
+			'query'  => $query
242
+		));
243 243
         
244
-        if (sizeof($json)>0) {
245
-            $routes = array();
244
+		if (sizeof($json)>0) {
245
+			$routes = array();
246 246
             
247
-            foreach($json as $route) {
248
-                $routes[] = Route::fromArray($route);
249
-            }
247
+			foreach($json as $route) {
248
+				$routes[] = Route::fromArray($route);
249
+			}
250 250
             
251
-            $num=rand(0,sizeof($routes)-1);
252
-            $rRoute=(array)$routes[$num];
251
+			$num=rand(0,sizeof($routes)-1);
252
+			$rRoute=(array)$routes[$num];
253 253
             
254
-            if (is_array($rRoute)) {
255
-                return $rRoute["route_id"];
256
-            } else {
257
-                return null;
258
-            }
259
-        } else {
260
-            echo "<br> There are no routes in the account. Please, create the routes first. <br>";
261
-            return null;
262
-        }
263
-    }
254
+			if (is_array($rRoute)) {
255
+				return $rRoute["route_id"];
256
+			} else {
257
+				return null;
258
+			}
259
+		} else {
260
+			echo "<br> There are no routes in the account. Please, create the routes first. <br>";
261
+			return null;
262
+		}
263
+	}
264 264
 
265
-    public function update()
266
-    {
267
-        $route = Route4Me::makeRequst(array(
268
-            'url'    => Endpoint::ROUTE_V4,
269
-            'method' => 'PUT',
270
-            'query'  => array(
271
-                'route_id'  => isset($this->route_id) ? $this->route_id : null
272
-            ),
273
-            'body' => array (
274
-                'parameters' => $this->parameters,
275
-                ),
276
-            'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
277
-        ));
265
+	public function update()
266
+	{
267
+		$route = Route4Me::makeRequst(array(
268
+			'url'    => Endpoint::ROUTE_V4,
269
+			'method' => 'PUT',
270
+			'query'  => array(
271
+				'route_id'  => isset($this->route_id) ? $this->route_id : null
272
+			),
273
+			'body' => array (
274
+				'parameters' => $this->parameters,
275
+				),
276
+			'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
277
+		));
278 278
 
279
-        return Route::fromArray($route);
280
-    }
279
+		return Route::fromArray($route);
280
+	}
281 281
     
282
-    public function updateAddress($address=null)
283
-    {
284
-        $body = sizeof($this->addresses)<1 ? get_object_vars($this->parameters) 
285
-            : (isset($this->addresses[0]) ? $this->addresses[0] : get_object_vars($this->parameters));
282
+	public function updateAddress($address=null)
283
+	{
284
+		$body = sizeof($this->addresses)<1 ? get_object_vars($this->parameters) 
285
+			: (isset($this->addresses[0]) ? $this->addresses[0] : get_object_vars($this->parameters));
286 286
 
287
-        $result = Route4Me::makeRequst(array(
288
-            'url'    => Endpoint::ADDRESS_V4,
289
-            'method' => 'PUT',
290
-            'query'  => array(
291
-                'route_id'             => isset($this->route_id) ? $this->route_id : null,
292
-                'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
293
-            ),
294
-            'body'        => $body,
295
-            'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
296
-        ));
287
+		$result = Route4Me::makeRequst(array(
288
+			'url'    => Endpoint::ADDRESS_V4,
289
+			'method' => 'PUT',
290
+			'query'  => array(
291
+				'route_id'             => isset($this->route_id) ? $this->route_id : null,
292
+				'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
293
+			),
294
+			'body'        => $body,
295
+			'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
296
+		));
297 297
 
298
-        return $result;
299
-    }
298
+		return $result;
299
+	}
300 300
 
301
-    public function updateRouteAddress()
302
-    {
303
-        $result = Route4Me::makeRequst(array(
304
-            'url'    => Endpoint::ADDRESS_V4,
305
-            'method' => 'PUT',
306
-            'query'  => array(
307
-                'route_id'             => isset($this->route_id) ? $this->route_id : null,
308
-                'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
309
-            ),
310
-            'body'        => array(
311
-                "parameters" => isset($this->parameters) ? get_object_vars($this->parameters) : null,
312
-                "addresses"  => isset($this->addresses) ? $this->addresses : null
313
-            ),
314
-            'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
315
-        ));
301
+	public function updateRouteAddress()
302
+	{
303
+		$result = Route4Me::makeRequst(array(
304
+			'url'    => Endpoint::ADDRESS_V4,
305
+			'method' => 'PUT',
306
+			'query'  => array(
307
+				'route_id'             => isset($this->route_id) ? $this->route_id : null,
308
+				'route_destination_id' => isset($this->route_destination_id) ? $this->route_destination_id : null,
309
+			),
310
+			'body'        => array(
311
+				"parameters" => isset($this->parameters) ? get_object_vars($this->parameters) : null,
312
+				"addresses"  => isset($this->addresses) ? $this->addresses : null
313
+			),
314
+			'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
315
+		));
316 316
 
317
-        return $result;
318
-    }
317
+		return $result;
318
+	}
319 319
 
320
-    public function addAddresses($params)
321
-    {
322
-        $route = Route4Me::makeRequst(array(
323
-            'url'    => Endpoint::ROUTE_V4,
324
-            'method' => 'PUT',
325
-            'query'  => array(
326
-                'api_key'   => Route4Me::getApiKey(),
327
-                'route_id'  => isset($params['route_id']) ? $params['route_id'] : null
328
-            ),
329
-            'body'   => array(
330
-                'addresses' => isset($params['addresses']) ? $params['addresses'] : null
331
-            ),
332
-            'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
333
-        ));
320
+	public function addAddresses($params)
321
+	{
322
+		$route = Route4Me::makeRequst(array(
323
+			'url'    => Endpoint::ROUTE_V4,
324
+			'method' => 'PUT',
325
+			'query'  => array(
326
+				'api_key'   => Route4Me::getApiKey(),
327
+				'route_id'  => isset($params['route_id']) ? $params['route_id'] : null
328
+			),
329
+			'body'   => array(
330
+				'addresses' => isset($params['addresses']) ? $params['addresses'] : null
331
+			),
332
+			'HTTPHEADER'  => isset($this->httpheaders) ? $this->httpheaders : null,
333
+		));
334 334
 
335
-        return Route::fromArray($route);
336
-    }
335
+		return Route::fromArray($route);
336
+	}
337 337
     
338
-    public function insertAddressOptimalPosition(array $params)
339
-    {
340
-        $route = Route4Me::makeRequst(array(
341
-            'url'    => Endpoint::ROUTE_V4,
342
-            'method' => 'PUT',
343
-            'query'  => array(
344
-                'api_key'  => Route4Me::getApiKey(),
345
-                'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
346
-            ),
347
-            'body'   => array(
348
-                'addresses'        => isset($params['addresses']) ? $params['addresses'] : null,
349
-                'optimal_position' => isset($params['optimal_position']) ? $params['optimal_position'] : null,
350
-            )
351
-        ));
338
+	public function insertAddressOptimalPosition(array $params)
339
+	{
340
+		$route = Route4Me::makeRequst(array(
341
+			'url'    => Endpoint::ROUTE_V4,
342
+			'method' => 'PUT',
343
+			'query'  => array(
344
+				'api_key'  => Route4Me::getApiKey(),
345
+				'route_id' => isset($params['route_id']) ? $params['route_id'] : null,
346
+			),
347
+			'body'   => array(
348
+				'addresses'        => isset($params['addresses']) ? $params['addresses'] : null,
349
+				'optimal_position' => isset($params['optimal_position']) ? $params['optimal_position'] : null,
350
+			)
351
+		));
352 352
 
353
-        return Route::fromArray($route);
354
-    }
353
+		return Route::fromArray($route);
354
+	}
355 355
     
356
-    public function addNoteFile($params)
357
-    {
358
-        $fname = isset($params['strFilename']) ? $params['strFilename'] : null;
359
-        $rpath = realpath($fname);
356
+	public function addNoteFile($params)
357
+	{
358
+		$fname = isset($params['strFilename']) ? $params['strFilename'] : null;
359
+		$rpath = realpath($fname);
360 360
         
361
-        $result= Route4Me::makeRequst(array(
362
-            'url'    => Endpoint::ROUTE_NOTES_ADD,
363
-            'method' => 'POST',
364
-            'query'  => array(
365
-                'api_key'     => Route4Me::getApiKey(),
366
-                'route_id'    => isset($params['route_id']) ? $params['route_id'] : null,
367
-                'address_id'  => isset($params['address_id']) ? $params['address_id'] : null,
368
-                'dev_lat'     => isset($params['dev_lat']) ? $params['dev_lat'] : null,
369
-                'dev_lng'     => isset($params['dev_lng']) ? $params['dev_lng'] : null,
370
-                'device_type' => isset($params['device_type']) ? $params['device_type'] : null,
371
-                'dev_lng'     => isset($params['dev_lng']) ? $params['dev_lng'] : null,
372
-            ),
373
-            'body'  => array(
374
-                'strUpdateType'   => isset($params['strUpdateType']) ? $params['strUpdateType'] : null,
375
-                'strFilename'     => isset($params['strFilename']) ? $params['strFilename'] : null,
376
-                'strNoteContents' => isset($params['strNoteContents']) ? $params['strNoteContents'] : null,
377
-            ),
378
-            'FILE'  => $rpath,
361
+		$result= Route4Me::makeRequst(array(
362
+			'url'    => Endpoint::ROUTE_NOTES_ADD,
363
+			'method' => 'POST',
364
+			'query'  => array(
365
+				'api_key'     => Route4Me::getApiKey(),
366
+				'route_id'    => isset($params['route_id']) ? $params['route_id'] : null,
367
+				'address_id'  => isset($params['address_id']) ? $params['address_id'] : null,
368
+				'dev_lat'     => isset($params['dev_lat']) ? $params['dev_lat'] : null,
369
+				'dev_lng'     => isset($params['dev_lng']) ? $params['dev_lng'] : null,
370
+				'device_type' => isset($params['device_type']) ? $params['device_type'] : null,
371
+				'dev_lng'     => isset($params['dev_lng']) ? $params['dev_lng'] : null,
372
+			),
373
+			'body'  => array(
374
+				'strUpdateType'   => isset($params['strUpdateType']) ? $params['strUpdateType'] : null,
375
+				'strFilename'     => isset($params['strFilename']) ? $params['strFilename'] : null,
376
+				'strNoteContents' => isset($params['strNoteContents']) ? $params['strNoteContents'] : null,
377
+			),
378
+			'FILE'  => $rpath,
379 379
 
380
-            'HTTPHEADER' => array(
381
-                'Content-Type: application/x-www-form-urlencoded'
382
-            )
383
-        ));
380
+			'HTTPHEADER' => array(
381
+				'Content-Type: application/x-www-form-urlencoded'
382
+			)
383
+		));
384 384
 
385
-        return $result;
386
-    }
385
+		return $result;
386
+	}
387 387
 
388
-    public function delete($route_id)
389
-    {
390
-        $result = Route4Me::makeRequst(array(
391
-            'url'    => Endpoint::ROUTE_V4,
392
-            'method' => 'DELETE',
393
-            'query'  => array( 'route_id' => $route_id )
394
-        ));
388
+	public function delete($route_id)
389
+	{
390
+		$result = Route4Me::makeRequst(array(
391
+			'url'    => Endpoint::ROUTE_V4,
392
+			'method' => 'DELETE',
393
+			'query'  => array( 'route_id' => $route_id )
394
+		));
395 395
         
396
-         $result = Route4Me::makeRequst(array(
397
-            'url'    => Endpoint::ROUTES_DELETE,
398
-            'method' => 'DELETE',
399
-            'query'  => array(
400
-                'api_key' => Route4Me::getApiKey(),
401
-                'route_id' => $route_id,
402
-            )
403
-        ));
396
+		 $result = Route4Me::makeRequst(array(
397
+			'url'    => Endpoint::ROUTES_DELETE,
398
+			'method' => 'DELETE',
399
+			'query'  => array(
400
+				'api_key' => Route4Me::getApiKey(),
401
+				'route_id' => $route_id,
402
+			)
403
+		));
404 404
         
405
-        return $result;
406
-    }
405
+		return $result;
406
+	}
407 407
     
408
-    public function GetAddressesFromRoute($route_id)
409
-    {
410
-        $route1=Route::getRoutes($route_id,null);
411
-        if (isset($route1)) {
412
-            return $route1->addresses;
413
-        } else {
414
-            return null;
415
-        }
416
-    }
408
+	public function GetAddressesFromRoute($route_id)
409
+	{
410
+		$route1=Route::getRoutes($route_id,null);
411
+		if (isset($route1)) {
412
+			return $route1->addresses;
413
+		} else {
414
+			return null;
415
+		}
416
+	}
417 417
     
418
-    public function GetRandomAddressFromRoute($route_id)
419
-    {
420
-        $route1 = Route::getRoutes($route_id,null);
418
+	public function GetRandomAddressFromRoute($route_id)
419
+	{
420
+		$route1 = Route::getRoutes($route_id,null);
421 421
         
422
-        if (isset($route1)) {
423
-            $addresses = $route1->addresses;
422
+		if (isset($route1)) {
423
+			$addresses = $route1->addresses;
424 424
             
425
-            $rnd = rand(0,sizeof($addresses)-1);
425
+			$rnd = rand(0,sizeof($addresses)-1);
426 426
             
427
-            return $addresses[$rnd];
427
+			return $addresses[$rnd];
428 428
             
429
-        } else {
430
-            return null;
431
-        }
432
-    }
429
+		} else {
430
+			return null;
431
+		}
432
+	}
433 433
 
434
-    public function getRouteId()
435
-    {
436
-        return $this->route_id;
437
-    }
434
+	public function getRouteId()
435
+	{
436
+		return $this->route_id;
437
+	}
438 438
 
439
-    public function getOptimizationId()
440
-    {
441
-        return $this->optimization_problem_id;
442
-    }
439
+	public function getOptimizationId()
440
+	{
441
+		return $this->optimization_problem_id;
442
+	}
443 443
     
444
-    public function GetLastLocation(array $params)
445
-    {
446
-        $route = Route4Me::makeRequst(array(
447
-            'url'    => Endpoint::ROUTE_V4,
448
-            'method' => 'GET',
449
-            'query'  => array(
450
-                'api_key'                 => Route4Me::getApiKey(),
451
-                'route_id'                => isset($params['route_id']) ? $params['route_id'] : null,
452
-                'device_tracking_history' => isset($params['device_tracking_history']) ? $params['device_tracking_history'] : null
453
-            )
454
-        ));
444
+	public function GetLastLocation(array $params)
445
+	{
446
+		$route = Route4Me::makeRequst(array(
447
+			'url'    => Endpoint::ROUTE_V4,
448
+			'method' => 'GET',
449
+			'query'  => array(
450
+				'api_key'                 => Route4Me::getApiKey(),
451
+				'route_id'                => isset($params['route_id']) ? $params['route_id'] : null,
452
+				'device_tracking_history' => isset($params['device_tracking_history']) ? $params['device_tracking_history'] : null
453
+			)
454
+		));
455 455
 
456
-        return Route::fromArray($route);
457
-    }
456
+		return Route::fromArray($route);
457
+	}
458 458
     
459
-    public function GetTrackingHistoryFromTimeRange(array $params)
460
-    {
461
-        $route = Route4Me::makeRequst(array(
462
-            'url'    => Endpoint::GET_DEVICE_LOCATION,
463
-            'method' => 'GET',
464
-            'query'  => array(
465
-                'api_key'     => Route4Me::getApiKey(),
466
-                'route_id'    => isset($params['route_id']) ? $params['route_id'] : null,
467
-                'format'      => isset($params['format']) ? $params['format'] : null,
468
-                'time_period' => isset($params['time_period']) ? $params['time_period'] : null,
469
-                'start_date'  => isset($params['start_date']) ? $params['start_date'] : null,
470
-                'end_date'    => isset($params['end_date']) ? $params['end_date'] : null
471
-                )
472
-        ));
459
+	public function GetTrackingHistoryFromTimeRange(array $params)
460
+	{
461
+		$route = Route4Me::makeRequst(array(
462
+			'url'    => Endpoint::GET_DEVICE_LOCATION,
463
+			'method' => 'GET',
464
+			'query'  => array(
465
+				'api_key'     => Route4Me::getApiKey(),
466
+				'route_id'    => isset($params['route_id']) ? $params['route_id'] : null,
467
+				'format'      => isset($params['format']) ? $params['format'] : null,
468
+				'time_period' => isset($params['time_period']) ? $params['time_period'] : null,
469
+				'start_date'  => isset($params['start_date']) ? $params['start_date'] : null,
470
+				'end_date'    => isset($params['end_date']) ? $params['end_date'] : null
471
+				)
472
+		));
473 473
 
474
-        return $route;
475
-    }
474
+		return $route;
475
+	}
476 476
     
477
-    public function GetAssetTracking(array $params)
478
-    {
479
-        $route = Route4Me::makeRequst(array(
480
-            'url'    => Endpoint::STATUS_V4,
481
-            'method' => 'GET',
482
-            'query'  => array(
483
-                'api_key'  => Route4Me::getApiKey(),
484
-                'tracking' => isset($params['tracking']) ? $params['tracking'] : null
485
-                )
486
-        ));
477
+	public function GetAssetTracking(array $params)
478
+	{
479
+		$route = Route4Me::makeRequst(array(
480
+			'url'    => Endpoint::STATUS_V4,
481
+			'method' => 'GET',
482
+			'query'  => array(
483
+				'api_key'  => Route4Me::getApiKey(),
484
+				'tracking' => isset($params['tracking']) ? $params['tracking'] : null
485
+				)
486
+		));
487 487
 
488
-        return $route;
489
-    }
488
+		return $route;
489
+	}
490 490
 }
Please login to merge, or discard this patch.
examples/Activities/SearchActivities.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -17,19 +17,19 @@
 block discarded – undo
17 17
 
18 18
 // Itereate through all the existing activity types
19 19
 foreach ($activityTypes->getConstants() as $prop => $value) {
20
-    $activityParameters = ActivityParameters::fromArray(array(
21
-        "activity_type" => $value,
22
-        "limit"         => 2,
23
-        "offset"        => 0
24
-    ));
20
+	$activityParameters = ActivityParameters::fromArray(array(
21
+		"activity_type" => $value,
22
+		"limit"         => 2,
23
+		"offset"        => 0
24
+	));
25 25
     
26
-    $activities = new ActivityParameters();
27
-    $results = $activities->searcActivities($activityParameters);
26
+	$activities = new ActivityParameters();
27
+	$results = $activities->searcActivities($activityParameters);
28 28
     
29
-    foreach ($results as $key => $activity) {
30
-        Route4Me::simplePrint($activity);
31
-        echo "<br>";
32
-    }
29
+	foreach ($results as $key => $activity) {
30
+		Route4Me::simplePrint($activity);
31
+		echo "<br>";
32
+	}
33 33
     
34
-    echo "------------------- <br><br>";
34
+	echo "------------------- <br><br>";
35 35
 }
Please login to merge, or discard this patch.
examples/Activities/GetActivities.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
 Route4Me::setApiKey('11111111111111111111111111111111');
15 15
 
16 16
 $activityParameters = ActivityParameters::fromArray(array(
17
-    "limit" => 10,
18
-    "offset" => 0
17
+	"limit" => 10,
18
+	"offset" => 0
19 19
 ));
20 20
 
21 21
 $activities = new ActivityParameters();
@@ -23,6 +23,6 @@  discard block
 block discarded – undo
23 23
 $results = $activities->getValue($actresults, "results");
24 24
 
25 25
 foreach ($results as $result) {
26
-    Route4Me::simplePrint($result);
27
-    echo "<br>";
26
+	Route4Me::simplePrint($result);
27
+	echo "<br>";
28 28
 }
Please login to merge, or discard this patch.
examples/Activities/GetRouteActivities.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -21,20 +21,20 @@
 block discarded – undo
21 21
 
22 22
 // Itereate through all the existing activity types
23 23
 foreach ($activityTypes->getConstants() as $prop => $value) {
24
-    $activityParameters = ActivityParameters::fromArray(array(
25
-        "activity_type" => $value,
26
-        "limit"         => 2,
27
-        "offset"        => 0,
28
-        "route_id"      => $route_id
29
-    ));
24
+	$activityParameters = ActivityParameters::fromArray(array(
25
+		"activity_type" => $value,
26
+		"limit"         => 2,
27
+		"offset"        => 0,
28
+		"route_id"      => $route_id
29
+	));
30 30
     
31
-    $activities = new ActivityParameters();
32
-    $results = $activities->searcActivities($activityParameters);
31
+	$activities = new ActivityParameters();
32
+	$results = $activities->searcActivities($activityParameters);
33 33
     
34
-    foreach ($results as $key => $activity) {
35
-        Route4Me::simplePrint($activity);
36
-        echo "<br>";
37
-    }
34
+	foreach ($results as $key => $activity) {
35
+		Route4Me::simplePrint($activity);
36
+		echo "<br>";
37
+	}
38 38
     
39
-    echo "------------------- <br><br>";
39
+	echo "------------------- <br><br>";
40 40
 }
Please login to merge, or discard this patch.
examples/Activities/GetLastActivities.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
 Route4Me::setApiKey('11111111111111111111111111111111');
17 17
 
18 18
 $activityParameters = ActivityParameters::fromArray(array(
19
-    "limit" => 10,
20
-    "offset" => 0,
21
-    "start" => strtotime("-1 week")
19
+	"limit" => 10,
20
+	"offset" => 0,
21
+	"start" => strtotime("-1 week")
22 22
 ));
23 23
 
24 24
 $activities = new ActivityParameters();
@@ -26,6 +26,6 @@  discard block
 block discarded – undo
26 26
 $results = $activities->getValue($actresults, "results");
27 27
 
28 28
 foreach ($results as $result) {
29
-    Route4Me::simplePrint($result);
30
-    echo "<br>";
29
+	Route4Me::simplePrint($result);
30
+	echo "<br>";
31 31
 }
Please login to merge, or discard this patch.
examples/Activities/SendUserMessage.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@
 block discarded – undo
17 17
 $route_id = $route->getRandomRouteId(0, 10);
18 18
 
19 19
 $postParameters = ActivityParameters::fromArray(array(
20
-    "activity_type"     => "user_message",
21
-    "activity_message"  => "Hello - php!",
22
-    "route_id"          => $route_id
20
+	"activity_type"     => "user_message",
21
+	"activity_message"  => "Hello - php!",
22
+	"route_id"          => $route_id
23 23
 ));
24 24
 
25 25
 $activities = new ActivityParameters();
Please login to merge, or discard this patch.