@@ -85,10 +85,10 @@ discard block |
||
| 85 | 85 | 'lat' => $address['lat'], |
| 86 | 86 | 'lng' => $address['lng'], |
| 87 | 87 | 'time' => $address['time'], |
| 88 | - 'tags' => ($n < 4 ? ['TAG001', 'TAG002'] : ['TAG003']) |
|
| 88 | + 'tags' => ($n<4 ? ['TAG001', 'TAG002'] : ['TAG003']) |
|
| 89 | 89 | ]); |
| 90 | 90 | |
| 91 | - if($n >= 4) |
|
| 91 | + if ($n>=4) |
|
| 92 | 92 | { |
| 93 | 93 | $addr_obj->time_window_start = $address['time_window_start']; |
| 94 | 94 | $addr_obj->time_window_end = $address['time_window_end']; |
@@ -103,15 +103,15 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | $problem = OptimizationProblem::optimize($optimizationParams); |
| 105 | 105 | |
| 106 | -echo "Optimization Problem ID: " . $problem->optimization_problem_id . PHP_EOL; |
|
| 107 | -echo "State: " . OptimizationStates::getName($problem->state) . " (" . $problem->state . ")" . PHP_EOL; |
|
| 106 | +echo "Optimization Problem ID: ".$problem->optimization_problem_id.PHP_EOL; |
|
| 107 | +echo "State: ".OptimizationStates::getName($problem->state)." (".$problem->state.")".PHP_EOL; |
|
| 108 | 108 | |
| 109 | -echo "Routes:" . PHP_EOL; |
|
| 110 | -foreach($problem->routes as $route) |
|
| 109 | +echo "Routes:".PHP_EOL; |
|
| 110 | +foreach ($problem->routes as $route) |
|
| 111 | 111 | { |
| 112 | - echo "\tID: " . $route->route_id . PHP_EOL; |
|
| 113 | - echo "\tDistance: " . $route->trip_distance . PHP_EOL; |
|
| 114 | - echo "\tAddresses:" . PHP_EOL; |
|
| 112 | + echo "\tID: ".$route->route_id.PHP_EOL; |
|
| 113 | + echo "\tDistance: ".$route->trip_distance.PHP_EOL; |
|
| 114 | + echo "\tAddresses:".PHP_EOL; |
|
| 115 | 115 | |
| 116 | - foreach($route->addresses as $address) echo "\t\t" . $address->address . PHP_EOL; |
|
| 116 | + foreach ($route->addresses as $address) echo "\t\t".$address->address.PHP_EOL; |
|
| 117 | 117 | } |
@@ -82,5 +82,5 @@ |
||
| 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; |
|
@@ -40,4 +40,4 @@ |
||
| 40 | 40 | |
| 41 | 41 | $problem = OptimizationProblem::optimize($optimizationParams); |
| 42 | 42 | |
| 43 | -Route4Me::simplePrint((array) $problem, true); |
|
| 43 | +Route4Me::simplePrint((array)$problem, true); |
|
@@ -47,12 +47,12 @@ |
||
| 47 | 47 | |
| 48 | 48 | $problem = OptimizationProblem::optimize($optimizationParams); |
| 49 | 49 | |
| 50 | -foreach ((array) $problem as $key => $value) { |
|
| 50 | +foreach ((array)$problem as $key => $value) { |
|
| 51 | 51 | if (is_string($value)) { |
| 52 | 52 | echo $key.' --> '.$value.'<br>'; |
| 53 | 53 | } else { |
| 54 | 54 | echo "************ $key ************* <br>"; |
| 55 | - Route4Me::simplePrint((array) $value, true); |
|
| 55 | + Route4Me::simplePrint((array)$value, true); |
|
| 56 | 56 | echo '******************************* <br>'; |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -47,12 +47,12 @@ |
||
| 47 | 47 | |
| 48 | 48 | $problem = OptimizationProblem::optimize($optimizationParams); |
| 49 | 49 | |
| 50 | -foreach ((array) $problem as $key => $value) { |
|
| 50 | +foreach ((array)$problem as $key => $value) { |
|
| 51 | 51 | if (is_string($value)) { |
| 52 | 52 | echo $key.' --> '.$value.'<br>'; |
| 53 | 53 | } else { |
| 54 | 54 | echo "************ $key ************* <br>"; |
| 55 | - Route4Me::simplePrint((array) $value, true); |
|
| 55 | + Route4Me::simplePrint((array)$value, true); |
|
| 56 | 56 | echo '******************************* <br>'; |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -47,12 +47,12 @@ |
||
| 47 | 47 | |
| 48 | 48 | $problem = OptimizationProblem::optimize($optimizationParams); |
| 49 | 49 | |
| 50 | -foreach ((array) $problem as $key => $value) { |
|
| 50 | +foreach ((array)$problem as $key => $value) { |
|
| 51 | 51 | if (is_string($value)) { |
| 52 | 52 | echo $key.' --> '.$value.'<br>'; |
| 53 | 53 | } else { |
| 54 | 54 | echo "************ $key ************* <br>"; |
| 55 | - Route4Me::simplePrint((array) $value, true); |
|
| 55 | + Route4Me::simplePrint((array)$value, true); |
|
| 56 | 56 | echo '******************************* <br>'; |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -18,9 +18,9 @@ |
||
| 18 | 18 | public static function getName(int $state) : string |
| 19 | 19 | { |
| 20 | 20 | $refl = new ReflectionClass(__CLASS__); |
| 21 | - foreach($refl->getConstants() AS $key => $val) |
|
| 21 | + foreach ($refl->getConstants() AS $key => $val) |
|
| 22 | 22 | { |
| 23 | - if($val == $state) return $key; |
|
| 23 | + if ($val==$state) return $key; |
|
| 24 | 24 | } |
| 25 | 25 | return 'UNKNOWN'; |
| 26 | 26 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | if (is_null($result) || !is_array($result)) return null; |
| 182 | 182 | |
| 183 | 183 | foreach ($result as $custNoteType) { |
| 184 | - if (isset($custNoteType["note_custom_type"]) && $custNoteType["note_custom_type"] == $params) { |
|
| 184 | + if (isset($custNoteType["note_custom_type"]) && $custNoteType["note_custom_type"]==$params) { |
|
| 185 | 185 | return $custNoteType; |
| 186 | 186 | } |
| 187 | 187 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | $customArray = []; |
| 228 | 228 | |
| 229 | 229 | foreach ($params as $key => $value) { |
| 230 | - if (false !== strpos($key, 'custom_note_type')) { |
|
| 230 | + if (false!==strpos($key, 'custom_note_type')) { |
|
| 231 | 231 | $customArray[$key] = $value; |
| 232 | 232 | } |
| 233 | 233 | } |
@@ -123,11 +123,11 @@ |
||
| 123 | 123 | $allVendors = self::GetTelematicsVendors(null); |
| 124 | 124 | $vendorsNumber = sizeof($allVendors['vendors']); |
| 125 | 125 | |
| 126 | - if ($vendorsNumber < $limit) { |
|
| 127 | - if ($vendorsNumber > $offset) { |
|
| 126 | + if ($vendorsNumber<$limit) { |
|
| 127 | + if ($vendorsNumber>$offset) { |
|
| 128 | 128 | $limit = $vendorsNumber; |
| 129 | 129 | } else { |
| 130 | - if ($vendorsNumber == $offset) { |
|
| 130 | + if ($vendorsNumber==$offset) { |
|
| 131 | 131 | return $allVendors['vendors'][$offset]->{'vendor_id'}; |
| 132 | 132 | } else { |
| 133 | 133 | echo 'The vendors numbers are less than offset'; |