@@ -30,10 +30,10 @@ |
||
| 30 | 30 | $route->parameters = new \stdClass(); |
| 31 | 31 | |
| 32 | 32 | $route->parameters = array( |
| 33 | - "member_id" => $randomRoute->member_id, |
|
| 34 | - "optimize" => "Distance", |
|
| 35 | - "route_max_duration" => "82400", |
|
| 36 | - "route_name" => "updated " . date('m-d-Y') |
|
| 33 | + "member_id" => $randomRoute->member_id, |
|
| 34 | + "optimize" => "Distance", |
|
| 35 | + "route_max_duration" => "82400", |
|
| 36 | + "route_name" => "updated " . date('m-d-Y') |
|
| 37 | 37 | ); |
| 38 | 38 | |
| 39 | 39 | $route->httpheaders = 'Content-type: application/json'; |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Route4Me; |
| 3 | 3 | |
| 4 | -$root=realpath(dirname(__FILE__).'/../../'); |
|
| 4 | +$root = realpath(dirname(__FILE__).'/../../'); |
|
| 5 | 5 | require $root.'/vendor/autoload.php'; |
| 6 | 6 | |
| 7 | 7 | use Route4Me\Route4Me; |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | "member_id" => $randomRoute->member_id, |
| 34 | 34 | "optimize" => "Distance", |
| 35 | 35 | "route_max_duration" => "82400", |
| 36 | - "route_name" => "updated " . date('m-d-Y') |
|
| 36 | + "route_name" => "updated ".date('m-d-Y') |
|
| 37 | 37 | ); |
| 38 | 38 | |
| 39 | 39 | $route->httpheaders = 'Content-type: application/json'; |
@@ -23,23 +23,23 @@ |
||
| 23 | 23 | |
| 24 | 24 | // Get a route with the path points |
| 25 | 25 | $params = array( |
| 26 | - "route_path_output" => "Points", |
|
| 27 | - "compress_path_points" => TRUE |
|
| 26 | + "route_path_output" => "Points", |
|
| 27 | + "compress_path_points" => TRUE |
|
| 28 | 28 | ); |
| 29 | 29 | |
| 30 | 30 | $routeResults = (array)$route->getRoutePoints($route_id,$params); |
| 31 | 31 | |
| 32 | 32 | if (isset($routeResults['addresses'])) { |
| 33 | - foreach ($routeResults['addresses'] as $key => $address) { |
|
| 34 | - $araddress = (array)$address; |
|
| 33 | + foreach ($routeResults['addresses'] as $key => $address) { |
|
| 34 | + $araddress = (array)$address; |
|
| 35 | 35 | |
| 36 | - if (isset($araddress['route_destination_id'])) echo "route_destination_id=".$araddress['route_destination_id']."<br>"; |
|
| 36 | + if (isset($araddress['route_destination_id'])) echo "route_destination_id=".$araddress['route_destination_id']."<br>"; |
|
| 37 | 37 | |
| 38 | - if (isset($araddress['path_to_next'])) { |
|
| 39 | - echo "path_to_next:<br>"; |
|
| 40 | - Route4Me::simplePrint((array)$araddress['path_to_next']); |
|
| 41 | - } |
|
| 38 | + if (isset($araddress['path_to_next'])) { |
|
| 39 | + echo "path_to_next:<br>"; |
|
| 40 | + Route4Me::simplePrint((array)$araddress['path_to_next']); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - echo "<br>"; |
|
| 44 | - } |
|
| 43 | + echo "<br>"; |
|
| 44 | + } |
|
| 45 | 45 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Route4Me; |
| 3 | 3 | |
| 4 | -$root=realpath(dirname(__FILE__).'/../../'); |
|
| 4 | +$root = realpath(dirname(__FILE__).'/../../'); |
|
| 5 | 5 | require $root.'/vendor/autoload.php'; |
| 6 | 6 | |
| 7 | 7 | use Route4Me\Route4Me; |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | "compress_path_points" => TRUE |
| 28 | 28 | ); |
| 29 | 29 | |
| 30 | -$routeResults = (array)$route->getRoutePoints($route_id,$params); |
|
| 30 | +$routeResults = (array)$route->getRoutePoints($route_id, $params); |
|
| 31 | 31 | |
| 32 | 32 | if (isset($routeResults['addresses'])) { |
| 33 | 33 | foreach ($routeResults['addresses'] as $key => $address) { |
@@ -32,7 +32,9 @@ |
||
| 32 | 32 | foreach ($routeResults['addresses'] as $key => $address) { |
| 33 | 33 | $araddress = (array)$address; |
| 34 | 34 | |
| 35 | - if (isset($araddress['route_destination_id'])) echo "route_destination_id=".$araddress['route_destination_id']."<br>"; |
|
| 35 | + if (isset($araddress['route_destination_id'])) { |
|
| 36 | + echo "route_destination_id=".$araddress['route_destination_id']."<br>"; |
|
| 37 | + } |
|
| 36 | 38 | |
| 37 | 39 | if (isset($araddress['path_to_next'])) { |
| 38 | 40 | echo "path_to_next:<br>"; |
@@ -17,9 +17,9 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | // Select a terriotry with the addresses from the list |
| 19 | 19 | $params = array( |
| 20 | - "offset" => 0, |
|
| 21 | - "limit" => 50, |
|
| 22 | - "addresses" => 1 |
|
| 20 | + "offset" => 0, |
|
| 21 | + "limit" => 50, |
|
| 22 | + "addresses" => 1 |
|
| 23 | 23 | ); |
| 24 | 24 | |
| 25 | 25 | $results = $territory->getTerritories($params); |
@@ -28,12 +28,12 @@ discard block |
||
| 28 | 28 | $territory1 = null; |
| 29 | 29 | |
| 30 | 30 | foreach ($results as $terr) { |
| 31 | - if (isset($terr['addresses'])) { |
|
| 32 | - if (sizeof($terr['addresses'])>0) { |
|
| 33 | - $territory1 = $terr; |
|
| 34 | - break; |
|
| 35 | - } |
|
| 36 | - } |
|
| 31 | + if (isset($terr['addresses'])) { |
|
| 32 | + if (sizeof($terr['addresses'])>0) { |
|
| 33 | + $territory1 = $terr; |
|
| 34 | + break; |
|
| 35 | + } |
|
| 36 | + } |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | assert(isset($territory1['territory_id']), "Can't retrieve a random territory ID"); |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | // Get a territory with the addresses |
| 45 | 45 | $params = array( |
| 46 | - "territory_id" => $territory_id, |
|
| 47 | - "addresses" => 1 |
|
| 46 | + "territory_id" => $territory_id, |
|
| 47 | + "addresses" => 1 |
|
| 48 | 48 | ); |
| 49 | 49 | |
| 50 | 50 | $result1 = $territory->getTerritory($params); |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Route4Me; |
| 3 | 3 | |
| 4 | -$root=realpath(dirname(__FILE__).'/../../'); |
|
| 4 | +$root = realpath(dirname(__FILE__).'/../../'); |
|
| 5 | 5 | require $root.'/vendor/autoload.php'; |
| 6 | 6 | |
| 7 | 7 | use Route4Me\Route4Me; |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | // Set the api key in the Route4Me class |
| 14 | 14 | Route4Me::setApiKey('11111111111111111111111111111111'); |
| 15 | 15 | |
| 16 | -$territory=new Territory(); |
|
| 16 | +$territory = new Territory(); |
|
| 17 | 17 | |
| 18 | 18 | // Select a terriotry with the addresses from the list |
| 19 | 19 | $params = array( |
@@ -13,13 +13,13 @@ |
||
| 13 | 13 | $territory = new Territory(); |
| 14 | 14 | |
| 15 | 15 | $queryparameters = array ( |
| 16 | - "offset" => 0, |
|
| 17 | - "limit" => 20 |
|
| 16 | + "offset" => 0, |
|
| 17 | + "limit" => 20 |
|
| 18 | 18 | ); |
| 19 | 19 | |
| 20 | 20 | $response = $territory->getTerritories($queryparameters); |
| 21 | 21 | |
| 22 | 22 | foreach ($response as $terr1) { |
| 23 | 23 | Route4Me::simplePrint($terr1, true); |
| 24 | - echo "<br>"; |
|
| 24 | + echo "<br>"; |
|
| 25 | 25 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Route4Me; |
| 3 | 3 | |
| 4 | -$root=realpath(dirname(__FILE__).'/../../'); |
|
| 4 | +$root = realpath(dirname(__FILE__).'/../../'); |
|
| 5 | 5 | require $root.'/vendor/autoload.php'; |
| 6 | 6 | |
| 7 | 7 | use Route4Me\Route4Me; |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | $territory = new Territory(); |
| 14 | 14 | |
| 15 | -$queryparameters = array ( |
|
| 15 | +$queryparameters = array( |
|
| 16 | 16 | "offset" => 0, |
| 17 | 17 | "limit" => 20 |
| 18 | 18 | ); |
@@ -26,23 +26,23 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | $addresses = array(); |
| 28 | 28 | foreach($json as $address) { |
| 29 | - $addresses[] = Address::fromArray($address); |
|
| 29 | + $addresses[] = Address::fromArray($address); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | $parameters = RouteParameters::fromArray(array( |
| 33 | - "algorithm_type" => Algorithmtype::CVRP_TW_SD, |
|
| 34 | - "route_name" => "Multiple Depot, Multiple Driver, Time Window", |
|
| 35 | - "route_date" => time() + 24*60*60, |
|
| 36 | - "route_time" => 60 * 60 * 7, |
|
| 37 | - "rt" => TRUE, |
|
| 38 | - "distance_unit" => DistanceUnit::MILES, |
|
| 39 | - "device_type" => DeviceType::WEB, |
|
| 40 | - "optimize" => OptimizationType::TIME, |
|
| 41 | - "metric" => Metric::GEODESIC, |
|
| 42 | - "route_max_duration" => 86400 * 3, |
|
| 43 | - "travel_mode" => TravelMode::DRIVING, |
|
| 44 | - "vehicle_capacity" => 99, |
|
| 45 | - "vehicle_max_distance_mi" => 99999 |
|
| 33 | + "algorithm_type" => Algorithmtype::CVRP_TW_SD, |
|
| 34 | + "route_name" => "Multiple Depot, Multiple Driver, Time Window", |
|
| 35 | + "route_date" => time() + 24*60*60, |
|
| 36 | + "route_time" => 60 * 60 * 7, |
|
| 37 | + "rt" => TRUE, |
|
| 38 | + "distance_unit" => DistanceUnit::MILES, |
|
| 39 | + "device_type" => DeviceType::WEB, |
|
| 40 | + "optimize" => OptimizationType::TIME, |
|
| 41 | + "metric" => Metric::GEODESIC, |
|
| 42 | + "route_max_duration" => 86400 * 3, |
|
| 43 | + "travel_mode" => TravelMode::DRIVING, |
|
| 44 | + "vehicle_capacity" => 99, |
|
| 45 | + "vehicle_max_distance_mi" => 99999 |
|
| 46 | 46 | )); |
| 47 | 47 | |
| 48 | 48 | $optimizationParams = new OptimizationProblemParams; |
@@ -52,12 +52,12 @@ discard block |
||
| 52 | 52 | $problem = OptimizationProblem::optimize($optimizationParams); |
| 53 | 53 | |
| 54 | 54 | foreach ((array)$problem as $key => $value) { |
| 55 | - if (is_string($value)) { |
|
| 56 | - echo $key." --> ".$value."<br>"; |
|
| 57 | - } else { |
|
| 58 | - echo "************ $key ************* <br>"; |
|
| 59 | - Route4Me::simplePrint((array)$value, true); |
|
| 60 | - echo "******************************* <br>"; |
|
| 61 | - } |
|
| 55 | + if (is_string($value)) { |
|
| 56 | + echo $key." --> ".$value."<br>"; |
|
| 57 | + } else { |
|
| 58 | + echo "************ $key ************* <br>"; |
|
| 59 | + Route4Me::simplePrint((array)$value, true); |
|
| 60 | + echo "******************************* <br>"; |
|
| 61 | + } |
|
| 62 | 62 | } |
| 63 | 63 | |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Route4Me; |
| 3 | 3 | |
| 4 | -$root=realpath(dirname(__FILE__).'/../'); |
|
| 4 | +$root = realpath(dirname(__FILE__).'/../'); |
|
| 5 | 5 | require $root.'/vendor/autoload.php'; |
| 6 | 6 | |
| 7 | 7 | use Route4Me\Route4Me; |
@@ -25,14 +25,14 @@ discard block |
||
| 25 | 25 | $json = json_decode(file_get_contents('./addresses.json'), true); |
| 26 | 26 | |
| 27 | 27 | $addresses = array(); |
| 28 | -foreach($json as $address) { |
|
| 28 | +foreach ($json as $address) { |
|
| 29 | 29 | $addresses[] = Address::fromArray($address); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | $parameters = RouteParameters::fromArray(array( |
| 33 | 33 | "algorithm_type" => Algorithmtype::CVRP_TW_SD, |
| 34 | 34 | "route_name" => "Multiple Depot, Multiple Driver, Time Window", |
| 35 | - "route_date" => time() + 24*60*60, |
|
| 35 | + "route_date" => time() + 24 * 60 * 60, |
|
| 36 | 36 | "route_time" => 60 * 60 * 7, |
| 37 | 37 | "rt" => TRUE, |
| 38 | 38 | "distance_unit" => DistanceUnit::MILES, |
@@ -8,18 +8,18 @@ |
||
| 8 | 8 | |
| 9 | 9 | class Track extends Common |
| 10 | 10 | { |
| 11 | - public static function set(TrackSetParams $param) |
|
| 12 | - { |
|
| 13 | - $query = array_merge($param->toArray(), array( |
|
| 14 | - 'api_key' => Route4Me::getApiKey() |
|
| 15 | - )); |
|
| 11 | + public static function set(TrackSetParams $param) |
|
| 12 | + { |
|
| 13 | + $query = array_merge($param->toArray(), array( |
|
| 14 | + 'api_key' => Route4Me::getApiKey() |
|
| 15 | + )); |
|
| 16 | 16 | |
| 17 | - $json = Route4Me::makeRequst(array( |
|
| 18 | - 'url' => Endpoint::TRACK_SET, |
|
| 19 | - 'method' => 'GET', |
|
| 20 | - 'query' => $query |
|
| 21 | - )); |
|
| 17 | + $json = Route4Me::makeRequst(array( |
|
| 18 | + 'url' => Endpoint::TRACK_SET, |
|
| 19 | + 'method' => 'GET', |
|
| 20 | + 'query' => $query |
|
| 21 | + )); |
|
| 22 | 22 | |
| 23 | - return $json; |
|
| 24 | - } |
|
| 23 | + return $json; |
|
| 24 | + } |
|
| 25 | 25 | } |
@@ -6,141 +6,141 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Geocoding extends Common |
| 8 | 8 | { |
| 9 | - public $strExportFormat; |
|
| 10 | - public $format; |
|
| 11 | - public $addresses; |
|
| 12 | - public $pk; |
|
| 13 | - public $offset; |
|
| 14 | - public $limit; |
|
| 15 | - public $housenumber; |
|
| 16 | - public $zipcode; |
|
| 9 | + public $strExportFormat; |
|
| 10 | + public $format; |
|
| 11 | + public $addresses; |
|
| 12 | + public $pk; |
|
| 13 | + public $offset; |
|
| 14 | + public $limit; |
|
| 15 | + public $housenumber; |
|
| 16 | + public $zipcode; |
|
| 17 | 17 | |
| 18 | - public static function fromArray(array $params) |
|
| 19 | - { |
|
| 20 | - $geocoding = new Geocoding(); |
|
| 21 | - |
|
| 22 | - foreach($params as $key => $value) { |
|
| 23 | - if (property_exists($geocoding, $key)) { |
|
| 24 | - $geocoding->{$key} = $value; |
|
| 25 | - } |
|
| 26 | - } |
|
| 27 | - |
|
| 28 | - return $geocoding; |
|
| 29 | - } |
|
| 18 | + public static function fromArray(array $params) |
|
| 19 | + { |
|
| 20 | + $geocoding = new Geocoding(); |
|
| 21 | + |
|
| 22 | + foreach($params as $key => $value) { |
|
| 23 | + if (property_exists($geocoding, $key)) { |
|
| 24 | + $geocoding->{$key} = $value; |
|
| 25 | + } |
|
| 26 | + } |
|
| 27 | + |
|
| 28 | + return $geocoding; |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - public static function forwardGeocoding($params) |
|
| 32 | - { |
|
| 33 | - $body = array( |
|
| 34 | - 'strExportFormat' => isset($params['strExportFormat']) ? $params['strExportFormat']: null, |
|
| 35 | - 'addresses' => isset($params['addresses']) ? $params['addresses'] : null, |
|
| 36 | - ); |
|
| 31 | + public static function forwardGeocoding($params) |
|
| 32 | + { |
|
| 33 | + $body = array( |
|
| 34 | + 'strExportFormat' => isset($params['strExportFormat']) ? $params['strExportFormat']: null, |
|
| 35 | + 'addresses' => isset($params['addresses']) ? $params['addresses'] : null, |
|
| 36 | + ); |
|
| 37 | 37 | |
| 38 | - $fgCoding = Route4Me::makeRequst(array( |
|
| 39 | - 'url' => Endpoint::GEOCODER, |
|
| 40 | - 'method' => 'POST', |
|
| 41 | - 'body' => $body, |
|
| 42 | - 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
| 43 | - )); |
|
| 44 | - |
|
| 45 | - return $fgCoding; |
|
| 46 | - } |
|
| 38 | + $fgCoding = Route4Me::makeRequst(array( |
|
| 39 | + 'url' => Endpoint::GEOCODER, |
|
| 40 | + 'method' => 'POST', |
|
| 41 | + 'body' => $body, |
|
| 42 | + 'HTTPHEADER' => 'Content-Type: multipart/form-data' |
|
| 43 | + )); |
|
| 44 | + |
|
| 45 | + return $fgCoding; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - public static function reverseGeocoding($params) |
|
| 49 | - { |
|
| 50 | - $query = array( |
|
| 51 | - 'format' => isset($params['format']) ? $params['format']: null, |
|
| 52 | - 'addresses' => isset($params['addresses']) ? $params['addresses'] : null, |
|
| 53 | - 'detailed' => isset($params['detailed']) ? $params['detailed'] : null, |
|
| 54 | - ); |
|
| 48 | + public static function reverseGeocoding($params) |
|
| 49 | + { |
|
| 50 | + $query = array( |
|
| 51 | + 'format' => isset($params['format']) ? $params['format']: null, |
|
| 52 | + 'addresses' => isset($params['addresses']) ? $params['addresses'] : null, |
|
| 53 | + 'detailed' => isset($params['detailed']) ? $params['detailed'] : null, |
|
| 54 | + ); |
|
| 55 | 55 | |
| 56 | - $fgcoding = Route4Me::makeRequst(array( |
|
| 57 | - 'url' => Endpoint::GEOCODER, |
|
| 58 | - 'method' => 'POST', |
|
| 59 | - 'query' => $query |
|
| 60 | - )); |
|
| 61 | - |
|
| 62 | - return $fgcoding; |
|
| 63 | - } |
|
| 56 | + $fgcoding = Route4Me::makeRequst(array( |
|
| 57 | + 'url' => Endpoint::GEOCODER, |
|
| 58 | + 'method' => 'POST', |
|
| 59 | + 'query' => $query |
|
| 60 | + )); |
|
| 61 | + |
|
| 62 | + return $fgcoding; |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - public static function getStreetData($params) |
|
| 66 | - { |
|
| 67 | - $url_query = Endpoint::STREET_DATA; |
|
| 65 | + public static function getStreetData($params) |
|
| 66 | + { |
|
| 67 | + $url_query = Endpoint::STREET_DATA; |
|
| 68 | 68 | |
| 69 | - if (isset($params['pk'])) { |
|
| 70 | - $url_query.=$params['pk'].'/'; |
|
| 71 | - } |
|
| 69 | + if (isset($params['pk'])) { |
|
| 70 | + $url_query.=$params['pk'].'/'; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - if (isset($params['offset'])) { |
|
| 74 | - $url_query.=$params['offset'].'/'; |
|
| 75 | - } |
|
| 73 | + if (isset($params['offset'])) { |
|
| 74 | + $url_query.=$params['offset'].'/'; |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - if (isset($params['limit'])) { |
|
| 78 | - $url_query.=$params['limit'].'/'; |
|
| 79 | - } |
|
| 77 | + if (isset($params['limit'])) { |
|
| 78 | + $url_query.=$params['limit'].'/'; |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - $query = array(); |
|
| 81 | + $query = array(); |
|
| 82 | 82 | |
| 83 | - $response = Route4Me::makeUrlRequst($url_query, array( |
|
| 84 | - 'method' => 'GET', |
|
| 85 | - 'query' => $query |
|
| 86 | - )); |
|
| 83 | + $response = Route4Me::makeUrlRequst($url_query, array( |
|
| 84 | + 'method' => 'GET', |
|
| 85 | + 'query' => $query |
|
| 86 | + )); |
|
| 87 | 87 | |
| 88 | - return $response; |
|
| 89 | - } |
|
| 88 | + return $response; |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - public static function getZipCode($params) |
|
| 92 | - { |
|
| 93 | - $url_query = Endpoint::STREET_DATA_ZIPCODE; |
|
| 91 | + public static function getZipCode($params) |
|
| 92 | + { |
|
| 93 | + $url_query = Endpoint::STREET_DATA_ZIPCODE; |
|
| 94 | 94 | |
| 95 | - if (isset($params['zipcode'])) { |
|
| 96 | - $url_query.=$params['zipcode'].'/'; |
|
| 97 | - } |
|
| 95 | + if (isset($params['zipcode'])) { |
|
| 96 | + $url_query.=$params['zipcode'].'/'; |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - if (isset($params['offset'])) { |
|
| 100 | - $url_query.=$params['offset'].'/'; |
|
| 101 | - } |
|
| 99 | + if (isset($params['offset'])) { |
|
| 100 | + $url_query.=$params['offset'].'/'; |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | - if (isset($params['limit'])) { |
|
| 104 | - $url_query.=$params['limit'].'/'; |
|
| 105 | - } |
|
| 103 | + if (isset($params['limit'])) { |
|
| 104 | + $url_query.=$params['limit'].'/'; |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | - $query = array(); |
|
| 107 | + $query = array(); |
|
| 108 | 108 | |
| 109 | - $response = Route4Me::makeUrlRequst($url_query, array( |
|
| 110 | - 'method' => 'GET', |
|
| 111 | - 'query' => $query |
|
| 112 | - )); |
|
| 109 | + $response = Route4Me::makeUrlRequst($url_query, array( |
|
| 110 | + 'method' => 'GET', |
|
| 111 | + 'query' => $query |
|
| 112 | + )); |
|
| 113 | 113 | |
| 114 | - return $response; |
|
| 115 | - } |
|
| 114 | + return $response; |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - public static function getService($params) |
|
| 118 | - { |
|
| 119 | - $url_query = Endpoint::STREET_DATA_SERVICE; |
|
| 117 | + public static function getService($params) |
|
| 118 | + { |
|
| 119 | + $url_query = Endpoint::STREET_DATA_SERVICE; |
|
| 120 | 120 | |
| 121 | - if (isset($params['zipcode'])) { |
|
| 122 | - $url_query.=$params['zipcode'].'/'; |
|
| 123 | - } |
|
| 121 | + if (isset($params['zipcode'])) { |
|
| 122 | + $url_query.=$params['zipcode'].'/'; |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - if (isset($params['housenumber'])) { |
|
| 126 | - $url_query.=$params['housenumber'].'/'; |
|
| 127 | - } |
|
| 125 | + if (isset($params['housenumber'])) { |
|
| 126 | + $url_query.=$params['housenumber'].'/'; |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | - if (isset($params['offset'])) { |
|
| 130 | - $url_query.=$params['offset'].'/'; |
|
| 131 | - } |
|
| 129 | + if (isset($params['offset'])) { |
|
| 130 | + $url_query.=$params['offset'].'/'; |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | - if (isset($params['limit'])) { |
|
| 134 | - $url_query.=$params['limit'].'/'; |
|
| 135 | - } |
|
| 133 | + if (isset($params['limit'])) { |
|
| 134 | + $url_query.=$params['limit'].'/'; |
|
| 135 | + } |
|
| 136 | 136 | |
| 137 | - $query = array(); |
|
| 137 | + $query = array(); |
|
| 138 | 138 | |
| 139 | - $response = Route4Me::makeUrlRequst($url_query, array( |
|
| 140 | - 'method' => 'GET', |
|
| 141 | - 'query' => $query |
|
| 142 | - )); |
|
| 139 | + $response = Route4Me::makeUrlRequst($url_query, array( |
|
| 140 | + 'method' => 'GET', |
|
| 141 | + 'query' => $query |
|
| 142 | + )); |
|
| 143 | 143 | |
| 144 | - return $response; |
|
| 145 | - } |
|
| 144 | + return $response; |
|
| 145 | + } |
|
| 146 | 146 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | { |
| 20 | 20 | $geocoding = new Geocoding(); |
| 21 | 21 | |
| 22 | - foreach($params as $key => $value) { |
|
| 22 | + foreach ($params as $key => $value) { |
|
| 23 | 23 | if (property_exists($geocoding, $key)) { |
| 24 | 24 | $geocoding->{$key} = $value; |
| 25 | 25 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | public static function forwardGeocoding($params) |
| 32 | 32 | { |
| 33 | 33 | $body = array( |
| 34 | - 'strExportFormat' => isset($params['strExportFormat']) ? $params['strExportFormat']: null, |
|
| 34 | + 'strExportFormat' => isset($params['strExportFormat']) ? $params['strExportFormat'] : null, |
|
| 35 | 35 | 'addresses' => isset($params['addresses']) ? $params['addresses'] : null, |
| 36 | 36 | ); |
| 37 | 37 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | public static function reverseGeocoding($params) |
| 49 | 49 | { |
| 50 | 50 | $query = array( |
| 51 | - 'format' => isset($params['format']) ? $params['format']: null, |
|
| 51 | + 'format' => isset($params['format']) ? $params['format'] : null, |
|
| 52 | 52 | 'addresses' => isset($params['addresses']) ? $params['addresses'] : null, |
| 53 | 53 | 'detailed' => isset($params['detailed']) ? $params['detailed'] : null, |
| 54 | 54 | ); |
@@ -67,15 +67,15 @@ discard block |
||
| 67 | 67 | $url_query = Endpoint::STREET_DATA; |
| 68 | 68 | |
| 69 | 69 | if (isset($params['pk'])) { |
| 70 | - $url_query.=$params['pk'].'/'; |
|
| 70 | + $url_query .= $params['pk'].'/'; |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | if (isset($params['offset'])) { |
| 74 | - $url_query.=$params['offset'].'/'; |
|
| 74 | + $url_query .= $params['offset'].'/'; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | if (isset($params['limit'])) { |
| 78 | - $url_query.=$params['limit'].'/'; |
|
| 78 | + $url_query .= $params['limit'].'/'; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | $query = array(); |
@@ -93,15 +93,15 @@ discard block |
||
| 93 | 93 | $url_query = Endpoint::STREET_DATA_ZIPCODE; |
| 94 | 94 | |
| 95 | 95 | if (isset($params['zipcode'])) { |
| 96 | - $url_query.=$params['zipcode'].'/'; |
|
| 96 | + $url_query .= $params['zipcode'].'/'; |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | if (isset($params['offset'])) { |
| 100 | - $url_query.=$params['offset'].'/'; |
|
| 100 | + $url_query .= $params['offset'].'/'; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | if (isset($params['limit'])) { |
| 104 | - $url_query.=$params['limit'].'/'; |
|
| 104 | + $url_query .= $params['limit'].'/'; |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | $query = array(); |
@@ -119,19 +119,19 @@ discard block |
||
| 119 | 119 | $url_query = Endpoint::STREET_DATA_SERVICE; |
| 120 | 120 | |
| 121 | 121 | if (isset($params['zipcode'])) { |
| 122 | - $url_query.=$params['zipcode'].'/'; |
|
| 122 | + $url_query .= $params['zipcode'].'/'; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (isset($params['housenumber'])) { |
| 126 | - $url_query.=$params['housenumber'].'/'; |
|
| 126 | + $url_query .= $params['housenumber'].'/'; |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (isset($params['offset'])) { |
| 130 | - $url_query.=$params['offset'].'/'; |
|
| 130 | + $url_query .= $params['offset'].'/'; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (isset($params['limit'])) { |
| 134 | - $url_query.=$params['limit'].'/'; |
|
| 134 | + $url_query .= $params['limit'].'/'; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | $query = array(); |
@@ -6,88 +6,88 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ActivityParameters extends Common |
| 8 | 8 | { |
| 9 | - public $route_id; |
|
| 10 | - public $device_id; |
|
| 11 | - public $member_id; |
|
| 12 | - public $team; |
|
| 13 | - public $limit; |
|
| 14 | - public $offset; |
|
| 15 | - public $start; |
|
| 16 | - public $end; |
|
| 17 | - public $activity_type; |
|
| 18 | - public $activity_message; |
|
| 9 | + public $route_id; |
|
| 10 | + public $device_id; |
|
| 11 | + public $member_id; |
|
| 12 | + public $team; |
|
| 13 | + public $limit; |
|
| 14 | + public $offset; |
|
| 15 | + public $start; |
|
| 16 | + public $end; |
|
| 17 | + public $activity_type; |
|
| 18 | + public $activity_message; |
|
| 19 | 19 | |
| 20 | - public $activity_id; |
|
| 21 | - public $activity_timestamp; |
|
| 22 | - public $route_destination_id; |
|
| 23 | - public $note_id; |
|
| 24 | - public $member; |
|
| 25 | - public $note_type; |
|
| 26 | - public $note_contents; |
|
| 27 | - public $route_name; |
|
| 28 | - public $note_file; |
|
| 29 | - public $destination_name; |
|
| 30 | - public $destination_alias; |
|
| 20 | + public $activity_id; |
|
| 21 | + public $activity_timestamp; |
|
| 22 | + public $route_destination_id; |
|
| 23 | + public $note_id; |
|
| 24 | + public $member; |
|
| 25 | + public $note_type; |
|
| 26 | + public $note_contents; |
|
| 27 | + public $route_name; |
|
| 28 | + public $note_file; |
|
| 29 | + public $destination_name; |
|
| 30 | + public $destination_alias; |
|
| 31 | 31 | |
| 32 | - public static function fromArray(array $params) |
|
| 33 | - { |
|
| 34 | - $activityparameters = new ActivityParameters(); |
|
| 32 | + public static function fromArray(array $params) |
|
| 33 | + { |
|
| 34 | + $activityparameters = new ActivityParameters(); |
|
| 35 | 35 | |
| 36 | - foreach($params as $key => $value) { |
|
| 37 | - if (property_exists($activityparameters, $key)) { |
|
| 38 | - $activityparameters->{$key} = $value; |
|
| 39 | - } |
|
| 40 | - } |
|
| 36 | + foreach($params as $key => $value) { |
|
| 37 | + if (property_exists($activityparameters, $key)) { |
|
| 38 | + $activityparameters->{$key} = $value; |
|
| 39 | + } |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - return $activityparameters; |
|
| 43 | - } |
|
| 42 | + return $activityparameters; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - public static function get($params) |
|
| 46 | - { |
|
| 47 | - $activity = Route4Me::makeRequst(array( |
|
| 48 | - 'url' => Endpoint::GET_ACTIVITIES, |
|
| 49 | - 'method' => 'GET', |
|
| 50 | - 'query' => array( |
|
| 51 | - 'route_id' => isset($params->route_id) ? $params->route_id : null, |
|
| 52 | - 'team' => isset($params->team) ? $params->team : null, |
|
| 53 | - 'limit' => isset($params->limit) ? $params->limit : null, |
|
| 54 | - 'offset' => isset($params->offset) ? $params->offset : null, |
|
| 55 | - 'start' => isset($params->start) ? $params->start : null, |
|
| 56 | - ) |
|
| 57 | - )); |
|
| 45 | + public static function get($params) |
|
| 46 | + { |
|
| 47 | + $activity = Route4Me::makeRequst(array( |
|
| 48 | + 'url' => Endpoint::GET_ACTIVITIES, |
|
| 49 | + 'method' => 'GET', |
|
| 50 | + 'query' => array( |
|
| 51 | + 'route_id' => isset($params->route_id) ? $params->route_id : null, |
|
| 52 | + 'team' => isset($params->team) ? $params->team : null, |
|
| 53 | + 'limit' => isset($params->limit) ? $params->limit : null, |
|
| 54 | + 'offset' => isset($params->offset) ? $params->offset : null, |
|
| 55 | + 'start' => isset($params->start) ? $params->start : null, |
|
| 56 | + ) |
|
| 57 | + )); |
|
| 58 | 58 | |
| 59 | - return $activity; |
|
| 60 | - } |
|
| 59 | + return $activity; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - public static function searcActivities($params) |
|
| 63 | - { |
|
| 64 | - $activity = Route4Me::makeRequst(array( |
|
| 65 | - 'url' => Endpoint::GET_ACTIVITIES, |
|
| 66 | - 'method' => 'GET', |
|
| 67 | - 'query' => array( |
|
| 68 | - 'route_id' => isset($params->route_id) ? $params->route_id : null, |
|
| 69 | - 'limit' => isset($params->limit) ? $params->limit : null, |
|
| 70 | - 'offset' => isset($params->offset) ? $params->offset : null, |
|
| 71 | - 'activity_type' => isset($params->activity_type) ? $params->activity_type : null, |
|
| 72 | - ) |
|
| 73 | - )); |
|
| 62 | + public static function searcActivities($params) |
|
| 63 | + { |
|
| 64 | + $activity = Route4Me::makeRequst(array( |
|
| 65 | + 'url' => Endpoint::GET_ACTIVITIES, |
|
| 66 | + 'method' => 'GET', |
|
| 67 | + 'query' => array( |
|
| 68 | + 'route_id' => isset($params->route_id) ? $params->route_id : null, |
|
| 69 | + 'limit' => isset($params->limit) ? $params->limit : null, |
|
| 70 | + 'offset' => isset($params->offset) ? $params->offset : null, |
|
| 71 | + 'activity_type' => isset($params->activity_type) ? $params->activity_type : null, |
|
| 72 | + ) |
|
| 73 | + )); |
|
| 74 | 74 | |
| 75 | - return $activity; |
|
| 76 | - } |
|
| 75 | + return $activity; |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - public static function sendUserMessage($postParameters) |
|
| 79 | - { |
|
| 80 | - $result = Route4Me::makeRequst(array( |
|
| 81 | - 'url' => Endpoint::ACTIVITY_FEED, |
|
| 82 | - 'method' => 'POST', |
|
| 83 | - 'body' => array( |
|
| 84 | - 'activity_type' => isset($postParameters->activity_type) ? $postParameters->activity_type : null, |
|
| 85 | - 'activity_message' => isset($postParameters->activity_message) ? $postParameters->activity_message : null, |
|
| 86 | - 'route_id' => isset($postParameters->route_id) ? $postParameters->route_id : null, |
|
| 87 | - ) |
|
| 88 | - )); |
|
| 78 | + public static function sendUserMessage($postParameters) |
|
| 79 | + { |
|
| 80 | + $result = Route4Me::makeRequst(array( |
|
| 81 | + 'url' => Endpoint::ACTIVITY_FEED, |
|
| 82 | + 'method' => 'POST', |
|
| 83 | + 'body' => array( |
|
| 84 | + 'activity_type' => isset($postParameters->activity_type) ? $postParameters->activity_type : null, |
|
| 85 | + 'activity_message' => isset($postParameters->activity_message) ? $postParameters->activity_message : null, |
|
| 86 | + 'route_id' => isset($postParameters->route_id) ? $postParameters->route_id : null, |
|
| 87 | + ) |
|
| 88 | + )); |
|
| 89 | 89 | |
| 90 | - return $result; |
|
| 91 | - } |
|
| 90 | + return $result; |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | 93 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | { |
| 34 | 34 | $activityparameters = new ActivityParameters(); |
| 35 | 35 | |
| 36 | - foreach($params as $key => $value) { |
|
| 36 | + foreach ($params as $key => $value) { |
|
| 37 | 37 | if (property_exists($activityparameters, $key)) { |
| 38 | 38 | $activityparameters->{$key} = $value; |
| 39 | 39 | } |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | class Territory extends Common |
| 9 | 9 | { |
| 10 | - public $territory_id; // Territory id |
|
| 10 | + public $territory_id; // Territory id |
|
| 11 | 11 | public $territory_name; |
| 12 | 12 | public $territory_color; |
| 13 | 13 | public $addresses; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | $territoryparameters = new Territory(); |
| 31 | 31 | |
| 32 | - foreach($params as $key => $value) { |
|
| 32 | + foreach ($params as $key => $value) { |
|
| 33 | 33 | if (property_exists($territoryparameters, $key)) { |
| 34 | 34 | $territoryparameters->{$key} = $value; |
| 35 | 35 | } |
@@ -69,10 +69,10 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | public static function addTerritory($params) |
| 71 | 71 | { |
| 72 | - $terParams = array(); |
|
| 72 | + $terParams = array(); |
|
| 73 | 73 | |
| 74 | - if (isset($params->territory['type'])) $terParams['type'] = $params->territory['type']; |
|
| 75 | - if (isset($params->territory['data'])) $terParams['data'] = $params->territory['data']; |
|
| 74 | + if (isset($params->territory['type'])) $terParams['type'] = $params->territory['type']; |
|
| 75 | + if (isset($params->territory['data'])) $terParams['data'] = $params->territory['data']; |
|
| 76 | 76 | |
| 77 | 77 | $response = Route4Me::makeRequst(array( |
| 78 | 78 | 'url' => Endpoint::TERRITORY_V4, |
@@ -102,19 +102,19 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | public function updateTerritory($params) |
| 104 | 104 | { |
| 105 | - //var_dump($params); die(""); |
|
| 105 | + //var_dump($params); die(""); |
|
| 106 | 106 | $response = Route4Me::makeRequst(array( |
| 107 | 107 | 'url' => Endpoint::TERRITORY_V4, |
| 108 | 108 | 'method' => 'PUT', |
| 109 | 109 | 'query' => array( |
| 110 | - 'territory_id' => isset($params->territory_id) ? $params->territory_id : null |
|
| 111 | - ), |
|
| 112 | - 'body' => array( |
|
| 113 | - 'territory_name' => isset($params->territory_name) ? $params->territory_name : null, |
|
| 114 | - 'member_id' => isset($params->member_id) ? $params->member_id : null, |
|
| 115 | - 'territory_color' => isset($params->territory_color) ? $params->territory_color : null, |
|
| 116 | - 'territory' => isset($params->territory) ? $params->territory : null |
|
| 117 | - ) |
|
| 110 | + 'territory_id' => isset($params->territory_id) ? $params->territory_id : null |
|
| 111 | + ), |
|
| 112 | + 'body' => array( |
|
| 113 | + 'territory_name' => isset($params->territory_name) ? $params->territory_name : null, |
|
| 114 | + 'member_id' => isset($params->member_id) ? $params->member_id : null, |
|
| 115 | + 'territory_color' => isset($params->territory_color) ? $params->territory_color : null, |
|
| 116 | + 'territory' => isset($params->territory) ? $params->territory : null |
|
| 117 | + ) |
|
| 118 | 118 | |
| 119 | 119 | )); |
| 120 | 120 | |
@@ -71,8 +71,12 @@ |
||
| 71 | 71 | { |
| 72 | 72 | $terParams = array(); |
| 73 | 73 | |
| 74 | - if (isset($params->territory['type'])) $terParams['type'] = $params->territory['type']; |
|
| 75 | - if (isset($params->territory['data'])) $terParams['data'] = $params->territory['data']; |
|
| 74 | + if (isset($params->territory['type'])) { |
|
| 75 | + $terParams['type'] = $params->territory['type']; |
|
| 76 | + } |
|
| 77 | + if (isset($params->territory['data'])) { |
|
| 78 | + $terParams['data'] = $params->territory['data']; |
|
| 79 | + } |
|
| 76 | 80 | |
| 77 | 81 | $response = Route4Me::makeRequst(array( |
| 78 | 82 | 'url' => Endpoint::TERRITORY_V4, |