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.
Test Failed
Push — master ( 77a95b...6c805f )
by Igor
08:36 queued 12s
created
UnitTestFiles/Test/AdvancedConstraintsUnitTests.php 2 patches
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -14,79 +14,79 @@
 block discarded – undo
14 14
 use Route4Me\V5\Addresses\RouteAdvancedConstraints;
15 15
 
16 16
 class AdvancedConstraintsUnitTests extends \PHPUnit\Framework\TestCase {
17
-    public static $problem;
17
+	public static $problem;
18 18
 
19
-    public static function setUpBeforeClass()
20
-    {
21
-        Route4Me::setApiKey(Constants::API_KEY);
22
-        self::$problem = null;
23
-    }
19
+	public static function setUpBeforeClass()
20
+	{
21
+		Route4Me::setApiKey(Constants::API_KEY);
22
+		self::$problem = null;
23
+	}
24 24
 
25
-    public function testAdvancedConstraintsExample12()
26
-    {
27
-        $addresses = array_map('str_getcsv', file(dirname(__FILE__).'/data/locations.csv'));
28
-        array_walk($addresses, function(&$a) use ($addresses) { $a = Address::fromArray(array_combine($addresses[0], $a)); });
29
-        array_shift($addresses);
25
+	public function testAdvancedConstraintsExample12()
26
+	{
27
+		$addresses = array_map('str_getcsv', file(dirname(__FILE__).'/data/locations.csv'));
28
+		array_walk($addresses, function(&$a) use ($addresses) { $a = Address::fromArray(array_combine($addresses[0], $a)); });
29
+		array_shift($addresses);
30 30
 
31
-        $parameters = RouteParameters::fromArray([
32
-            'algorithm_type' => AlgorithmType::ADVANCED_CVRP_TW,
33
-            'store_route' => false,
34
-            'rt' => true,
35
-            'parts' => 30,
36
-            'metric' => Metric::MATRIX,
37
-            'member_id' => 444333,
38
-            'route_name' => "Drivers Schedules - 3 Territories",
39
-            'optimize' => "Distance",
40
-            'distance_unit' => "mi",
41
-            'device_type' => DeviceType::WEB,
42
-            'travel_mode' => "Driving",
43
-            'advanced_constraints' => []
44
-        ]);
31
+		$parameters = RouteParameters::fromArray([
32
+			'algorithm_type' => AlgorithmType::ADVANCED_CVRP_TW,
33
+			'store_route' => false,
34
+			'rt' => true,
35
+			'parts' => 30,
36
+			'metric' => Metric::MATRIX,
37
+			'member_id' => 444333,
38
+			'route_name' => "Drivers Schedules - 3 Territories",
39
+			'optimize' => "Distance",
40
+			'distance_unit' => "mi",
41
+			'device_type' => DeviceType::WEB,
42
+			'travel_mode' => "Driving",
43
+			'advanced_constraints' => []
44
+		]);
45 45
 
46
-        $zones = [["ZONE 01"], ["ZONE 02"], ["ZONE 03"]];
46
+		$zones = [["ZONE 01"], ["ZONE 02"], ["ZONE 03"]];
47 47
 
48
-        for($i = 0; $i < 30; ++$i)
49
-        {
50
-            $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
51
-                'tags' => [$zones[$i % 3]],
52
-                'members_count' => 1,
53
-                'available_time_windows' => [[(8 + 5) * 3600, (11 + 5) * 3600]],
54
-                'location_sequence_pattern' => [Address::fromArray([
55
-                    'address' => "RETAIL LOCATION",
56
-                    'alias' => "RETAIL LOCATION",
57
-                    'lat' => 25.8741751,
58
-                    'lng' => -80.1288583,
59
-                    'time' => 300
60
-                ])]
61
-            ]);
62
-        }
48
+		for($i = 0; $i < 30; ++$i)
49
+		{
50
+			$parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
51
+				'tags' => [$zones[$i % 3]],
52
+				'members_count' => 1,
53
+				'available_time_windows' => [[(8 + 5) * 3600, (11 + 5) * 3600]],
54
+				'location_sequence_pattern' => [Address::fromArray([
55
+					'address' => "RETAIL LOCATION",
56
+					'alias' => "RETAIL LOCATION",
57
+					'lat' => 25.8741751,
58
+					'lng' => -80.1288583,
59
+					'time' => 300
60
+				])]
61
+			]);
62
+		}
63 63
     
64
-        $optimizationParameters = new OptimizationProblemParams();
65
-        $optimizationParameters->setAddresses($addresses);
66
-        $optimizationParameters->setParameters($parameters);
64
+		$optimizationParameters = new OptimizationProblemParams();
65
+		$optimizationParameters->setAddresses($addresses);
66
+		$optimizationParameters->setParameters($parameters);
67 67
 
68
-        self::$problem = OptimizationProblem::optimize($optimizationParameters);
68
+		self::$problem = OptimizationProblem::optimize($optimizationParameters);
69 69
 
70
-        $this->assertNotNull(self::$problem->optimization_problem_id);
71
-        $this->assertEquals(self::$problem->parameters->route_name, 'Drivers Schedules - 3 Territories');
72
-    }
70
+		$this->assertNotNull(self::$problem->optimization_problem_id);
71
+		$this->assertEquals(self::$problem->parameters->route_name, 'Drivers Schedules - 3 Territories');
72
+	}
73 73
 
74
-    public static function tearDownAfterClass()
75
-    {
76
-        if(!is_null(self::$problem->optimization_problem_id))
77
-        {
78
-            $params = [
79
-                'optimization_problem_ids' => ['0' => self::$problem->optimization_problem_id],
80
-                'redirect' => 0,
81
-            ];
74
+	public static function tearDownAfterClass()
75
+	{
76
+		if(!is_null(self::$problem->optimization_problem_id))
77
+		{
78
+			$params = [
79
+				'optimization_problem_ids' => ['0' => self::$problem->optimization_problem_id],
80
+				'redirect' => 0,
81
+			];
82 82
 
83
-            $result = self::$problem->removeOptimization($params);
83
+			$result = self::$problem->removeOptimization($params);
84 84
 
85
-            if ($result != null && $result['status'] == true) {
86
-                echo "The test optimization was removed <br>";
87
-            } else {
88
-                echo "Cannot remove the test optimization <br>";
89
-            }
90
-        }
91
-    }
85
+			if ($result != null && $result['status'] == true) {
86
+				echo "The test optimization was removed <br>";
87
+			} else {
88
+				echo "Cannot remove the test optimization <br>";
89
+			}
90
+		}
91
+	}
92 92
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
         $zones = [["ZONE 01"], ["ZONE 02"], ["ZONE 03"]];
47 47
 
48
-        for($i = 0; $i < 30; ++$i)
48
+        for ($i = 0; $i<30; ++$i)
49 49
         {
50 50
             $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
51 51
                 'tags' => [$zones[$i % 3]],
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
     public static function tearDownAfterClass()
75 75
     {
76
-        if(!is_null(self::$problem->optimization_problem_id))
76
+        if (!is_null(self::$problem->optimization_problem_id))
77 77
         {
78 78
             $params = [
79 79
                 'optimization_problem_ids' => ['0' => self::$problem->optimization_problem_id],
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
             $result = self::$problem->removeOptimization($params);
84 84
 
85
-            if ($result != null && $result['status'] == true) {
85
+            if ($result!=null && $result['status']==true) {
86 86
                 echo "The test optimization was removed <br>";
87 87
             } else {
88 88
                 echo "Cannot remove the test optimization <br>";
Please login to merge, or discard this patch.
UnitTestFiles/Test/OrderTests.php 2 patches
Indentation   +541 added lines, -541 removed lines patch added patch discarded remove patch
@@ -20,545 +20,545 @@
 block discarded – undo
20 20
 
21 21
 class OrderTests extends \PHPUnit\Framework\TestCase
22 22
 {
23
-    public static $createdOrders = [];
24
-    public static $createdProblems = [];
25
-
26
-    public static function setUpBeforeClass()
27
-    {
28
-        Route4Me::setApiKey(Constants::API_KEY);
29
-
30
-        //region -- Create Test Optimization --
31
-
32
-        // Huge list of addresses
33
-        $json = json_decode(file_get_contents(dirname(__FILE__).'/data/addresses.json'), true);
34
-        $json = array_slice($json, 0, 10);
35
-
36
-        $addresses = [];
37
-        foreach ($json as $address) {
38
-            $addresses[] = Address::fromArray($address);
39
-        }
40
-
41
-        $parameters = RouteParameters::fromArray([
42
-            'algorithm_type'    => Algorithmtype::TSP,
43
-            'route_name'        => 'Single Driver Multiple TW 10 Stops '.date('Y-m-d H:i'),
44
-            'route_date'        => time() + 24 * 60 * 60,
45
-            'route_time'        => 5 * 3600 + 30 * 60,
46
-            'distance_unit'     => DistanceUnit::MILES,
47
-            'device_type'       => DeviceType::WEB,
48
-            'optimize'          => OptimizationType::DISTANCE,
49
-            'metric'            => Metric::GEODESIC,
50
-        ]);
51
-
52
-        $optimizationParams = new OptimizationProblemParams();
53
-        $optimizationParams->setAddresses($addresses);
54
-        $optimizationParams->setParameters($parameters);
55
-
56
-        $problem = OptimizationProblem::optimize($optimizationParams);
57
-
58
-        self::$createdProblems[] = $problem;
59
-
60
-        //endregion
61
-
62
-        //region -- Create Test Order --
63
-
64
-        $orderParameters = Order::fromArray([
65
-            'address_1'                 => '1358 E Luzerne St, Philadelphia, PA 19124, US',
66
-            'cached_lat'                => 48.335991,
67
-            'cached_lng'                => 31.18287,
68
-            'address_alias'             => 'Auto test address',
69
-            'address_city'              => 'Philadelphia',
70
-            'day_scheduled_for_YYMMDD'  => date('Y-m-d'),
71
-            'EXT_FIELD_first_name'      => 'Igor',
72
-            'EXT_FIELD_last_name'       => 'Progman',
73
-            'EXT_FIELD_email'           => '[email protected]',
74
-            'EXT_FIELD_phone'           => '380380380380',
75
-            'EXT_FIELD_custom_data'     => [
76
-                0 => [
77
-                    'order_id'  => '10',
78
-                    'name'      => 'Bill Soul',
79
-                ],
80
-            ],
81
-        ]);
82
-
83
-        $order = new Order();
84
-
85
-        $response = $order->addOrder($orderParameters);
86
-
87
-        self::assertNotNull($response);
88
-        self::assertInstanceOf(Order::class, Order::fromArray($response));
89
-
90
-        self::$createdOrders[] = $response;
91
-
92
-        //endregion
93
-    }
94
-
95
-    public function testFromArray()
96
-    {
97
-        $orderParameters = Order::fromArray([
98
-            'address_1'                 => '1358 E Luzerne St, Philadelphia, PA 19124, US',
99
-            'cached_lat'                => 48.335991,
100
-            'cached_lng'                => 31.18287,
101
-            'address_alias'             => 'Auto test address',
102
-            'address_city'              => 'Philadelphia',
103
-            'day_scheduled_for_YYMMDD'  => date('Y-m-d'),
104
-            'EXT_FIELD_first_name'      => 'Igor',
105
-            'EXT_FIELD_last_name'       => 'Progman',
106
-            'EXT_FIELD_email'           => '[email protected]',
107
-            'EXT_FIELD_phone'           => '380380380380',
108
-            'EXT_FIELD_custom_data'     => [
109
-                0 => [
110
-                    'order_id'  => '10',
111
-                    'name'      => 'Bill Soul',
112
-                ],
113
-            ],
114
-        ]);
115
-
116
-        $this->assertEquals('1358 E Luzerne St, Philadelphia, PA 19124, US', $orderParameters->address_1);
117
-        $this->assertEquals(48.335991, $orderParameters->cached_lat);
118
-        $this->assertEquals(31.18287, $orderParameters->cached_lng);
119
-        $this->assertEquals('Auto test address', $orderParameters->address_alias);
120
-        $this->assertEquals('Philadelphia', $orderParameters->address_city);
121
-        $this->assertEquals(date('Y-m-d'), $orderParameters->day_scheduled_for_YYMMDD);
122
-        $this->assertEquals('Igor', $orderParameters->EXT_FIELD_first_name);
123
-        $this->assertEquals('Progman', $orderParameters->EXT_FIELD_last_name);
124
-        $this->assertEquals('[email protected]', $orderParameters->EXT_FIELD_email);
125
-        $this->assertEquals('380380380380', $orderParameters->EXT_FIELD_phone);
126
-        $this->assertEquals([
127
-            0 => [
128
-                'order_id'  => '10',
129
-                'name'      => 'Bill Soul',
130
-            ],
131
-        ], $orderParameters->EXT_FIELD_custom_data);
132
-    }
133
-
134
-    public function testToArray()
135
-    {
136
-        $orderParameters = Order::fromArray([
137
-            'address_1'                 => '1358 E Luzerne St, Philadelphia, PA 19124, US',
138
-            'cached_lat'                => 48.335991,
139
-            'cached_lng'                => 31.18287,
140
-            'address_alias'             => 'Auto test address',
141
-            'address_city'              => 'Philadelphia',
142
-            'day_scheduled_for_YYMMDD'  => date('Y-m-d'),
143
-            'EXT_FIELD_first_name'      => 'Igor',
144
-            'EXT_FIELD_last_name'       => 'Progman',
145
-            'EXT_FIELD_email'           => '[email protected]',
146
-            'EXT_FIELD_phone'           => '380380380380',
147
-            'EXT_FIELD_custom_data'     => [
148
-                0 => [
149
-                    'order_id'  => '10',
150
-                    'name'      => 'Bill Soul',
151
-                ],
152
-            ],
153
-        ]);
154
-
155
-        $this->assertEquals($orderParameters->toArray(),
156
-            [
157
-                'address_1'                 => '1358 E Luzerne St, Philadelphia, PA 19124, US',
158
-                'cached_lat'                => 48.335991,
159
-                'cached_lng'                => 31.18287,
160
-                'address_alias'             => 'Auto test address',
161
-                'address_city'              => 'Philadelphia',
162
-                'day_scheduled_for_YYMMDD'  => date('Y-m-d'),
163
-                'EXT_FIELD_first_name'      => 'Igor',
164
-                'EXT_FIELD_last_name'       => 'Progman',
165
-                'EXT_FIELD_email'           => '[email protected]',
166
-                'EXT_FIELD_phone'           => '380380380380',
167
-                'EXT_FIELD_custom_data'     => [
168
-                    0 => [
169
-                        'order_id'  => '10',
170
-                        'name'      => 'Bill Soul',
171
-                    ],
172
-                ],
173
-            ]
174
-        );
175
-    }
176
-
177
-    public function testGetOrders()
178
-    {
179
-        $order = new Order();
180
-
181
-        $orderParameters = Order::fromArray([
182
-            'offset'    => 0,
183
-            'limit'     => 5,
184
-        ]);
185
-
186
-        $response = $order->getOrders($orderParameters);
187
-
188
-        $this->assertNotNull($response);
189
-        $this->assertTrue(is_array($response));
190
-        $this->assertTrue(isset($response['total']));
191
-        $this->assertTrue(isset($response['results']));
192
-        $this->assertInstanceOf(
193
-            Order::class,
194
-            Order::fromArray($response['results'][0])
195
-        );
196
-    }
197
-
198
-    public function testCreateNewOrder()
199
-    {
200
-        $orderParameters = Order::fromArray([
201
-            'address_1'                 => '106 Liberty St, New York, NY 10006, USA',
202
-            'address_alias'             => 'BK Restaurant #: 2446',
203
-            'cached_lat'                => 40.709637,
204
-            'cached_lng'                => -74.011912,
205
-            'curbside_lat'              => 40.709637,
206
-            'curbside_lng'              => -74.011912,
207
-            'address_city'              => 'New York',
208
-            'EXT_FIELD_first_name'      => 'Lui',
209
-            'EXT_FIELD_last_name'       => 'Carol',
210
-            'EXT_FIELD_email'           => '[email protected]',
211
-            'EXT_FIELD_phone'           => '897946541',
212
-            'local_time_window_end'     => 39000,
213
-            'local_time_window_end_2'   => 46200,
214
-            'local_time_window_start'   => 37800,
215
-            'local_time_window_start_2' => 45000,
216
-            'local_timezone_string'     => 'America/New_York',
217
-            'order_icon'                => 'emoji/emoji-bank',
218
-        ]);
219
-
220
-        $order = new Order();
221
-
222
-        $response = $order->addOrder($orderParameters);
223
-
224
-        self::assertNotNull($response);
225
-        self::assertInstanceOf(Order::class, Order::fromArray($response));
226
-
227
-        self::$createdOrders[] = $response;
228
-    }
229
-
230
-    public function testAddOrdersToOptimization()
231
-    {
232
-        $body = json_decode(file_get_contents(dirname(__FILE__).'/data/add_order_to_optimization_data.json'), true);
233
-
234
-        $optimizationProblemId = self::$createdProblems[0]->optimization_problem_id;
235
-
236
-        $orderParameters = [
237
-            'optimization_problem_id'   => $optimizationProblemId,
238
-            'redirect'                  => 0,
239
-            'device_type'               => 'web',
240
-            'addresses'                 => $body['addresses'],
241
-        ];
242
-
243
-        $order = new Order();
244
-
245
-        $response = $order->addOrder2Optimization($orderParameters);
246
-
247
-        self::assertNotNull($response);
248
-        self::assertInstanceOf(OptimizationProblem::class, OptimizationProblem::fromArray($response));
249
-    }
250
-
251
-    public function testAddOrdersToRoute()
252
-    {
253
-        $body = json_decode(file_get_contents(dirname(__FILE__).'/data/add_order_to_route_data.json'), true);
254
-
255
-        $routeId = self::$createdProblems[0]->routes[0]->route_id;
256
-
257
-        $orderParameters = Order::fromArray([
258
-            'route_id'  => $routeId,
259
-            'redirect'  => 0,
260
-            'addresses' => $body['addresses'],
261
-        ]);
262
-
263
-        $order = new Order();
264
-
265
-        $response = $order->addOrder2Route($orderParameters);
266
-
267
-        self::assertNotNull($response);
268
-        self::assertInstanceOf(Route::class, Route::fromArray($response));
269
-    }
270
-
271
-    public function testAddScheduledOrder()
272
-    {
273
-        $orderParameters = Order::fromArray([
274
-            'address_1'                 => '318 S 39th St, Louisville, KY 40212, USA',
275
-            'cached_lat'                => 38.259326,
276
-            'cached_lng'                => -85.814979,
277
-            'curbside_lat'              => 38.259326,
278
-            'curbside_lng'              => -85.814979,
279
-            'address_alias'             => '318 S 39th St 40212',
280
-            'address_city'              => 'Louisville',
281
-            'EXT_FIELD_first_name'      => 'Lui',
282
-            'EXT_FIELD_last_name'       => 'Carol',
283
-            'EXT_FIELD_email'           => '[email protected]',
284
-            'EXT_FIELD_phone'           => '897946541',
285
-            'EXT_FIELD_custom_data'     => ['order_type' => 'scheduled order'],
286
-            'day_scheduled_for_YYMMDD'  => date('Y-m-d'),
287
-            'local_time_window_end'     => 39000,
288
-            'local_time_window_end_2'   => 46200,
289
-            'local_time_window_start'   => 37800,
290
-            'local_time_window_start_2' => 45000,
291
-            'local_timezone_string'     => 'America/New_York',
292
-            'order_icon'                => 'emoji/emoji-bank',
293
-        ]);
294
-
295
-        $order = new Order();
296
-
297
-        $response = $order->addOrder($orderParameters);
298
-
299
-        self::assertNotNull($response);
300
-        self::assertInstanceOf(Order::class, Order::fromArray($response));
301
-
302
-        self::$createdOrders[] = $response;
303
-    }
304
-
305
-    public function testCreateOrderWithCustomField()
306
-    {
307
-        $orderParameters = Order::fromArray([
308
-            'address_1'                => '1358 E Luzerne St, Philadelphia, PA 19124, US',
309
-            'cached_lat'               => 48.335991,
310
-            'cached_lng'               => 31.18287,
311
-            'day_scheduled_for_YYMMDD' => '2019-10-11',
312
-            'address_alias'            => 'Auto test address',
313
-            'custom_user_fields' => [
314
-                OrderCustomField::fromArray([
315
-                    'order_custom_field_id'    => 93,
316
-                    'order_custom_field_value' => 'false'
317
-                ])
318
-            ]
319
-        ]);
320
-
321
-        $order = new Order();
322
-
323
-        $response = $order->addOrder($orderParameters);
324
-
325
-        self::assertNotNull($response);
326
-        self::assertInstanceOf(Order::class, Order::fromArray($response));
327
-        $this->assertEquals(93,$response['custom_user_fields'][0]['order_custom_field_id']);
328
-        $this->assertEquals(false,$response['custom_user_fields'][0]['order_custom_field_value']);
329
-
330
-        self::$createdOrders[] = $response;
331
-    }
332
-
333
-    public function testGetOrderByID()
334
-    {
335
-        $order = new Order();
336
-
337
-        $orderID = self::$createdOrders[0]['order_id'];
338
-
339
-        // Get an order
340
-        $orderParameters = Order::fromArray([
341
-            'order_id' => $orderID,
342
-        ]);
343
-
344
-        $response = $order->getOrder($orderParameters);
345
-
346
-        self::assertNotNull($response);
347
-        self::assertInstanceOf(Order::class, Order::fromArray($response));
348
-    }
349
-
350
-    public function testGetOrderByInsertedDate()
351
-    {
352
-        $orderParameters = Order::fromArray([
353
-            'day_added_YYMMDD'  => date('Y-m-d', strtotime('0 days')),
354
-            'offset'            => 0,
355
-            'limit'             => 5,
356
-        ]);
357
-
358
-        $order = new Order();
359
-
360
-        $response = $order->getOrder($orderParameters);
361
-
362
-        $this->assertNotNull($response);
363
-        $this->assertTrue(is_array($response));
364
-        $this->assertTrue(isset($response['total']));
365
-        $this->assertTrue(isset($response['results']));
366
-        $this->assertInstanceOf(
367
-            Order::class,
368
-            Order::fromArray($response['results'][0])
369
-        );
370
-    }
371
-
372
-    public function testGetOrderByScheduledDate()
373
-    {
374
-        $orderParameters = Order::fromArray([
375
-            'day_scheduled_for_YYMMDD'  => date('Y-m-d', strtotime('0 days')),
376
-            'offset'                    => 0,
377
-            'limit'                     => 5,
378
-        ]);
379
-
380
-        $order = new Order();
381
-
382
-        $response = $order->getOrder($orderParameters);
383
-
384
-        $this->assertNotNull($response);
385
-        $this->assertTrue(is_array($response));
386
-        $this->assertTrue(isset($response['total']));
387
-        $this->assertTrue(isset($response['results']));
388
-        $this->assertInstanceOf(
389
-            Order::class,
390
-            Order::fromArray($response['results'][0])
391
-        );
392
-    }
393
-
394
-    public function testGetOrdersByCustomFields()
395
-    {
396
-        $orderParameters = Order::fromArray([
397
-            'fields'    => 'order_id,member_id',
398
-            'offset'    => 0,
399
-            'limit'     => 5,
400
-        ]);
401
-
402
-        $order = new Order();
403
-
404
-        $response = $order->getOrder($orderParameters);
405
-
406
-        $response = $order->getOrder($orderParameters);
407
-
408
-        $this->assertNotNull($response);
409
-        $this->assertTrue(is_array($response));
410
-        $this->assertTrue(isset($response['total']));
411
-        $this->assertTrue(isset($response['results']));
412
-        $this->assertTrue(isset($response['fields']));
413
-        $this->assertInstanceOf(
414
-            Order::class,
415
-            Order::fromArray($response['results'][0])
416
-        );
417
-    }
418
-
419
-    public function testGetOrdersByScheduleFilter()
420
-    {
421
-        $orderParameters = Order::fromArray([
422
-            'limit'  => 5,
423
-            'filter' => [
424
-                'display'               => 'all',
425
-                'scheduled_for_YYMMDD'  => [
426
-                    date('Y-m-d', strtotime('-1 days')),
427
-                    date('Y-m-d', strtotime('1 days'))
428
-                ]
429
-            ]
430
-        ]);
431
-
432
-        $order = new Order();
433
-
434
-        $response = $order->getOrder($orderParameters);
435
-
436
-        $this->assertNotNull($response);
437
-        $this->assertTrue(is_array($response));
438
-        $this->assertTrue(isset($response['total']));
439
-        $this->assertTrue(isset($response['results']));
440
-        $this->assertInstanceOf(
441
-            Order::class,
442
-            Order::fromArray($response['results'][0])
443
-        );
444
-    }
445
-
446
-    public function testGetOrdersBySpecifiedText()
447
-    {
448
-        $orderParameters = Order::fromArray([
449
-            'query'     => 'Auto test',
450
-            'offset'    => 0,
451
-            'limit'     => 5,
452
-        ]);
453
-
454
-        $order = new Order();
455
-
456
-        $response = $order->getOrder($orderParameters);
457
-
458
-        $this->assertNotNull($response);
459
-        $this->assertTrue(is_array($response));
460
-        $this->assertTrue(isset($response['total']));
461
-        $this->assertTrue(isset($response['results']));
462
-        $this->assertInstanceOf(
463
-            Order::class,
464
-            Order::fromArray($response['results'][0])
465
-        );
466
-    }
467
-
468
-    public function testUpdateOrder()
469
-    {
470
-        $order = new Order();
471
-
472
-        // Update the order
473
-        self::$createdOrders[0]['address_2'] = 'Lviv';
474
-        self::$createdOrders[0]['EXT_FIELD_phone'] = '032268593';
475
-        self::$createdOrders[0]['EXT_FIELD_custom_data'] = [
476
-            0 => [
477
-                'customer_no' => '11',
478
-            ],
479
-        ];
480
-
481
-        $response = $order->updateOrder(self::$createdOrders[0]);
482
-
483
-        $this->assertNotNull($response);
484
-        $this->assertInstanceOf(Order::class, Order::fromArray($response));
485
-        $this->assertEquals('Lviv', $response['address_2']);
486
-        $this->assertEquals('032268593', $response['EXT_FIELD_phone']);
487
-        $this->assertEquals([
488
-                0 => '{"order_id":"10","name":"Bill Soul"}'
489
-            ],
490
-            $response['EXT_FIELD_custom_data']
491
-        );
492
-    }
493
-
494
-    public function testUpdateOrderWithCustomFiel()
495
-    {
496
-        $orderParameters = Order::fromArray([
497
-            'order_id'              => self::$createdOrders[0]['order_id'],
498
-            'custom_user_fields'    => [
499
-                OrderCustomField::fromArray([
500
-                    'order_custom_field_id'    => 93,
501
-                    'order_custom_field_value' => 'true'
502
-                ])
503
-            ]
504
-        ]);
505
-
506
-        $order = new Order();
507
-
508
-        $response = $order->updateOrder($orderParameters);
509
-
510
-        $this->assertNotNull($response);
511
-        $this->assertInstanceOf(Order::class, Order::fromArray($response));
512
-        $this->assertEquals(93, $response['custom_user_fields'][0]['order_custom_field_id']);
513
-        $this->assertEquals(true, $response['custom_user_fields'][0]['order_custom_field_value']);
514
-    }
515
-
516
-    public static function tearDownAfterClass()
517
-    {
518
-        if (sizeof(self::$createdOrders)) {
519
-            $orderIDs = [];
520
-
521
-            foreach (self::$createdOrders as $ord) {
522
-                $orderIDs[] = $ord['order_id'];
523
-            }
524
-
525
-            $orderParameters = Order::fromArray([
526
-                'order_ids' => $orderIDs
527
-            ]);
528
-
529
-            $order = new Order();
530
-
531
-            $response = $order->removeOrder($orderParameters);
532
-
533
-            if (!is_null($response) &&
534
-                isset($response['status']) &&
535
-                $response['status']) {
536
-                echo "The test orders removed <br>";
537
-            }
538
-        }
539
-
540
-        if (sizeof(self::$createdProblems)>0) {
541
-            $optimizationProblemIDs = [];
542
-
543
-            foreach (self::$createdProblems as $problem) {
544
-                $optimizationProblemId = $problem->optimization_problem_id;
545
-
546
-                $optimizationProblemIDs[] = $optimizationProblemId;
547
-            }
548
-
549
-            $params = [
550
-                'optimization_problem_ids' => $optimizationProblemIDs,
551
-                'redirect'                 => 0,
552
-            ];
553
-
554
-            $problem = new OptimizationProblem();
555
-            $result = $problem->removeOptimization($params);
556
-
557
-            if ($result!=null && $result['status']==true) {
558
-                echo "The test optimizations were removed <br>";
559
-            } else {
560
-                echo "Cannot remove the test optimizations <br>";
561
-            }
562
-        }
563
-    }
23
+	public static $createdOrders = [];
24
+	public static $createdProblems = [];
25
+
26
+	public static function setUpBeforeClass()
27
+	{
28
+		Route4Me::setApiKey(Constants::API_KEY);
29
+
30
+		//region -- Create Test Optimization --
31
+
32
+		// Huge list of addresses
33
+		$json = json_decode(file_get_contents(dirname(__FILE__).'/data/addresses.json'), true);
34
+		$json = array_slice($json, 0, 10);
35
+
36
+		$addresses = [];
37
+		foreach ($json as $address) {
38
+			$addresses[] = Address::fromArray($address);
39
+		}
40
+
41
+		$parameters = RouteParameters::fromArray([
42
+			'algorithm_type'    => Algorithmtype::TSP,
43
+			'route_name'        => 'Single Driver Multiple TW 10 Stops '.date('Y-m-d H:i'),
44
+			'route_date'        => time() + 24 * 60 * 60,
45
+			'route_time'        => 5 * 3600 + 30 * 60,
46
+			'distance_unit'     => DistanceUnit::MILES,
47
+			'device_type'       => DeviceType::WEB,
48
+			'optimize'          => OptimizationType::DISTANCE,
49
+			'metric'            => Metric::GEODESIC,
50
+		]);
51
+
52
+		$optimizationParams = new OptimizationProblemParams();
53
+		$optimizationParams->setAddresses($addresses);
54
+		$optimizationParams->setParameters($parameters);
55
+
56
+		$problem = OptimizationProblem::optimize($optimizationParams);
57
+
58
+		self::$createdProblems[] = $problem;
59
+
60
+		//endregion
61
+
62
+		//region -- Create Test Order --
63
+
64
+		$orderParameters = Order::fromArray([
65
+			'address_1'                 => '1358 E Luzerne St, Philadelphia, PA 19124, US',
66
+			'cached_lat'                => 48.335991,
67
+			'cached_lng'                => 31.18287,
68
+			'address_alias'             => 'Auto test address',
69
+			'address_city'              => 'Philadelphia',
70
+			'day_scheduled_for_YYMMDD'  => date('Y-m-d'),
71
+			'EXT_FIELD_first_name'      => 'Igor',
72
+			'EXT_FIELD_last_name'       => 'Progman',
73
+			'EXT_FIELD_email'           => '[email protected]',
74
+			'EXT_FIELD_phone'           => '380380380380',
75
+			'EXT_FIELD_custom_data'     => [
76
+				0 => [
77
+					'order_id'  => '10',
78
+					'name'      => 'Bill Soul',
79
+				],
80
+			],
81
+		]);
82
+
83
+		$order = new Order();
84
+
85
+		$response = $order->addOrder($orderParameters);
86
+
87
+		self::assertNotNull($response);
88
+		self::assertInstanceOf(Order::class, Order::fromArray($response));
89
+
90
+		self::$createdOrders[] = $response;
91
+
92
+		//endregion
93
+	}
94
+
95
+	public function testFromArray()
96
+	{
97
+		$orderParameters = Order::fromArray([
98
+			'address_1'                 => '1358 E Luzerne St, Philadelphia, PA 19124, US',
99
+			'cached_lat'                => 48.335991,
100
+			'cached_lng'                => 31.18287,
101
+			'address_alias'             => 'Auto test address',
102
+			'address_city'              => 'Philadelphia',
103
+			'day_scheduled_for_YYMMDD'  => date('Y-m-d'),
104
+			'EXT_FIELD_first_name'      => 'Igor',
105
+			'EXT_FIELD_last_name'       => 'Progman',
106
+			'EXT_FIELD_email'           => '[email protected]',
107
+			'EXT_FIELD_phone'           => '380380380380',
108
+			'EXT_FIELD_custom_data'     => [
109
+				0 => [
110
+					'order_id'  => '10',
111
+					'name'      => 'Bill Soul',
112
+				],
113
+			],
114
+		]);
115
+
116
+		$this->assertEquals('1358 E Luzerne St, Philadelphia, PA 19124, US', $orderParameters->address_1);
117
+		$this->assertEquals(48.335991, $orderParameters->cached_lat);
118
+		$this->assertEquals(31.18287, $orderParameters->cached_lng);
119
+		$this->assertEquals('Auto test address', $orderParameters->address_alias);
120
+		$this->assertEquals('Philadelphia', $orderParameters->address_city);
121
+		$this->assertEquals(date('Y-m-d'), $orderParameters->day_scheduled_for_YYMMDD);
122
+		$this->assertEquals('Igor', $orderParameters->EXT_FIELD_first_name);
123
+		$this->assertEquals('Progman', $orderParameters->EXT_FIELD_last_name);
124
+		$this->assertEquals('[email protected]', $orderParameters->EXT_FIELD_email);
125
+		$this->assertEquals('380380380380', $orderParameters->EXT_FIELD_phone);
126
+		$this->assertEquals([
127
+			0 => [
128
+				'order_id'  => '10',
129
+				'name'      => 'Bill Soul',
130
+			],
131
+		], $orderParameters->EXT_FIELD_custom_data);
132
+	}
133
+
134
+	public function testToArray()
135
+	{
136
+		$orderParameters = Order::fromArray([
137
+			'address_1'                 => '1358 E Luzerne St, Philadelphia, PA 19124, US',
138
+			'cached_lat'                => 48.335991,
139
+			'cached_lng'                => 31.18287,
140
+			'address_alias'             => 'Auto test address',
141
+			'address_city'              => 'Philadelphia',
142
+			'day_scheduled_for_YYMMDD'  => date('Y-m-d'),
143
+			'EXT_FIELD_first_name'      => 'Igor',
144
+			'EXT_FIELD_last_name'       => 'Progman',
145
+			'EXT_FIELD_email'           => '[email protected]',
146
+			'EXT_FIELD_phone'           => '380380380380',
147
+			'EXT_FIELD_custom_data'     => [
148
+				0 => [
149
+					'order_id'  => '10',
150
+					'name'      => 'Bill Soul',
151
+				],
152
+			],
153
+		]);
154
+
155
+		$this->assertEquals($orderParameters->toArray(),
156
+			[
157
+				'address_1'                 => '1358 E Luzerne St, Philadelphia, PA 19124, US',
158
+				'cached_lat'                => 48.335991,
159
+				'cached_lng'                => 31.18287,
160
+				'address_alias'             => 'Auto test address',
161
+				'address_city'              => 'Philadelphia',
162
+				'day_scheduled_for_YYMMDD'  => date('Y-m-d'),
163
+				'EXT_FIELD_first_name'      => 'Igor',
164
+				'EXT_FIELD_last_name'       => 'Progman',
165
+				'EXT_FIELD_email'           => '[email protected]',
166
+				'EXT_FIELD_phone'           => '380380380380',
167
+				'EXT_FIELD_custom_data'     => [
168
+					0 => [
169
+						'order_id'  => '10',
170
+						'name'      => 'Bill Soul',
171
+					],
172
+				],
173
+			]
174
+		);
175
+	}
176
+
177
+	public function testGetOrders()
178
+	{
179
+		$order = new Order();
180
+
181
+		$orderParameters = Order::fromArray([
182
+			'offset'    => 0,
183
+			'limit'     => 5,
184
+		]);
185
+
186
+		$response = $order->getOrders($orderParameters);
187
+
188
+		$this->assertNotNull($response);
189
+		$this->assertTrue(is_array($response));
190
+		$this->assertTrue(isset($response['total']));
191
+		$this->assertTrue(isset($response['results']));
192
+		$this->assertInstanceOf(
193
+			Order::class,
194
+			Order::fromArray($response['results'][0])
195
+		);
196
+	}
197
+
198
+	public function testCreateNewOrder()
199
+	{
200
+		$orderParameters = Order::fromArray([
201
+			'address_1'                 => '106 Liberty St, New York, NY 10006, USA',
202
+			'address_alias'             => 'BK Restaurant #: 2446',
203
+			'cached_lat'                => 40.709637,
204
+			'cached_lng'                => -74.011912,
205
+			'curbside_lat'              => 40.709637,
206
+			'curbside_lng'              => -74.011912,
207
+			'address_city'              => 'New York',
208
+			'EXT_FIELD_first_name'      => 'Lui',
209
+			'EXT_FIELD_last_name'       => 'Carol',
210
+			'EXT_FIELD_email'           => '[email protected]',
211
+			'EXT_FIELD_phone'           => '897946541',
212
+			'local_time_window_end'     => 39000,
213
+			'local_time_window_end_2'   => 46200,
214
+			'local_time_window_start'   => 37800,
215
+			'local_time_window_start_2' => 45000,
216
+			'local_timezone_string'     => 'America/New_York',
217
+			'order_icon'                => 'emoji/emoji-bank',
218
+		]);
219
+
220
+		$order = new Order();
221
+
222
+		$response = $order->addOrder($orderParameters);
223
+
224
+		self::assertNotNull($response);
225
+		self::assertInstanceOf(Order::class, Order::fromArray($response));
226
+
227
+		self::$createdOrders[] = $response;
228
+	}
229
+
230
+	public function testAddOrdersToOptimization()
231
+	{
232
+		$body = json_decode(file_get_contents(dirname(__FILE__).'/data/add_order_to_optimization_data.json'), true);
233
+
234
+		$optimizationProblemId = self::$createdProblems[0]->optimization_problem_id;
235
+
236
+		$orderParameters = [
237
+			'optimization_problem_id'   => $optimizationProblemId,
238
+			'redirect'                  => 0,
239
+			'device_type'               => 'web',
240
+			'addresses'                 => $body['addresses'],
241
+		];
242
+
243
+		$order = new Order();
244
+
245
+		$response = $order->addOrder2Optimization($orderParameters);
246
+
247
+		self::assertNotNull($response);
248
+		self::assertInstanceOf(OptimizationProblem::class, OptimizationProblem::fromArray($response));
249
+	}
250
+
251
+	public function testAddOrdersToRoute()
252
+	{
253
+		$body = json_decode(file_get_contents(dirname(__FILE__).'/data/add_order_to_route_data.json'), true);
254
+
255
+		$routeId = self::$createdProblems[0]->routes[0]->route_id;
256
+
257
+		$orderParameters = Order::fromArray([
258
+			'route_id'  => $routeId,
259
+			'redirect'  => 0,
260
+			'addresses' => $body['addresses'],
261
+		]);
262
+
263
+		$order = new Order();
264
+
265
+		$response = $order->addOrder2Route($orderParameters);
266
+
267
+		self::assertNotNull($response);
268
+		self::assertInstanceOf(Route::class, Route::fromArray($response));
269
+	}
270
+
271
+	public function testAddScheduledOrder()
272
+	{
273
+		$orderParameters = Order::fromArray([
274
+			'address_1'                 => '318 S 39th St, Louisville, KY 40212, USA',
275
+			'cached_lat'                => 38.259326,
276
+			'cached_lng'                => -85.814979,
277
+			'curbside_lat'              => 38.259326,
278
+			'curbside_lng'              => -85.814979,
279
+			'address_alias'             => '318 S 39th St 40212',
280
+			'address_city'              => 'Louisville',
281
+			'EXT_FIELD_first_name'      => 'Lui',
282
+			'EXT_FIELD_last_name'       => 'Carol',
283
+			'EXT_FIELD_email'           => '[email protected]',
284
+			'EXT_FIELD_phone'           => '897946541',
285
+			'EXT_FIELD_custom_data'     => ['order_type' => 'scheduled order'],
286
+			'day_scheduled_for_YYMMDD'  => date('Y-m-d'),
287
+			'local_time_window_end'     => 39000,
288
+			'local_time_window_end_2'   => 46200,
289
+			'local_time_window_start'   => 37800,
290
+			'local_time_window_start_2' => 45000,
291
+			'local_timezone_string'     => 'America/New_York',
292
+			'order_icon'                => 'emoji/emoji-bank',
293
+		]);
294
+
295
+		$order = new Order();
296
+
297
+		$response = $order->addOrder($orderParameters);
298
+
299
+		self::assertNotNull($response);
300
+		self::assertInstanceOf(Order::class, Order::fromArray($response));
301
+
302
+		self::$createdOrders[] = $response;
303
+	}
304
+
305
+	public function testCreateOrderWithCustomField()
306
+	{
307
+		$orderParameters = Order::fromArray([
308
+			'address_1'                => '1358 E Luzerne St, Philadelphia, PA 19124, US',
309
+			'cached_lat'               => 48.335991,
310
+			'cached_lng'               => 31.18287,
311
+			'day_scheduled_for_YYMMDD' => '2019-10-11',
312
+			'address_alias'            => 'Auto test address',
313
+			'custom_user_fields' => [
314
+				OrderCustomField::fromArray([
315
+					'order_custom_field_id'    => 93,
316
+					'order_custom_field_value' => 'false'
317
+				])
318
+			]
319
+		]);
320
+
321
+		$order = new Order();
322
+
323
+		$response = $order->addOrder($orderParameters);
324
+
325
+		self::assertNotNull($response);
326
+		self::assertInstanceOf(Order::class, Order::fromArray($response));
327
+		$this->assertEquals(93,$response['custom_user_fields'][0]['order_custom_field_id']);
328
+		$this->assertEquals(false,$response['custom_user_fields'][0]['order_custom_field_value']);
329
+
330
+		self::$createdOrders[] = $response;
331
+	}
332
+
333
+	public function testGetOrderByID()
334
+	{
335
+		$order = new Order();
336
+
337
+		$orderID = self::$createdOrders[0]['order_id'];
338
+
339
+		// Get an order
340
+		$orderParameters = Order::fromArray([
341
+			'order_id' => $orderID,
342
+		]);
343
+
344
+		$response = $order->getOrder($orderParameters);
345
+
346
+		self::assertNotNull($response);
347
+		self::assertInstanceOf(Order::class, Order::fromArray($response));
348
+	}
349
+
350
+	public function testGetOrderByInsertedDate()
351
+	{
352
+		$orderParameters = Order::fromArray([
353
+			'day_added_YYMMDD'  => date('Y-m-d', strtotime('0 days')),
354
+			'offset'            => 0,
355
+			'limit'             => 5,
356
+		]);
357
+
358
+		$order = new Order();
359
+
360
+		$response = $order->getOrder($orderParameters);
361
+
362
+		$this->assertNotNull($response);
363
+		$this->assertTrue(is_array($response));
364
+		$this->assertTrue(isset($response['total']));
365
+		$this->assertTrue(isset($response['results']));
366
+		$this->assertInstanceOf(
367
+			Order::class,
368
+			Order::fromArray($response['results'][0])
369
+		);
370
+	}
371
+
372
+	public function testGetOrderByScheduledDate()
373
+	{
374
+		$orderParameters = Order::fromArray([
375
+			'day_scheduled_for_YYMMDD'  => date('Y-m-d', strtotime('0 days')),
376
+			'offset'                    => 0,
377
+			'limit'                     => 5,
378
+		]);
379
+
380
+		$order = new Order();
381
+
382
+		$response = $order->getOrder($orderParameters);
383
+
384
+		$this->assertNotNull($response);
385
+		$this->assertTrue(is_array($response));
386
+		$this->assertTrue(isset($response['total']));
387
+		$this->assertTrue(isset($response['results']));
388
+		$this->assertInstanceOf(
389
+			Order::class,
390
+			Order::fromArray($response['results'][0])
391
+		);
392
+	}
393
+
394
+	public function testGetOrdersByCustomFields()
395
+	{
396
+		$orderParameters = Order::fromArray([
397
+			'fields'    => 'order_id,member_id',
398
+			'offset'    => 0,
399
+			'limit'     => 5,
400
+		]);
401
+
402
+		$order = new Order();
403
+
404
+		$response = $order->getOrder($orderParameters);
405
+
406
+		$response = $order->getOrder($orderParameters);
407
+
408
+		$this->assertNotNull($response);
409
+		$this->assertTrue(is_array($response));
410
+		$this->assertTrue(isset($response['total']));
411
+		$this->assertTrue(isset($response['results']));
412
+		$this->assertTrue(isset($response['fields']));
413
+		$this->assertInstanceOf(
414
+			Order::class,
415
+			Order::fromArray($response['results'][0])
416
+		);
417
+	}
418
+
419
+	public function testGetOrdersByScheduleFilter()
420
+	{
421
+		$orderParameters = Order::fromArray([
422
+			'limit'  => 5,
423
+			'filter' => [
424
+				'display'               => 'all',
425
+				'scheduled_for_YYMMDD'  => [
426
+					date('Y-m-d', strtotime('-1 days')),
427
+					date('Y-m-d', strtotime('1 days'))
428
+				]
429
+			]
430
+		]);
431
+
432
+		$order = new Order();
433
+
434
+		$response = $order->getOrder($orderParameters);
435
+
436
+		$this->assertNotNull($response);
437
+		$this->assertTrue(is_array($response));
438
+		$this->assertTrue(isset($response['total']));
439
+		$this->assertTrue(isset($response['results']));
440
+		$this->assertInstanceOf(
441
+			Order::class,
442
+			Order::fromArray($response['results'][0])
443
+		);
444
+	}
445
+
446
+	public function testGetOrdersBySpecifiedText()
447
+	{
448
+		$orderParameters = Order::fromArray([
449
+			'query'     => 'Auto test',
450
+			'offset'    => 0,
451
+			'limit'     => 5,
452
+		]);
453
+
454
+		$order = new Order();
455
+
456
+		$response = $order->getOrder($orderParameters);
457
+
458
+		$this->assertNotNull($response);
459
+		$this->assertTrue(is_array($response));
460
+		$this->assertTrue(isset($response['total']));
461
+		$this->assertTrue(isset($response['results']));
462
+		$this->assertInstanceOf(
463
+			Order::class,
464
+			Order::fromArray($response['results'][0])
465
+		);
466
+	}
467
+
468
+	public function testUpdateOrder()
469
+	{
470
+		$order = new Order();
471
+
472
+		// Update the order
473
+		self::$createdOrders[0]['address_2'] = 'Lviv';
474
+		self::$createdOrders[0]['EXT_FIELD_phone'] = '032268593';
475
+		self::$createdOrders[0]['EXT_FIELD_custom_data'] = [
476
+			0 => [
477
+				'customer_no' => '11',
478
+			],
479
+		];
480
+
481
+		$response = $order->updateOrder(self::$createdOrders[0]);
482
+
483
+		$this->assertNotNull($response);
484
+		$this->assertInstanceOf(Order::class, Order::fromArray($response));
485
+		$this->assertEquals('Lviv', $response['address_2']);
486
+		$this->assertEquals('032268593', $response['EXT_FIELD_phone']);
487
+		$this->assertEquals([
488
+				0 => '{"order_id":"10","name":"Bill Soul"}'
489
+			],
490
+			$response['EXT_FIELD_custom_data']
491
+		);
492
+	}
493
+
494
+	public function testUpdateOrderWithCustomFiel()
495
+	{
496
+		$orderParameters = Order::fromArray([
497
+			'order_id'              => self::$createdOrders[0]['order_id'],
498
+			'custom_user_fields'    => [
499
+				OrderCustomField::fromArray([
500
+					'order_custom_field_id'    => 93,
501
+					'order_custom_field_value' => 'true'
502
+				])
503
+			]
504
+		]);
505
+
506
+		$order = new Order();
507
+
508
+		$response = $order->updateOrder($orderParameters);
509
+
510
+		$this->assertNotNull($response);
511
+		$this->assertInstanceOf(Order::class, Order::fromArray($response));
512
+		$this->assertEquals(93, $response['custom_user_fields'][0]['order_custom_field_id']);
513
+		$this->assertEquals(true, $response['custom_user_fields'][0]['order_custom_field_value']);
514
+	}
515
+
516
+	public static function tearDownAfterClass()
517
+	{
518
+		if (sizeof(self::$createdOrders)) {
519
+			$orderIDs = [];
520
+
521
+			foreach (self::$createdOrders as $ord) {
522
+				$orderIDs[] = $ord['order_id'];
523
+			}
524
+
525
+			$orderParameters = Order::fromArray([
526
+				'order_ids' => $orderIDs
527
+			]);
528
+
529
+			$order = new Order();
530
+
531
+			$response = $order->removeOrder($orderParameters);
532
+
533
+			if (!is_null($response) &&
534
+				isset($response['status']) &&
535
+				$response['status']) {
536
+				echo "The test orders removed <br>";
537
+			}
538
+		}
539
+
540
+		if (sizeof(self::$createdProblems)>0) {
541
+			$optimizationProblemIDs = [];
542
+
543
+			foreach (self::$createdProblems as $problem) {
544
+				$optimizationProblemId = $problem->optimization_problem_id;
545
+
546
+				$optimizationProblemIDs[] = $optimizationProblemId;
547
+			}
548
+
549
+			$params = [
550
+				'optimization_problem_ids' => $optimizationProblemIDs,
551
+				'redirect'                 => 0,
552
+			];
553
+
554
+			$problem = new OptimizationProblem();
555
+			$result = $problem->removeOptimization($params);
556
+
557
+			if ($result!=null && $result['status']==true) {
558
+				echo "The test optimizations were removed <br>";
559
+			} else {
560
+				echo "Cannot remove the test optimizations <br>";
561
+			}
562
+		}
563
+	}
564 564
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -324,8 +324,8 @@
 block discarded – undo
324 324
 
325 325
         self::assertNotNull($response);
326 326
         self::assertInstanceOf(Order::class, Order::fromArray($response));
327
-        $this->assertEquals(93,$response['custom_user_fields'][0]['order_custom_field_id']);
328
-        $this->assertEquals(false,$response['custom_user_fields'][0]['order_custom_field_value']);
327
+        $this->assertEquals(93, $response['custom_user_fields'][0]['order_custom_field_id']);
328
+        $this->assertEquals(false, $response['custom_user_fields'][0]['order_custom_field_value']);
329 329
 
330 330
         self::$createdOrders[] = $response;
331 331
     }
Please login to merge, or discard this patch.
examples/AdvancedConstraints/DriversScheduleswithTerritoriesV4.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
 //**********************************************************************
28 28
 // General Route Parameters
29 29
 $parameters = RouteParameters::fromArray([
30
-    'rt' => true,
31
-    'algorithm_type' => Algorithmtype::ADVANCED_CVRP_TW,
32
-    'route_name' => 'Drivers Schedules - 3 Territories '.date('Y-m-d H:i:s', time()),
33
-    'distance_unit' => DistanceUnit::MILES,
34
-    'device_type' => DeviceType::WEB,
35
-    'optimize' => OptimizationType::DISTANCE,
36
-    'travel_mode' => TravelMode::DRIVING,
37
-    'parts' => 10,
38
-    'advanced_constraints' => []
30
+	'rt' => true,
31
+	'algorithm_type' => Algorithmtype::ADVANCED_CVRP_TW,
32
+	'route_name' => 'Drivers Schedules - 3 Territories '.date('Y-m-d H:i:s', time()),
33
+	'distance_unit' => DistanceUnit::MILES,
34
+	'device_type' => DeviceType::WEB,
35
+	'optimize' => OptimizationType::DISTANCE,
36
+	'travel_mode' => TravelMode::DRIVING,
37
+	'parts' => 10,
38
+	'advanced_constraints' => []
39 39
 ]);
40 40
 
41 41
 //**********************************************************************
@@ -48,27 +48,27 @@  discard block
 block discarded – undo
48 48
 // Time Window Start:  8:00 am EST
49 49
 // Time Window End:   11:00 am EST
50 50
 $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
51
-    'tags' => $zones[0],
52
-    '$members_count' => 3,
53
-    'available_time_windows' => [[(8 + 5) * 3600 , (11 + 5) * 3600]]
51
+	'tags' => $zones[0],
52
+	'$members_count' => 3,
53
+	'available_time_windows' => [[(8 + 5) * 3600 , (11 + 5) * 3600]]
54 54
 ]);
55 55
 
56 56
 // Schedule 2
57 57
 // Time Window Start:  8:00 am EST
58 58
 // Time Window End:   12:00 pm EST
59 59
 $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
60
-    'tags' => $zones[1],
61
-    '$members_count' => 3,
62
-    'available_time_windows' => [[(8 + 5) * 3600 , (12 + 5) * 3600]]
60
+	'tags' => $zones[1],
61
+	'$members_count' => 3,
62
+	'available_time_windows' => [[(8 + 5) * 3600 , (12 + 5) * 3600]]
63 63
 ]);
64 64
 
65 65
 // Schedule 3
66 66
 // Time Window Start:  8:00 am EST
67 67
 // Time Window End:   01:00 pm EST
68 68
 $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
69
-    'tags' => $zones[2],
70
-    '$members_count' => 3,
71
-    'available_time_windows' => [[(8 + 5) * 3600 , (13 + 5) * 3600]]
69
+	'tags' => $zones[2],
70
+	'$members_count' => 3,
71
+	'available_time_windows' => [[(8 + 5) * 3600 , (13 + 5) * 3600]]
72 72
 ]);
73 73
 
74 74
 //**********************************************************************
@@ -77,23 +77,23 @@  discard block
 block discarded – undo
77 77
 
78 78
 // Depot
79 79
 $addresses[] = Address::fromArray([
80
-    'address' => 'DEPOT',
81
-    'is_depot' => true,
82
-    'lat' => 25.694341,
83
-    'lng' => -80.166036,
84
-    'time' => 0
80
+	'address' => 'DEPOT',
81
+	'is_depot' => true,
82
+	'lat' => 25.694341,
83
+	'lng' => -80.166036,
84
+	'time' => 0
85 85
 ]);
86 86
 
87 87
 // Stops
88 88
 foreach ($json as $address) {
89
-    $addresses[] = Address::fromArray([
90
-        'address' => $address['address'],
91
-        'is_depot' => false,
92
-        'lat' => $address['lat'],
93
-        'lng' => $address['lng'],
94
-        'time' => 300,
95
-        'tags' => $address['tags']
96
-    ]);
89
+	$addresses[] = Address::fromArray([
90
+		'address' => $address['address'],
91
+		'is_depot' => false,
92
+		'lat' => $address['lat'],
93
+		'lng' => $address['lng'],
94
+		'time' => 300,
95
+		'tags' => $address['tags']
96
+	]);
97 97
 }
98 98
 
99 99
 $optimizationParams = new OptimizationProblemParams();
@@ -108,6 +108,6 @@  discard block
 block discarded – undo
108 108
 echo "Routes:" . PHP_EOL;
109 109
 foreach($problem->routes as $route)
110 110
 {
111
-    echo "\tID: " . $route->route_id . PHP_EOL;
112
-    echo "\tDistance: " . $route->trip_distance . PHP_EOL;
111
+	echo "\tID: " . $route->route_id . PHP_EOL;
112
+	echo "\tDistance: " . $route->trip_distance . PHP_EOL;
113 113
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
51 51
     'tags' => $zones[0],
52 52
     '$members_count' => 3,
53
-    'available_time_windows' => [[(8 + 5) * 3600 , (11 + 5) * 3600]]
53
+    'available_time_windows' => [[(8 + 5) * 3600, (11 + 5) * 3600]]
54 54
 ]);
55 55
 
56 56
 // Schedule 2
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
60 60
     'tags' => $zones[1],
61 61
     '$members_count' => 3,
62
-    'available_time_windows' => [[(8 + 5) * 3600 , (12 + 5) * 3600]]
62
+    'available_time_windows' => [[(8 + 5) * 3600, (12 + 5) * 3600]]
63 63
 ]);
64 64
 
65 65
 // Schedule 3
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
69 69
     'tags' => $zones[2],
70 70
     '$members_count' => 3,
71
-    'available_time_windows' => [[(8 + 5) * 3600 , (13 + 5) * 3600]]
71
+    'available_time_windows' => [[(8 + 5) * 3600, (13 + 5) * 3600]]
72 72
 ]);
73 73
 
74 74
 //**********************************************************************
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
 
103 103
 $problem = OptimizationProblem::optimize($optimizationParams);
104 104
 
105
-echo "Optimization Problem ID: " . $problem->optimization_problem_id . PHP_EOL;
106
-echo "State: " . OptimizationStates::getName($problem->state) . " (" . $problem->state . ")" . PHP_EOL;
105
+echo "Optimization Problem ID: ".$problem->optimization_problem_id.PHP_EOL;
106
+echo "State: ".OptimizationStates::getName($problem->state)." (".$problem->state.")".PHP_EOL;
107 107
 
108
-echo "Routes:" . PHP_EOL;
109
-foreach($problem->routes as $route)
108
+echo "Routes:".PHP_EOL;
109
+foreach ($problem->routes as $route)
110 110
 {
111
-    echo "\tID: " . $route->route_id . PHP_EOL;
112
-    echo "\tDistance: " . $route->trip_distance . PHP_EOL;
111
+    echo "\tID: ".$route->route_id.PHP_EOL;
112
+    echo "\tDistance: ".$route->trip_distance.PHP_EOL;
113 113
 }
Please login to merge, or discard this patch.
examples/AdvancedConstraints/TagsDifferentTimeWindowsFleets.php 3 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -23,18 +23,18 @@  discard block
 block discarded – undo
23 23
 //**********************************************************************
24 24
 // General Route Parameters
25 25
 $parameters = RouteParameters::fromArray([
26
-    'algorithm_type' => Algorithmtype::ADVANCED_CVRP_TW,
27
-    'route_name' => 'Fleet Example - Single Depot, Multiple Driver '.date('Y-m-d H:i:s', time()),
28
-    'route_time' => 0,
29
-    'vehicle_capacity' => 100,
30
-    'vehicle_max_distance_mi' => 10000,
31
-    'route_max_duration' => 86400,
32
-    'parts' => 20,
33
-    'distance_unit' => DistanceUnit::MILES,
34
-    'device_type' => DeviceType::WEB,
35
-    'optimize' => OptimizationType::DISTANCE,
36
-    'travel_mode' => TravelMode::DRIVING,
37
-    'advanced_constraints' => [] 
26
+	'algorithm_type' => Algorithmtype::ADVANCED_CVRP_TW,
27
+	'route_name' => 'Fleet Example - Single Depot, Multiple Driver '.date('Y-m-d H:i:s', time()),
28
+	'route_time' => 0,
29
+	'vehicle_capacity' => 100,
30
+	'vehicle_max_distance_mi' => 10000,
31
+	'route_max_duration' => 86400,
32
+	'parts' => 20,
33
+	'distance_unit' => DistanceUnit::MILES,
34
+	'device_type' => DeviceType::WEB,
35
+	'optimize' => OptimizationType::DISTANCE,
36
+	'travel_mode' => TravelMode::DRIVING,
37
+	'advanced_constraints' => [] 
38 38
 ]);
39 39
 
40 40
 //**********************************************************************
@@ -43,22 +43,22 @@  discard block
 block discarded – undo
43 43
 // Time Window Start:  2:00 am EST
44 44
 // Time Window End:   15:50 am EST
45 45
 $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
46
-    'max_cargo_volume' =>  0.0,
47
-    'max_capacity' =>  200,
48
-    'members_count' =>  10,
49
-    'available_time_windows' => [[25200, 75000]],
50
-    'tags' => ['TAG001', 'TAG002']
46
+	'max_cargo_volume' =>  0.0,
47
+	'max_capacity' =>  200,
48
+	'members_count' =>  10,
49
+	'available_time_windows' => [[25200, 75000]],
50
+	'tags' => ['TAG001', 'TAG002']
51 51
 ]);
52 52
 
53 53
 // Schedule 2
54 54
 // Time Window Start:  7:33 am EST
55 55
 // Time Window End:   21:23 am EST
56 56
 $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
57
-    'max_cargo_volume' => 0.0,
58
-    'max_capacity' => 200,
59
-    'members_count' => 10,
60
-    'available_time_windows' => [[45200, 95000]],
61
-    'tags' => ['TAG003']
57
+	'max_cargo_volume' => 0.0,
58
+	'max_capacity' => 200,
59
+	'members_count' => 10,
60
+	'available_time_windows' => [[45200, 95000]],
61
+	'tags' => ['TAG003']
62 62
 ]);
63 63
 
64 64
 //**********************************************************************
@@ -67,24 +67,24 @@  discard block
 block discarded – undo
67 67
 
68 68
 // Depot
69 69
 $addresses[] = Address::fromArray([
70
-    'address' => '1604 PARKRIDGE PKWY, Louisville, KY, 40214',
71
-    'is_depot' => true,
72
-    'lat' => 38.141598,
73
-    'lng' => -85.793846,
74
-    'time' => 300
70
+	'address' => '1604 PARKRIDGE PKWY, Louisville, KY, 40214',
71
+	'is_depot' => true,
72
+	'lat' => 38.141598,
73
+	'lng' => -85.793846,
74
+	'time' => 300
75 75
 ]);
76 76
 
77 77
 // Stops
78 78
 $n = 0;
79 79
 foreach ($json as $address) {
80
-    $addresses[] = Address::fromArray([
81
-        'address' => $address['address'],
82
-        'lat' => $address['lat'],
83
-        'lng' => $address['lng'],
84
-        'time' => $address['time'],
85
-        'tags' => ($n % 2 ? ['TAG001', 'TAG002'] : ['TAG003']) 
86
-    ]);
87
-    ++$n;
80
+	$addresses[] = Address::fromArray([
81
+		'address' => $address['address'],
82
+		'lat' => $address['lat'],
83
+		'lng' => $address['lng'],
84
+		'time' => $address['time'],
85
+		'tags' => ($n % 2 ? ['TAG001', 'TAG002'] : ['TAG003']) 
86
+	]);
87
+	++$n;
88 88
 }
89 89
 
90 90
 $optimizationParams = new OptimizationProblemParams();
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 echo "Routes:" . PHP_EOL;
100 100
 foreach($problem->routes as $route)
101 101
 {
102
-    echo "\tID: " . $route->route_id . PHP_EOL;
103
-    echo "\tDistance: " . $route->trip_distance . PHP_EOL;
104
-    echo "\tAddresses:" . PHP_EOL;
102
+	echo "\tID: " . $route->route_id . PHP_EOL;
103
+	echo "\tDistance: " . $route->trip_distance . PHP_EOL;
104
+	echo "\tAddresses:" . PHP_EOL;
105 105
 
106
-    foreach($route->addresses as $address) echo "\t\t" . $address->address . PHP_EOL;
106
+	foreach($route->addresses as $address) echo "\t\t" . $address->address . PHP_EOL;
107 107
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -93,15 +93,15 @@
 block discarded – undo
93 93
 
94 94
 $problem = OptimizationProblem::optimize($optimizationParams);
95 95
 
96
-echo "Optimization Problem ID: " . $problem->optimization_problem_id . PHP_EOL;
97
-echo "State: " . OptimizationStates::getName($problem->state) . " (" . $problem->state . ")" . PHP_EOL;
96
+echo "Optimization Problem ID: ".$problem->optimization_problem_id.PHP_EOL;
97
+echo "State: ".OptimizationStates::getName($problem->state)." (".$problem->state.")".PHP_EOL;
98 98
 
99
-echo "Routes:" . PHP_EOL;
100
-foreach($problem->routes as $route)
99
+echo "Routes:".PHP_EOL;
100
+foreach ($problem->routes as $route)
101 101
 {
102
-    echo "\tID: " . $route->route_id . PHP_EOL;
103
-    echo "\tDistance: " . $route->trip_distance . PHP_EOL;
104
-    echo "\tAddresses:" . PHP_EOL;
102
+    echo "\tID: ".$route->route_id.PHP_EOL;
103
+    echo "\tDistance: ".$route->trip_distance.PHP_EOL;
104
+    echo "\tAddresses:".PHP_EOL;
105 105
 
106
-    foreach($route->addresses as $address) echo "\t\t" . $address->address . PHP_EOL;
106
+    foreach ($route->addresses as $address) echo "\t\t".$address->address.PHP_EOL;
107 107
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -103,5 +103,7 @@
 block discarded – undo
103 103
     echo "\tDistance: " . $route->trip_distance . PHP_EOL;
104 104
     echo "\tAddresses:" . PHP_EOL;
105 105
 
106
-    foreach($route->addresses as $address) echo "\t\t" . $address->address . PHP_EOL;
107
-}
106
+    foreach($route->addresses as $address) {
107
+    	echo "\t\t" . $address->address . PHP_EOL;
108
+    }
109
+    }
Please login to merge, or discard this patch.
AdvancedConstraints/DriversSchedulesWithTerritoriesAndRetailLocation.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -28,15 +28,15 @@  discard block
 block discarded – undo
28 28
 //**********************************************************************
29 29
 // General Route Parameters
30 30
 $parameters = RouteParameters::fromArray([
31
-    'rt' => true,
32
-    'algorithm_type' => Algorithmtype::ADVANCED_CVRP_TW,
33
-    'route_name' => 'Drivers Schedules - 3 Territories '.date('Y-m-d H:i:s', time()),
34
-    'distance_unit' => DistanceUnit::MILES,
35
-    'device_type' => DeviceType::WEB,
36
-    'optimize' => OptimizationType::DISTANCE,
37
-    'travel_mode' => TravelMode::DRIVING,
38
-    'parts' => 2,
39
-    'advanced_constraints' => []
31
+	'rt' => true,
32
+	'algorithm_type' => Algorithmtype::ADVANCED_CVRP_TW,
33
+	'route_name' => 'Drivers Schedules - 3 Territories '.date('Y-m-d H:i:s', time()),
34
+	'distance_unit' => DistanceUnit::MILES,
35
+	'device_type' => DeviceType::WEB,
36
+	'optimize' => OptimizationType::DISTANCE,
37
+	'travel_mode' => TravelMode::DRIVING,
38
+	'parts' => 2,
39
+	'advanced_constraints' => []
40 40
 ]);
41 41
 
42 42
 //**********************************************************************
@@ -49,22 +49,22 @@  discard block
 block discarded – undo
49 49
 // Time Window End:   11:00 am EST
50 50
 for($i = 0; $i < 6; ++$i)
51 51
 {
52
-    $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
53
-        'max_cargo_volume' => 0.0,
54
-        'members_count' => 1,
55
-        'available_time_windows' => [[(8 + 5) * 3600 , (11 + 5) * 3600]],
56
-        'tags' => $zones[$i % 3],
57
-        'location_sequence_pattern' => [
58
-            '',
59
-            Address::fromArray([
60
-                'alias' => 'RETAIL LOCATION',
61
-                'address' => 'RETAIL LOCATION',
62
-                'lat' => 25.8741751,
63
-                'lng' => -80.1288583,
64
-                'time' => 300
65
-            ])
66
-        ]
67
-    ]);
52
+	$parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
53
+		'max_cargo_volume' => 0.0,
54
+		'members_count' => 1,
55
+		'available_time_windows' => [[(8 + 5) * 3600 , (11 + 5) * 3600]],
56
+		'tags' => $zones[$i % 3],
57
+		'location_sequence_pattern' => [
58
+			'',
59
+			Address::fromArray([
60
+				'alias' => 'RETAIL LOCATION',
61
+				'address' => 'RETAIL LOCATION',
62
+				'lat' => 25.8741751,
63
+				'lng' => -80.1288583,
64
+				'time' => 300
65
+			])
66
+		]
67
+	]);
68 68
 }
69 69
 
70 70
 //**********************************************************************
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 $addresses = [];
74 74
 
75 75
 foreach ($json as $address) {
76
-    $addresses[] = Address::fromArray($address);
76
+	$addresses[] = Address::fromArray($address);
77 77
 }
78 78
 
79 79
 $optimizationParams = new OptimizationProblemParams();
@@ -88,6 +88,6 @@  discard block
 block discarded – undo
88 88
 echo "Routes:" . PHP_EOL;
89 89
 foreach($problem->routes as $route)
90 90
 {
91
-    echo "\tID: " . $route->route_id . PHP_EOL;
92
-    echo "\tDistance: " . $route->trip_distance . PHP_EOL;
91
+	echo "\tID: " . $route->route_id . PHP_EOL;
92
+	echo "\tDistance: " . $route->trip_distance . PHP_EOL;
93 93
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
 // Schedules
48 48
 // Time Window Start:  8:00 am EST
49 49
 // Time Window End:   11:00 am EST
50
-for($i = 0; $i < 6; ++$i)
50
+for ($i = 0; $i<6; ++$i)
51 51
 {
52 52
     $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
53 53
         'max_cargo_volume' => 0.0,
54 54
         'members_count' => 1,
55
-        'available_time_windows' => [[(8 + 5) * 3600 , (11 + 5) * 3600]],
55
+        'available_time_windows' => [[(8 + 5) * 3600, (11 + 5) * 3600]],
56 56
         'tags' => $zones[$i % 3],
57 57
         'location_sequence_pattern' => [
58 58
             '',
@@ -82,12 +82,12 @@  discard block
 block discarded – undo
82 82
 
83 83
 $problem = OptimizationProblem::optimize($optimizationParams);
84 84
 
85
-echo "Optimization Problem ID: " . $problem->optimization_problem_id . PHP_EOL;
86
-echo "State: " . OptimizationStates::getName($problem->state) . " (" . $problem->state . ")" . PHP_EOL;
85
+echo "Optimization Problem ID: ".$problem->optimization_problem_id.PHP_EOL;
86
+echo "State: ".OptimizationStates::getName($problem->state)." (".$problem->state.")".PHP_EOL;
87 87
 
88
-echo "Routes:" . PHP_EOL;
89
-foreach($problem->routes as $route)
88
+echo "Routes:".PHP_EOL;
89
+foreach ($problem->routes as $route)
90 90
 {
91
-    echo "\tID: " . $route->route_id . PHP_EOL;
92
-    echo "\tDistance: " . $route->trip_distance . PHP_EOL;
91
+    echo "\tID: ".$route->route_id.PHP_EOL;
92
+    echo "\tDistance: ".$route->trip_distance.PHP_EOL;
93 93
 }
Please login to merge, or discard this patch.
examples/AdvancedConstraints/DriversSkills.php 3 patches
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -27,32 +27,32 @@  discard block
 block discarded – undo
27 27
 $response = $member->getUsers();
28 28
 
29 29
 if ($response==NULL || !isset($response['results']) || sizeof($response['results'])<3) {
30
-    echo "Cannot retrieve 3 members" . PHP_EOL;
31
-    return;
30
+	echo "Cannot retrieve 3 members" . PHP_EOL;
31
+	return;
32 32
 }
33 33
 
34 34
 $members = [
35
-    $response['results'][0]['member_id'],
36
-    $response['results'][1]['member_id'],
37
-    $response['results'][2]['member_id']
35
+	$response['results'][0]['member_id'],
36
+	$response['results'][1]['member_id'],
37
+	$response['results'][2]['member_id']
38 38
 ];
39 39
 
40 40
 //**********************************************************************
41 41
 // General Route Parameters
42 42
 $parameters = RouteParameters::fromArray([
43
-    'rt' => true,
44
-    'algorithm_type' => Algorithmtype::ADVANCED_CVRP_TW,
45
-    'route_name' => 'Automatic Driver Skills Example - Single Depot, Multiple Driver '.date('Y-m-d H:i:s', time()),
46
-    'route_time' => 0,
47
-    'distance_unit' => DistanceUnit::MILES,
48
-    'device_type' => DeviceType::WEB,
49
-    'optimize' => OptimizationType::DISTANCE,
50
-    'travel_mode' => TravelMode::DRIVING,
51
-    'vehicle_capacity' => 100,
52
-    'vehicle_max_distance_mi' => 10000,
53
-    'route_max_duration' => 86400,
54
-    'parts' => 20,
55
-    'advanced_constraints'=> []
43
+	'rt' => true,
44
+	'algorithm_type' => Algorithmtype::ADVANCED_CVRP_TW,
45
+	'route_name' => 'Automatic Driver Skills Example - Single Depot, Multiple Driver '.date('Y-m-d H:i:s', time()),
46
+	'route_time' => 0,
47
+	'distance_unit' => DistanceUnit::MILES,
48
+	'device_type' => DeviceType::WEB,
49
+	'optimize' => OptimizationType::DISTANCE,
50
+	'travel_mode' => TravelMode::DRIVING,
51
+	'vehicle_capacity' => 100,
52
+	'vehicle_max_distance_mi' => 10000,
53
+	'route_max_duration' => 86400,
54
+	'parts' => 20,
55
+	'advanced_constraints'=> []
56 56
 ]);
57 57
 
58 58
 //**********************************************************************
@@ -61,20 +61,20 @@  discard block
 block discarded – undo
61 61
 // Time Window Start:  2:00 am EST
62 62
 // Time Window End:   16:00 am EST
63 63
 $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
64
-    'max_cargo_volume' => 0.0,
65
-    'max_capacity' => 200,
66
-    'available_time_windows' => [[(2 + 5) * 3600 , (16 + 5) * 3600]],
67
-    'route4me_members_id' => $members
64
+	'max_cargo_volume' => 0.0,
65
+	'max_capacity' => 200,
66
+	'available_time_windows' => [[(2 + 5) * 3600 , (16 + 5) * 3600]],
67
+	'route4me_members_id' => $members
68 68
 ]);
69 69
 
70 70
 // Schedule 2
71 71
 // Time Window Start:  8:00 am EST
72 72
 // Time Window End:   19:00 am EST
73 73
 $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
74
-    'max_cargo_volume' => 0.0,
75
-    'max_capacity' => 500,
76
-    'available_time_windows' => [[(8 + 5) * 3600 , (19 + 5) * 3600]],
77
-    'route4me_members_id' => $members
74
+	'max_cargo_volume' => 0.0,
75
+	'max_capacity' => 500,
76
+	'available_time_windows' => [[(8 + 5) * 3600 , (19 + 5) * 3600]],
77
+	'route4me_members_id' => $members
78 78
 ]);
79 79
 
80 80
 //**********************************************************************
@@ -83,31 +83,31 @@  discard block
 block discarded – undo
83 83
 
84 84
 // Depot
85 85
 $addresses[] = Address::fromArray([
86
-    'address' => '1604 PARKRIDGE PKWY, Louisville, KY, 40214',
87
-    'is_depot' => TRUE,
88
-    'lat' => 38.141598,
89
-    'lng' => -85.793846,
90
-    'time' => 300
86
+	'address' => '1604 PARKRIDGE PKWY, Louisville, KY, 40214',
87
+	'is_depot' => TRUE,
88
+	'lat' => 38.141598,
89
+	'lng' => -85.793846,
90
+	'time' => 300
91 91
 ]);
92 92
 
93 93
 // Stops
94 94
 $n = 0;
95 95
 foreach ($json as $address) {
96
-    $addr_obj = Address::fromArray([
97
-        'address' => $address['address'],
98
-        'lat' => $address['lat'],
99
-        'lng' => $address['lng'],
100
-        'time' => $address['time'],
101
-        'tags' => [($n < 4 ? 'Class A CDL' : 'Class B CDL')]
102
-    ]);
103
-
104
-    if($n >= 4)
105
-    {
106
-        $addr_obj->time_window_start = $address['time_window_start'];
107
-        $addr_obj->time_window_end = $address['time_window_end'];
108
-    }
109
-    $addresses[] = $addr_obj;
110
-    ++$n;
96
+	$addr_obj = Address::fromArray([
97
+		'address' => $address['address'],
98
+		'lat' => $address['lat'],
99
+		'lng' => $address['lng'],
100
+		'time' => $address['time'],
101
+		'tags' => [($n < 4 ? 'Class A CDL' : 'Class B CDL')]
102
+	]);
103
+
104
+	if($n >= 4)
105
+	{
106
+		$addr_obj->time_window_start = $address['time_window_start'];
107
+		$addr_obj->time_window_end = $address['time_window_end'];
108
+	}
109
+	$addresses[] = $addr_obj;
110
+	++$n;
111 111
 }
112 112
 
113 113
 $optimizationParams = new OptimizationProblemParams();
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
 echo "Routes:" . PHP_EOL;
123 123
 foreach($problem->routes as $route)
124 124
 {
125
-    echo "\tID: " . $route->route_id . PHP_EOL;
126
-    echo "\tDistance: " . $route->trip_distance . PHP_EOL;
127
-    echo "\tAddresses:" . PHP_EOL;
125
+	echo "\tID: " . $route->route_id . PHP_EOL;
126
+	echo "\tDistance: " . $route->trip_distance . PHP_EOL;
127
+	echo "\tAddresses:" . PHP_EOL;
128 128
 
129
-    foreach($route->addresses as $address) echo "\t\t" . $address->address . PHP_EOL;
129
+	foreach($route->addresses as $address) echo "\t\t" . $address->address . PHP_EOL;
130 130
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 $response = $member->getUsers();
28 28
 
29 29
 if ($response==NULL || !isset($response['results']) || sizeof($response['results'])<3) {
30
-    echo "Cannot retrieve 3 members" . PHP_EOL;
30
+    echo "Cannot retrieve 3 members".PHP_EOL;
31 31
     return;
32 32
 }
33 33
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
64 64
     'max_cargo_volume' => 0.0,
65 65
     'max_capacity' => 200,
66
-    'available_time_windows' => [[(2 + 5) * 3600 , (16 + 5) * 3600]],
66
+    'available_time_windows' => [[(2 + 5) * 3600, (16 + 5) * 3600]],
67 67
     'route4me_members_id' => $members
68 68
 ]);
69 69
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
74 74
     'max_cargo_volume' => 0.0,
75 75
     'max_capacity' => 500,
76
-    'available_time_windows' => [[(8 + 5) * 3600 , (19 + 5) * 3600]],
76
+    'available_time_windows' => [[(8 + 5) * 3600, (19 + 5) * 3600]],
77 77
     'route4me_members_id' => $members
78 78
 ]);
79 79
 
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
         'lat' => $address['lat'],
99 99
         'lng' => $address['lng'],
100 100
         'time' => $address['time'],
101
-        'tags' => [($n < 4 ? 'Class A CDL' : 'Class B CDL')]
101
+        'tags' => [($n<4 ? 'Class A CDL' : 'Class B CDL')]
102 102
     ]);
103 103
 
104
-    if($n >= 4)
104
+    if ($n>=4)
105 105
     {
106 106
         $addr_obj->time_window_start = $address['time_window_start'];
107 107
         $addr_obj->time_window_end = $address['time_window_end'];
@@ -116,15 +116,15 @@  discard block
 block discarded – undo
116 116
 
117 117
 $problem = OptimizationProblem::optimize($optimizationParams);
118 118
 
119
-echo "Optimization Problem ID: " . $problem->optimization_problem_id . PHP_EOL;
120
-echo "State: " . OptimizationStates::getName($problem->state) . " (" . $problem->state . ")" . PHP_EOL;
119
+echo "Optimization Problem ID: ".$problem->optimization_problem_id.PHP_EOL;
120
+echo "State: ".OptimizationStates::getName($problem->state)." (".$problem->state.")".PHP_EOL;
121 121
 
122
-echo "Routes:" . PHP_EOL;
123
-foreach($problem->routes as $route)
122
+echo "Routes:".PHP_EOL;
123
+foreach ($problem->routes as $route)
124 124
 {
125
-    echo "\tID: " . $route->route_id . PHP_EOL;
126
-    echo "\tDistance: " . $route->trip_distance . PHP_EOL;
127
-    echo "\tAddresses:" . PHP_EOL;
125
+    echo "\tID: ".$route->route_id.PHP_EOL;
126
+    echo "\tDistance: ".$route->trip_distance.PHP_EOL;
127
+    echo "\tAddresses:".PHP_EOL;
128 128
 
129
-    foreach($route->addresses as $address) echo "\t\t" . $address->address . PHP_EOL;
129
+    foreach ($route->addresses as $address) echo "\t\t".$address->address.PHP_EOL;
130 130
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -126,5 +126,7 @@
 block discarded – undo
126 126
     echo "\tDistance: " . $route->trip_distance . PHP_EOL;
127 127
     echo "\tAddresses:" . PHP_EOL;
128 128
 
129
-    foreach($route->addresses as $address) echo "\t\t" . $address->address . PHP_EOL;
130
-}
129
+    foreach($route->addresses as $address) {
130
+    	echo "\t\t" . $address->address . PHP_EOL;
131
+    }
132
+    }
Please login to merge, or discard this patch.
examples/AdvancedConstraints/SomeAddressesWithoutTags.php 3 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -23,18 +23,18 @@  discard block
 block discarded – undo
23 23
 //**********************************************************************
24 24
 // General Route Parameters
25 25
 $parameters = RouteParameters::fromArray([
26
-    'algorithm_type' => Algorithmtype::ADVANCED_CVRP_TW,
27
-    'route_name' => 'Fleet Example 2 - Single Depot, Multiple Driver '.date('Y-m-d H:i:s', time()),
28
-    'route_time' => 0,
29
-    'vehicle_capacity' => 100,
30
-    'vehicle_max_distance_mi' => 10000,
31
-    'route_max_duration' => 86400,
32
-    'parts' => 20,
33
-    'distance_unit' => DistanceUnit::MILES,
34
-    'device_type' => DeviceType::WEB,
35
-    'optimize' => OptimizationType::DISTANCE,
36
-    'travel_mode' => TravelMode::DRIVING,
37
-    'advanced_constraints' => [] 
26
+	'algorithm_type' => Algorithmtype::ADVANCED_CVRP_TW,
27
+	'route_name' => 'Fleet Example 2 - Single Depot, Multiple Driver '.date('Y-m-d H:i:s', time()),
28
+	'route_time' => 0,
29
+	'vehicle_capacity' => 100,
30
+	'vehicle_max_distance_mi' => 10000,
31
+	'route_max_duration' => 86400,
32
+	'parts' => 20,
33
+	'distance_unit' => DistanceUnit::MILES,
34
+	'device_type' => DeviceType::WEB,
35
+	'optimize' => OptimizationType::DISTANCE,
36
+	'travel_mode' => TravelMode::DRIVING,
37
+	'advanced_constraints' => [] 
38 38
 ]);
39 39
 
40 40
 //**********************************************************************
@@ -43,22 +43,22 @@  discard block
 block discarded – undo
43 43
 // Time Window Start:  2:00 am EST
44 44
 // Time Window End:   15:50 am EST
45 45
 $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
46
-    'max_cargo_volume' => 0.0,
47
-    'max_capacity' => 200,
48
-    'members_count' => 10,
49
-    'available_time_windows' => [[25200, 75000]],
50
-    'tags' => ['TAG001', 'TAG002']
46
+	'max_cargo_volume' => 0.0,
47
+	'max_capacity' => 200,
48
+	'members_count' => 10,
49
+	'available_time_windows' => [[25200, 75000]],
50
+	'tags' => ['TAG001', 'TAG002']
51 51
 ]);
52 52
 
53 53
 // Schedule 2
54 54
 // Time Window Start:  7:33 am EST
55 55
 // Time Window End:   21:23 am EST
56 56
 $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
57
-    'max_cargo_volume' => 0.0,
58
-    'max_capacity' => 500,
59
-    'members_count' => 6,
60
-    'available_time_windows' => [[45200, 95000]],
61
-    'tags' => ['TAG003']
57
+	'max_cargo_volume' => 0.0,
58
+	'max_capacity' => 500,
59
+	'members_count' => 6,
60
+	'available_time_windows' => [[45200, 95000]],
61
+	'tags' => ['TAG003']
62 62
 ]);
63 63
 
64 64
 //**********************************************************************
@@ -67,33 +67,33 @@  discard block
 block discarded – undo
67 67
 
68 68
 // Depot
69 69
 $addresses[] = Address::fromArray([
70
-    'address' => '1604 PARKRIDGE PKWY, Louisville, KY, 40214',
71
-    'is_depot' => true,
72
-    'lat' => 38.141598,
73
-    'lng' => -85.793846,
74
-    'time' => 300
70
+	'address' => '1604 PARKRIDGE PKWY, Louisville, KY, 40214',
71
+	'is_depot' => true,
72
+	'lat' => 38.141598,
73
+	'lng' => -85.793846,
74
+	'time' => 300
75 75
 ]);
76 76
 
77 77
 // Stops
78 78
 $n = 0;
79 79
 foreach ($json as $address) {
80
-    $addr_obj = Address::fromArray([
81
-        'address' => $address['address'],
82
-        'lat' => $address['lat'],
83
-        'lng' => $address['lng'],
84
-        'time' => $address['time']
85
-    ]);
86
-
87
-    if($n == 0 || $n == 2 || $n == 4 || $n == 5)
88
-    {
89
-         $addr_obj->tags = ['TAG001', 'TAG002'];
90
-    }
91
-    else if($n == 1 || $n == 3)
92
-    {
93
-        $addr_obj->tags = ['TAG003'];
94
-    }
95
-    $addresses[] = $addr_obj;
96
-    ++$n;
80
+	$addr_obj = Address::fromArray([
81
+		'address' => $address['address'],
82
+		'lat' => $address['lat'],
83
+		'lng' => $address['lng'],
84
+		'time' => $address['time']
85
+	]);
86
+
87
+	if($n == 0 || $n == 2 || $n == 4 || $n == 5)
88
+	{
89
+		 $addr_obj->tags = ['TAG001', 'TAG002'];
90
+	}
91
+	else if($n == 1 || $n == 3)
92
+	{
93
+		$addr_obj->tags = ['TAG003'];
94
+	}
95
+	$addresses[] = $addr_obj;
96
+	++$n;
97 97
 }
98 98
 
99 99
 $optimizationParams = new OptimizationProblemParams();
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 echo "Routes:" . PHP_EOL;
109 109
 foreach($problem->routes as $route)
110 110
 {
111
-    echo "\tID: " . $route->route_id . PHP_EOL;
112
-    echo "\tDistance: " . $route->trip_distance . PHP_EOL;
113
-    echo "\tAddresses:" . PHP_EOL;
111
+	echo "\tID: " . $route->route_id . PHP_EOL;
112
+	echo "\tDistance: " . $route->trip_distance . PHP_EOL;
113
+	echo "\tAddresses:" . PHP_EOL;
114 114
 
115
-    foreach($route->addresses as $address) echo "\t\t" . $address->address . PHP_EOL;
115
+	foreach($route->addresses as $address) echo "\t\t" . $address->address . PHP_EOL;
116 116
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
         'time' => $address['time']
85 85
     ]);
86 86
 
87
-    if($n == 0 || $n == 2 || $n == 4 || $n == 5)
87
+    if ($n==0 || $n==2 || $n==4 || $n==5)
88 88
     {
89 89
          $addr_obj->tags = ['TAG001', 'TAG002'];
90 90
     }
91
-    else if($n == 1 || $n == 3)
91
+    else if ($n==1 || $n==3)
92 92
     {
93 93
         $addr_obj->tags = ['TAG003'];
94 94
     }
@@ -102,15 +102,15 @@  discard block
 block discarded – undo
102 102
 
103 103
 $problem = OptimizationProblem::optimize($optimizationParams);
104 104
 
105
-echo "Optimization Problem ID: " . $problem->optimization_problem_id . PHP_EOL;
106
-echo "State: " . OptimizationStates::getName($problem->state) . " (" . $problem->state . ")" . PHP_EOL;
105
+echo "Optimization Problem ID: ".$problem->optimization_problem_id.PHP_EOL;
106
+echo "State: ".OptimizationStates::getName($problem->state)." (".$problem->state.")".PHP_EOL;
107 107
 
108
-echo "Routes:" . PHP_EOL;
109
-foreach($problem->routes as $route)
108
+echo "Routes:".PHP_EOL;
109
+foreach ($problem->routes as $route)
110 110
 {
111
-    echo "\tID: " . $route->route_id . PHP_EOL;
112
-    echo "\tDistance: " . $route->trip_distance . PHP_EOL;
113
-    echo "\tAddresses:" . PHP_EOL;
111
+    echo "\tID: ".$route->route_id.PHP_EOL;
112
+    echo "\tDistance: ".$route->trip_distance.PHP_EOL;
113
+    echo "\tAddresses:".PHP_EOL;
114 114
 
115
-    foreach($route->addresses as $address) echo "\t\t" . $address->address . PHP_EOL;
115
+    foreach ($route->addresses as $address) echo "\t\t".$address->address.PHP_EOL;
116 116
 }
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -87,8 +87,7 @@  discard block
 block discarded – undo
87 87
     if($n == 0 || $n == 2 || $n == 4 || $n == 5)
88 88
     {
89 89
          $addr_obj->tags = ['TAG001', 'TAG002'];
90
-    }
91
-    else if($n == 1 || $n == 3)
90
+    } else if($n == 1 || $n == 3)
92 91
     {
93 92
         $addr_obj->tags = ['TAG003'];
94 93
     }
@@ -112,5 +111,7 @@  discard block
 block discarded – undo
112 111
     echo "\tDistance: " . $route->trip_distance . PHP_EOL;
113 112
     echo "\tAddresses:" . PHP_EOL;
114 113
 
115
-    foreach($route->addresses as $address) echo "\t\t" . $address->address . PHP_EOL;
116
-}
114
+    foreach($route->addresses as $address) {
115
+    	echo "\t\t" . $address->address . PHP_EOL;
116
+    }
117
+    }
Please login to merge, or discard this patch.
examples/AdvancedConstraints/PersistentLocation.php 3 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -23,25 +23,25 @@  discard block
 block discarded – undo
23 23
 //**********************************************************************
24 24
 // General Route Parameters
25 25
 $parameters = RouteParameters::fromArray([
26
-    'rt' => false,
27
-    'algorithm_type' => Algorithmtype::ADVANCED_CVRP_TW,
28
-    'route_name' => 'Persistent Location - Single Depot - Multiple Driver '.date('Y-m-d H:i:s', time()),
29
-    'route_time' => 25200,
30
-    'distance_unit' => DistanceUnit::MILES,
31
-    'device_type' => DeviceType::WEB,
32
-    'optimize' => OptimizationType::DISTANCE,
33
-    'travel_mode' => TravelMode::DRIVING,
34
-    'advanced_constraints' => [] 
26
+	'rt' => false,
27
+	'algorithm_type' => Algorithmtype::ADVANCED_CVRP_TW,
28
+	'route_name' => 'Persistent Location - Single Depot - Multiple Driver '.date('Y-m-d H:i:s', time()),
29
+	'route_time' => 25200,
30
+	'distance_unit' => DistanceUnit::MILES,
31
+	'device_type' => DeviceType::WEB,
32
+	'optimize' => OptimizationType::DISTANCE,
33
+	'travel_mode' => TravelMode::DRIVING,
34
+	'advanced_constraints' => [] 
35 35
 ]);
36 36
 
37 37
 //**********************************************************************
38 38
 // Persistent Location
39 39
 $persistent_location = [
40
-    'alias' =>  'DEPOT END LOCATION',
41
-    'address' =>  '4738 BELLEVUE AVE, Louisville, KY, 40215',
42
-    'lat' =>  38.179806,
43
-    'lng' =>  -85.775558,
44
-    'time' =>  300
40
+	'alias' =>  'DEPOT END LOCATION',
41
+	'address' =>  '4738 BELLEVUE AVE, Louisville, KY, 40215',
42
+	'lat' =>  38.179806,
43
+	'lng' =>  -85.775558,
44
+	'time' =>  300
45 45
 ];
46 46
 
47 47
 //**********************************************************************
@@ -50,23 +50,23 @@  discard block
 block discarded – undo
50 50
 // Time Window Start:  2:00 am EST
51 51
 // Time Window End:   15:50 am EST
52 52
 $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
53
-    'max_cargo_volume' => 0.0,
54
-    'max_capacity' => 200,
55
-    'members_count' => 10,
56
-    'available_time_windows' => [[25200, 75000]
57
-    ],
58
-    'location_sequence_pattern' => ['', $persistent_location]
53
+	'max_cargo_volume' => 0.0,
54
+	'max_capacity' => 200,
55
+	'members_count' => 10,
56
+	'available_time_windows' => [[25200, 75000]
57
+	],
58
+	'location_sequence_pattern' => ['', $persistent_location]
59 59
 ]);
60 60
 
61 61
 // Schedule 2
62 62
 // Time Window Start:  7:33 am EST
63 63
 // Time Window End:   21:23 am EST
64 64
 $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
65
-    'max_cargo_volume' => 0.0,
66
-    'max_capacity' => 200,
67
-    'members_count' => 10,
68
-    'available_time_windows' => [[45200, 95000]],
69
-    'location_sequence_pattern' => ['', $persistent_location]
65
+	'max_cargo_volume' => 0.0,
66
+	'max_capacity' => 200,
67
+	'members_count' => 10,
68
+	'available_time_windows' => [[45200, 95000]],
69
+	'location_sequence_pattern' => ['', $persistent_location]
70 70
 ]);
71 71
 
72 72
 //**********************************************************************
@@ -75,25 +75,25 @@  discard block
 block discarded – undo
75 75
 
76 76
 // Depot
77 77
 $addresses[] = Address::fromArray([
78
-    'address' => '1604 PARKRIDGE PKWY, Louisville, KY, 40214',
79
-    'is_depot' => true,
80
-    'lat' => 38.141598,
81
-    'lng' => -85.793846,
82
-    'time' => 0
78
+	'address' => '1604 PARKRIDGE PKWY, Louisville, KY, 40214',
79
+	'is_depot' => true,
80
+	'lat' => 38.141598,
81
+	'lng' => -85.793846,
82
+	'time' => 0
83 83
 ]);
84 84
 
85 85
 // Stops
86 86
 foreach ($json as $address) {
87 87
 
88
-    // skip persistent
89
-    if($address['address'] == '4738 BELLEVUE AVE, Louisville, KY, 40215') continue;
88
+	// skip persistent
89
+	if($address['address'] == '4738 BELLEVUE AVE, Louisville, KY, 40215') continue;
90 90
 
91
-    $addresses[] = Address::fromArray([
92
-        'address' => $address['address'],
93
-        'lat' => $address['lat'],
94
-        'lng' => $address['lng'],
95
-        'time' => $address['time']
96
-    ]);
91
+	$addresses[] = Address::fromArray([
92
+		'address' => $address['address'],
93
+		'lat' => $address['lat'],
94
+		'lng' => $address['lng'],
95
+		'time' => $address['time']
96
+	]);
97 97
 }
98 98
 
99 99
 $optimizationParams = new OptimizationProblemParams();
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 echo "Routes:" . PHP_EOL;
109 109
 foreach($problem->routes as $route)
110 110
 {
111
-    echo "\tID: " . $route->route_id . PHP_EOL;
112
-    echo "\tDistance: " . $route->trip_distance . PHP_EOL;
113
-    echo "\tAddresses:" . PHP_EOL;
111
+	echo "\tID: " . $route->route_id . PHP_EOL;
112
+	echo "\tDistance: " . $route->trip_distance . PHP_EOL;
113
+	echo "\tAddresses:" . PHP_EOL;
114 114
 
115
-    foreach($route->addresses as $address) echo "\t\t" . $address->address . PHP_EOL;
115
+	foreach($route->addresses as $address) echo "\t\t" . $address->address . PHP_EOL;
116 116
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 foreach ($json as $address) {
87 87
 
88 88
     // skip persistent
89
-    if($address['address'] == '4738 BELLEVUE AVE, Louisville, KY, 40215') continue;
89
+    if ($address['address']=='4738 BELLEVUE AVE, Louisville, KY, 40215') continue;
90 90
 
91 91
     $addresses[] = Address::fromArray([
92 92
         'address' => $address['address'],
@@ -102,15 +102,15 @@  discard block
 block discarded – undo
102 102
 
103 103
 $problem = OptimizationProblem::optimize($optimizationParams);
104 104
 
105
-echo "Optimization Problem ID: " . $problem->optimization_problem_id . PHP_EOL;
106
-echo "State: " . OptimizationStates::getName($problem->state) . " (" . $problem->state . ")" . PHP_EOL;
105
+echo "Optimization Problem ID: ".$problem->optimization_problem_id.PHP_EOL;
106
+echo "State: ".OptimizationStates::getName($problem->state)." (".$problem->state.")".PHP_EOL;
107 107
 
108
-echo "Routes:" . PHP_EOL;
109
-foreach($problem->routes as $route)
108
+echo "Routes:".PHP_EOL;
109
+foreach ($problem->routes as $route)
110 110
 {
111
-    echo "\tID: " . $route->route_id . PHP_EOL;
112
-    echo "\tDistance: " . $route->trip_distance . PHP_EOL;
113
-    echo "\tAddresses:" . PHP_EOL;
111
+    echo "\tID: ".$route->route_id.PHP_EOL;
112
+    echo "\tDistance: ".$route->trip_distance.PHP_EOL;
113
+    echo "\tAddresses:".PHP_EOL;
114 114
 
115
-    foreach($route->addresses as $address) echo "\t\t" . $address->address . PHP_EOL;
115
+    foreach ($route->addresses as $address) echo "\t\t".$address->address.PHP_EOL;
116 116
 }
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -86,7 +86,9 @@  discard block
 block discarded – undo
86 86
 foreach ($json as $address) {
87 87
 
88 88
     // skip persistent
89
-    if($address['address'] == '4738 BELLEVUE AVE, Louisville, KY, 40215') continue;
89
+    if($address['address'] == '4738 BELLEVUE AVE, Louisville, KY, 40215') {
90
+    	continue;
91
+    }
90 92
 
91 93
     $addresses[] = Address::fromArray([
92 94
         'address' => $address['address'],
@@ -112,5 +114,7 @@  discard block
 block discarded – undo
112 114
     echo "\tDistance: " . $route->trip_distance . PHP_EOL;
113 115
     echo "\tAddresses:" . PHP_EOL;
114 116
 
115
-    foreach($route->addresses as $address) echo "\t\t" . $address->address . PHP_EOL;
116
-}
117
+    foreach($route->addresses as $address) {
118
+    	echo "\t\t" . $address->address . PHP_EOL;
119
+    }
120
+    }
Please login to merge, or discard this patch.
examples/AdvancedConstraints/DriversScheduleswithTerritoriesV2.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
 //**********************************************************************
28 28
 // General Route Parameters
29 29
 $parameters = RouteParameters::fromArray([
30
-    'rt' => true,
31
-    'algorithm_type' => Algorithmtype::ADVANCED_CVRP_TW,
32
-    'route_name' => '5 Drivers Schedules '.date('Y-m-d H:i:s', time()),
33
-    'distance_unit' => DistanceUnit::MILES,
34
-    'device_type' => DeviceType::WEB,
35
-    'optimize' => OptimizationType::DISTANCE,
36
-    'travel_mode' => TravelMode::DRIVING,
37
-    'parts' => 5,
38
-    'advanced_constraints' => []
30
+	'rt' => true,
31
+	'algorithm_type' => Algorithmtype::ADVANCED_CVRP_TW,
32
+	'route_name' => '5 Drivers Schedules '.date('Y-m-d H:i:s', time()),
33
+	'distance_unit' => DistanceUnit::MILES,
34
+	'device_type' => DeviceType::WEB,
35
+	'optimize' => OptimizationType::DISTANCE,
36
+	'travel_mode' => TravelMode::DRIVING,
37
+	'parts' => 5,
38
+	'advanced_constraints' => []
39 39
 ]);
40 40
 
41 41
 //**********************************************************************
@@ -46,19 +46,19 @@  discard block
 block discarded – undo
46 46
 // Schedules
47 47
 // Time: 9:00 am EST => (9 + 5) * 3600 => 50400
48 48
 $available_time_windows = [
49
-    [50400, 64800], [54000, 75600], [57600, 72000], [57600, 75600], [54000, 68400], 
50
-    [54000, 75600], [54000, 68400], [57600, 79200], [43200, 57600], [57600, 79200],
51
-    [50400, 64800], [43200, 61200]
49
+	[50400, 64800], [54000, 75600], [57600, 72000], [57600, 75600], [54000, 68400], 
50
+	[54000, 75600], [54000, 68400], [57600, 79200], [43200, 57600], [57600, 79200],
51
+	[50400, 64800], [43200, 61200]
52 52
 ];
53 53
 
54 54
 for($i = 0; $i < 12; ++$i)
55 55
 {
56
-    $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
57
-        'max_cargo_volume' => 0.0,
58
-        'members_count' => 1,
59
-        'available_time_windows' => [$available_time_windows[$i]],
60
-        'tags' => $zones[$i % 3]
61
-    ]);
56
+	$parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
57
+		'max_cargo_volume' => 0.0,
58
+		'members_count' => 1,
59
+		'available_time_windows' => [$available_time_windows[$i]],
60
+		'tags' => $zones[$i % 3]
61
+	]);
62 62
 }
63 63
 
64 64
 //**********************************************************************
@@ -67,16 +67,16 @@  discard block
 block discarded – undo
67 67
 
68 68
 // Depot
69 69
 $addresses[] = Address::fromArray([
70
-    'address' => 'DEPOT',
71
-    'is_depot' => true,
72
-    'lat' => 25.694341,
73
-    'lng' => -80.166036,
74
-    'time' => 0
70
+	'address' => 'DEPOT',
71
+	'is_depot' => true,
72
+	'lat' => 25.694341,
73
+	'lng' => -80.166036,
74
+	'time' => 0
75 75
 ]);
76 76
 
77 77
 // Stops
78 78
 foreach ($json as $address) {
79
-    $addresses[] = Address::fromArray($address);
79
+	$addresses[] = Address::fromArray($address);
80 80
 }
81 81
 
82 82
 $optimizationParams = new OptimizationProblemParams();
@@ -91,6 +91,6 @@  discard block
 block discarded – undo
91 91
 echo "Routes:" . PHP_EOL;
92 92
 foreach($problem->routes as $route)
93 93
 {
94
-    echo "\tID: " . $route->route_id . PHP_EOL;
95
-    echo "\tDistance: " . $route->trip_distance . PHP_EOL;
94
+	echo "\tID: " . $route->route_id . PHP_EOL;
95
+	echo "\tDistance: " . $route->trip_distance . PHP_EOL;
96 96
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     [50400, 64800], [43200, 61200]
52 52
 ];
53 53
 
54
-for($i = 0; $i < 12; ++$i)
54
+for ($i = 0; $i<12; ++$i)
55 55
 {
56 56
     $parameters->advanced_constraints[] = RouteAdvancedConstraints::fromArray([
57 57
         'max_cargo_volume' => 0.0,
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
 
86 86
 $problem = OptimizationProblem::optimize($optimizationParams);
87 87
 
88
-echo "Optimization Problem ID: " . $problem->optimization_problem_id . PHP_EOL;
89
-echo "State: " . OptimizationStates::getName($problem->state) . " (" . $problem->state . ")" . PHP_EOL;
88
+echo "Optimization Problem ID: ".$problem->optimization_problem_id.PHP_EOL;
89
+echo "State: ".OptimizationStates::getName($problem->state)." (".$problem->state.")".PHP_EOL;
90 90
 
91
-echo "Routes:" . PHP_EOL;
92
-foreach($problem->routes as $route)
91
+echo "Routes:".PHP_EOL;
92
+foreach ($problem->routes as $route)
93 93
 {
94
-    echo "\tID: " . $route->route_id . PHP_EOL;
95
-    echo "\tDistance: " . $route->trip_distance . PHP_EOL;
94
+    echo "\tID: ".$route->route_id.PHP_EOL;
95
+    echo "\tDistance: ".$route->trip_distance.PHP_EOL;
96 96
 }
Please login to merge, or discard this patch.