@@ -22,20 +22,20 @@ |
||
| 22 | 22 | |
| 23 | 23 | $addresses = array(); |
| 24 | 24 | foreach($json as $address) { |
| 25 | - $addresses[] = Address::fromArray($address); |
|
| 25 | + $addresses[] = Address::fromArray($address); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | $parameters = RouteParameters::fromArray(array( |
| 29 | - "algorithm_type" => AlgorithmType::CVRP_TW_SD, |
|
| 30 | - "distance_unit" => DistanceUnit::MILES, |
|
| 31 | - "device_type" => DeviceType::WEB, |
|
| 32 | - "optimize" => OptimizationType::DISTANCE, |
|
| 33 | - "metric" => Metric::GEODESIC, |
|
| 34 | - "route_max_duration" => 86400 * 2, |
|
| 35 | - "travel_mode" => TravelMode::DRIVING, |
|
| 36 | - "vehicle_capacity" => 50, |
|
| 37 | - "vehicle_max_distance_mi" => 10000, |
|
| 38 | - "parts" => 50 |
|
| 29 | + "algorithm_type" => AlgorithmType::CVRP_TW_SD, |
|
| 30 | + "distance_unit" => DistanceUnit::MILES, |
|
| 31 | + "device_type" => DeviceType::WEB, |
|
| 32 | + "optimize" => OptimizationType::DISTANCE, |
|
| 33 | + "metric" => Metric::GEODESIC, |
|
| 34 | + "route_max_duration" => 86400 * 2, |
|
| 35 | + "travel_mode" => TravelMode::DRIVING, |
|
| 36 | + "vehicle_capacity" => 50, |
|
| 37 | + "vehicle_max_distance_mi" => 10000, |
|
| 38 | + "parts" => 50 |
|
| 39 | 39 | )); |
| 40 | 40 | |
| 41 | 41 | $optimizationParams = new OptimizationProblemParams; |
@@ -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,7 +25,7 @@ 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 | |
@@ -23,18 +23,18 @@ |
||
| 23 | 23 | |
| 24 | 24 | $addresses = array(); |
| 25 | 25 | foreach($json as $address) { |
| 26 | - $addresses[] = Address::fromArray($address); |
|
| 26 | + $addresses[] = Address::fromArray($address); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | $parameters = RouteParameters::fromArray(array( |
| 30 | - "algorithm_type" => AlgorithmType::TSP, |
|
| 31 | - "distance_unit" => DistanceUnit::MILES, |
|
| 32 | - "device_type" => DeviceType::WEB, |
|
| 33 | - "optimize" => OptimizationType::DISTANCE, |
|
| 34 | - "travel_mode" => TravelMode::DRIVING, |
|
| 35 | - "route_max_duration" => 86400, |
|
| 36 | - "vehicle_capacity" => 1, |
|
| 37 | - "vehicle_max_distance_mi" => 10000 |
|
| 30 | + "algorithm_type" => AlgorithmType::TSP, |
|
| 31 | + "distance_unit" => DistanceUnit::MILES, |
|
| 32 | + "device_type" => DeviceType::WEB, |
|
| 33 | + "optimize" => OptimizationType::DISTANCE, |
|
| 34 | + "travel_mode" => TravelMode::DRIVING, |
|
| 35 | + "route_max_duration" => 86400, |
|
| 36 | + "vehicle_capacity" => 1, |
|
| 37 | + "vehicle_max_distance_mi" => 10000 |
|
| 38 | 38 | )); |
| 39 | 39 | |
| 40 | 40 | $optimizationParams = new OptimizationProblemParams; |
@@ -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,7 +25,7 @@ discard block |
||
| 25 | 25 | $json = array_slice($json, 0, 10); |
| 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 | |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Avoidance |
| 6 | 6 | { |
| 7 | - const HIGHWAYS = 'Highways'; |
|
| 8 | - const TOLLS = 'Tolls'; |
|
| 9 | - const MINIMIZE_HIGHWAYS = 'minimizeHighways'; |
|
| 10 | - const MINIMIZE_TOLLS = 'minimizeTolls'; |
|
| 7 | + const HIGHWAYS = 'Highways'; |
|
| 8 | + const TOLLS = 'Tolls'; |
|
| 9 | + const MINIMIZE_HIGHWAYS = 'minimizeHighways'; |
|
| 10 | + const MINIMIZE_TOLLS = 'minimizeTolls'; |
|
| 11 | 11 | } |
@@ -4,6 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | class DistanceUnit |
| 6 | 6 | { |
| 7 | - const MILES = 'mi'; |
|
| 8 | - const KILOMETERS = 'km'; |
|
| 7 | + const MILES = 'mi'; |
|
| 8 | + const KILOMETERS = 'km'; |
|
| 9 | 9 | } |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Format |
| 6 | 6 | { |
| 7 | - const SERIALIZED = 'serialized'; |
|
| 8 | - const CSV = 'csv'; |
|
| 9 | - const XML = 'xml'; |
|
| 10 | - const JSON = 'json'; |
|
| 7 | + const SERIALIZED = 'serialized'; |
|
| 8 | + const CSV = 'csv'; |
|
| 9 | + const XML = 'xml'; |
|
| 10 | + const JSON = 'json'; |
|
| 11 | 11 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | public function toArray() |
| 13 | 13 | { |
| 14 | 14 | $params = array_filter(get_object_vars($this), function($item) { |
| 15 | - return ($item !== null) && !(is_array($item) && !count($item)); |
|
| 15 | + return ($item!==null) && !(is_array($item) && !count($item)); |
|
| 16 | 16 | }); |
| 17 | 17 | |
| 18 | 18 | return $params; |
@@ -4,17 +4,17 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Common |
| 6 | 6 | { |
| 7 | - public static function getValue($array, $item, $default = null) |
|
| 8 | - { |
|
| 9 | - return (isset($array[$item])) ? $array[$item] : $default; |
|
| 10 | - } |
|
| 7 | + public static function getValue($array, $item, $default = null) |
|
| 8 | + { |
|
| 9 | + return (isset($array[$item])) ? $array[$item] : $default; |
|
| 10 | + } |
|
| 11 | 11 | |
| 12 | - public function toArray() |
|
| 13 | - { |
|
| 14 | - $params = array_filter(get_object_vars($this), function($item) { |
|
| 15 | - return ($item !== null) && !(is_array($item) && !count($item)); |
|
| 16 | - }); |
|
| 12 | + public function toArray() |
|
| 13 | + { |
|
| 14 | + $params = array_filter(get_object_vars($this), function($item) { |
|
| 15 | + return ($item !== null) && !(is_array($item) && !count($item)); |
|
| 16 | + }); |
|
| 17 | 17 | |
| 18 | - return $params; |
|
| 19 | - } |
|
| 18 | + return $params; |
|
| 19 | + } |
|
| 20 | 20 | } |
@@ -9,102 +9,102 @@ |
||
| 9 | 9 | |
| 10 | 10 | class TrackSetParams extends Common |
| 11 | 11 | { |
| 12 | - public $format; |
|
| 13 | - public $member_id; |
|
| 14 | - public $route_id; |
|
| 15 | - public $tx_id; |
|
| 16 | - public $vehicle_id; |
|
| 17 | - public $course; |
|
| 18 | - public $speed; |
|
| 19 | - public $lat; |
|
| 20 | - public $lng; |
|
| 21 | - public $altitude; |
|
| 22 | - public $device_type; |
|
| 23 | - public $device_guid; |
|
| 24 | - public $device_timestamp; |
|
| 25 | - public $app_version; |
|
| 26 | - |
|
| 27 | - public static function fromArray(array $params) |
|
| 28 | - { |
|
| 29 | - $param = new TrackSetParams; |
|
| 30 | - |
|
| 31 | - if (!isset($params['format'])) { |
|
| 32 | - throw new BadParam("format must be provided."); |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - $types = array( |
|
| 36 | - Format::SERIALIZED, |
|
| 37 | - Format::CSV, |
|
| 38 | - Format::XML |
|
| 39 | - ); |
|
| 40 | - if (!in_array($params['format'], $types)) { |
|
| 41 | - throw new BadParam("format is invalid."); |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - if (!isset($params['route_id'])) { |
|
| 45 | - throw new BadParam("route_id must be provided."); |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - if (!isset($params['member_id'])) { |
|
| 49 | - throw new BadParam("member_id must be provided."); |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - if (!isset($params['course'])) { |
|
| 53 | - throw new BadParam("course must be provided."); |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - if (!isset($params['speed'])) { |
|
| 57 | - throw new BadParam("speed must be provided."); |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - if (!isset($params['lat'])) { |
|
| 61 | - throw new BadParam("lat must be provided."); |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - if (!isset($params['lng'])) { |
|
| 65 | - throw new BadParam("lng must be provided."); |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - if (!isset($params['device_type'])) { |
|
| 69 | - throw new BadParam("device_type must be provided."); |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - $deviceTypes = array( |
|
| 73 | - DeviceType::IPHONE, |
|
| 74 | - DeviceType::IPAD, |
|
| 75 | - DeviceType::ANDROID_PHONE, |
|
| 76 | - DeviceType::ANDROID_TABLET |
|
| 77 | - ); |
|
| 78 | - if (!in_array($params['device_type'], $deviceTypes)) { |
|
| 79 | - throw new BadParam("device_type is invalid."); |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - if (!isset($params['device_guid'])) { |
|
| 83 | - throw new BadParam("device_guid must be provided."); |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - if (isset($params['device_timestamp'])) { |
|
| 87 | - $template = '/[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/i'; |
|
| 88 | - if (!preg_match($template, $params['device_timestamp'])) { |
|
| 89 | - throw new BadParam("device_timestamp is invalid."); |
|
| 90 | - } |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - $param->format = self::getValue($params, 'format'); |
|
| 94 | - $param->route_id = self::getValue($params, 'route_id'); |
|
| 95 | - $param->member_id = self::getValue($params, 'member_id'); |
|
| 96 | - $param->course = self::getValue($params, 'course'); |
|
| 97 | - $param->speed = self::getValue($params, 'speed'); |
|
| 98 | - $param->lat = self::getValue($params, 'lat'); |
|
| 99 | - $param->lng = self::getValue($params, 'lng'); |
|
| 100 | - $param->device_type = self::getValue($params, 'device_type'); |
|
| 101 | - $param->device_guid = self::getValue($params, 'device_guid'); |
|
| 102 | - $param->device_timestamp = self::getValue($params, 'device_timestamp'); |
|
| 103 | - $param->vehicle_id = self::getValue($params, 'vehicle_id'); |
|
| 104 | - $param->altitude = self::getValue($params, 'altitude'); |
|
| 105 | - $param->app_version = self::getValue($params, 'app_version'); |
|
| 106 | - $param->tx_id = self::getValue($params, 'tx_id'); |
|
| 107 | - |
|
| 108 | - return $param; |
|
| 109 | - } |
|
| 12 | + public $format; |
|
| 13 | + public $member_id; |
|
| 14 | + public $route_id; |
|
| 15 | + public $tx_id; |
|
| 16 | + public $vehicle_id; |
|
| 17 | + public $course; |
|
| 18 | + public $speed; |
|
| 19 | + public $lat; |
|
| 20 | + public $lng; |
|
| 21 | + public $altitude; |
|
| 22 | + public $device_type; |
|
| 23 | + public $device_guid; |
|
| 24 | + public $device_timestamp; |
|
| 25 | + public $app_version; |
|
| 26 | + |
|
| 27 | + public static function fromArray(array $params) |
|
| 28 | + { |
|
| 29 | + $param = new TrackSetParams; |
|
| 30 | + |
|
| 31 | + if (!isset($params['format'])) { |
|
| 32 | + throw new BadParam("format must be provided."); |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + $types = array( |
|
| 36 | + Format::SERIALIZED, |
|
| 37 | + Format::CSV, |
|
| 38 | + Format::XML |
|
| 39 | + ); |
|
| 40 | + if (!in_array($params['format'], $types)) { |
|
| 41 | + throw new BadParam("format is invalid."); |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + if (!isset($params['route_id'])) { |
|
| 45 | + throw new BadParam("route_id must be provided."); |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + if (!isset($params['member_id'])) { |
|
| 49 | + throw new BadParam("member_id must be provided."); |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + if (!isset($params['course'])) { |
|
| 53 | + throw new BadParam("course must be provided."); |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + if (!isset($params['speed'])) { |
|
| 57 | + throw new BadParam("speed must be provided."); |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + if (!isset($params['lat'])) { |
|
| 61 | + throw new BadParam("lat must be provided."); |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + if (!isset($params['lng'])) { |
|
| 65 | + throw new BadParam("lng must be provided."); |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + if (!isset($params['device_type'])) { |
|
| 69 | + throw new BadParam("device_type must be provided."); |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + $deviceTypes = array( |
|
| 73 | + DeviceType::IPHONE, |
|
| 74 | + DeviceType::IPAD, |
|
| 75 | + DeviceType::ANDROID_PHONE, |
|
| 76 | + DeviceType::ANDROID_TABLET |
|
| 77 | + ); |
|
| 78 | + if (!in_array($params['device_type'], $deviceTypes)) { |
|
| 79 | + throw new BadParam("device_type is invalid."); |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + if (!isset($params['device_guid'])) { |
|
| 83 | + throw new BadParam("device_guid must be provided."); |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + if (isset($params['device_timestamp'])) { |
|
| 87 | + $template = '/[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/i'; |
|
| 88 | + if (!preg_match($template, $params['device_timestamp'])) { |
|
| 89 | + throw new BadParam("device_timestamp is invalid."); |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + $param->format = self::getValue($params, 'format'); |
|
| 94 | + $param->route_id = self::getValue($params, 'route_id'); |
|
| 95 | + $param->member_id = self::getValue($params, 'member_id'); |
|
| 96 | + $param->course = self::getValue($params, 'course'); |
|
| 97 | + $param->speed = self::getValue($params, 'speed'); |
|
| 98 | + $param->lat = self::getValue($params, 'lat'); |
|
| 99 | + $param->lng = self::getValue($params, 'lng'); |
|
| 100 | + $param->device_type = self::getValue($params, 'device_type'); |
|
| 101 | + $param->device_guid = self::getValue($params, 'device_guid'); |
|
| 102 | + $param->device_timestamp = self::getValue($params, 'device_timestamp'); |
|
| 103 | + $param->vehicle_id = self::getValue($params, 'vehicle_id'); |
|
| 104 | + $param->altitude = self::getValue($params, 'altitude'); |
|
| 105 | + $param->app_version = self::getValue($params, 'app_version'); |
|
| 106 | + $param->tx_id = self::getValue($params, 'tx_id'); |
|
| 107 | + |
|
| 108 | + return $param; |
|
| 109 | + } |
|
| 110 | 110 | } |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | public static function fromArray(array $params) |
| 49 | 49 | { |
| 50 | 50 | $routeParams = new RouteParameters(); |
| 51 | - foreach($params as $key => $value) { |
|
| 51 | + foreach ($params as $key => $value) { |
|
| 52 | 52 | if (property_exists($routeParams, $key)) { |
| 53 | 53 | $routeParams->{$key} = $value; |
| 54 | 54 | } |
@@ -5,74 +5,74 @@ |
||
| 5 | 5 | |
| 6 | 6 | class RouteParameters extends Common |
| 7 | 7 | { |
| 8 | - public $is_upload; |
|
| 9 | - public $rt; |
|
| 10 | - public $route_name; |
|
| 11 | - public $route_date; |
|
| 12 | - public $route_time; |
|
| 13 | - public $shared_publicly; |
|
| 14 | - public $disable_optimization; |
|
| 15 | - public $optimize; |
|
| 16 | - public $lock_last; |
|
| 17 | - public $vehicle_capacity; |
|
| 18 | - public $vehicle_max_distance_mi; |
|
| 19 | - public $distance_unit; |
|
| 20 | - public $travel_mode; |
|
| 21 | - public $avoid; |
|
| 22 | - public $vehicle_id; |
|
| 23 | - public $dev_lat; |
|
| 24 | - public $dev_lng; |
|
| 25 | - public $route_max_duration; |
|
| 26 | - public $route_email; |
|
| 27 | - public $route_type = "api"; |
|
| 28 | - public $store_route = true; |
|
| 29 | - public $metric; |
|
| 30 | - public $algorithm_type; |
|
| 31 | - public $member_id; |
|
| 32 | - public $ip; |
|
| 33 | - public $dm; |
|
| 34 | - public $dirm; |
|
| 35 | - public $parts; |
|
| 36 | - public $device_id; |
|
| 37 | - public $device_type; |
|
| 38 | - public $has_trailer; |
|
| 39 | - public $trailer_weight_t; |
|
| 40 | - public $limited_weight_t; |
|
| 41 | - public $weight_per_axle_t; |
|
| 42 | - public $truck_height_meters; |
|
| 43 | - public $truck_width_meters; |
|
| 44 | - public $truck_length_meters; |
|
| 45 | - public $truck_hazardous_goods; |
|
| 8 | + public $is_upload; |
|
| 9 | + public $rt; |
|
| 10 | + public $route_name; |
|
| 11 | + public $route_date; |
|
| 12 | + public $route_time; |
|
| 13 | + public $shared_publicly; |
|
| 14 | + public $disable_optimization; |
|
| 15 | + public $optimize; |
|
| 16 | + public $lock_last; |
|
| 17 | + public $vehicle_capacity; |
|
| 18 | + public $vehicle_max_distance_mi; |
|
| 19 | + public $distance_unit; |
|
| 20 | + public $travel_mode; |
|
| 21 | + public $avoid; |
|
| 22 | + public $vehicle_id; |
|
| 23 | + public $dev_lat; |
|
| 24 | + public $dev_lng; |
|
| 25 | + public $route_max_duration; |
|
| 26 | + public $route_email; |
|
| 27 | + public $route_type = "api"; |
|
| 28 | + public $store_route = true; |
|
| 29 | + public $metric; |
|
| 30 | + public $algorithm_type; |
|
| 31 | + public $member_id; |
|
| 32 | + public $ip; |
|
| 33 | + public $dm; |
|
| 34 | + public $dirm; |
|
| 35 | + public $parts; |
|
| 36 | + public $device_id; |
|
| 37 | + public $device_type; |
|
| 38 | + public $has_trailer; |
|
| 39 | + public $trailer_weight_t; |
|
| 40 | + public $limited_weight_t; |
|
| 41 | + public $weight_per_axle_t; |
|
| 42 | + public $truck_height_meters; |
|
| 43 | + public $truck_width_meters; |
|
| 44 | + public $truck_length_meters; |
|
| 45 | + public $truck_hazardous_goods; |
|
| 46 | 46 | |
| 47 | - public $vehicle_max_cargo_weight; |
|
| 48 | - public $vehicle_max_cargo_volume; |
|
| 49 | - public $subtour_max_revenue; |
|
| 50 | - public $avoidance_zones; |
|
| 51 | - public $driver_id; |
|
| 52 | - public $parts_min; |
|
| 53 | - public $first_drive_then_wait_between_stops; |
|
| 54 | - public $truck_height; |
|
| 55 | - public $truck_width; |
|
| 56 | - public $truck_length; |
|
| 57 | - public $optimization_quality; |
|
| 58 | - public $override_addresses; |
|
| 59 | - public $max_tour_size; |
|
| 60 | - public $min_tour_size; |
|
| 61 | - public $uturn; |
|
| 62 | - public $leftturn; |
|
| 63 | - public $rightturn; |
|
| 47 | + public $vehicle_max_cargo_weight; |
|
| 48 | + public $vehicle_max_cargo_volume; |
|
| 49 | + public $subtour_max_revenue; |
|
| 50 | + public $avoidance_zones; |
|
| 51 | + public $driver_id; |
|
| 52 | + public $parts_min; |
|
| 53 | + public $first_drive_then_wait_between_stops; |
|
| 54 | + public $truck_height; |
|
| 55 | + public $truck_width; |
|
| 56 | + public $truck_length; |
|
| 57 | + public $optimization_quality; |
|
| 58 | + public $override_addresses; |
|
| 59 | + public $max_tour_size; |
|
| 60 | + public $min_tour_size; |
|
| 61 | + public $uturn; |
|
| 62 | + public $leftturn; |
|
| 63 | + public $rightturn; |
|
| 64 | 64 | |
| 65 | - public $optimized_callback_url; |
|
| 65 | + public $optimized_callback_url; |
|
| 66 | 66 | |
| 67 | - public static function fromArray(array $params) |
|
| 68 | - { |
|
| 69 | - $routeParams = new RouteParameters(); |
|
| 70 | - foreach($params as $key => $value) { |
|
| 71 | - if (property_exists($routeParams, $key)) { |
|
| 72 | - $routeParams->{$key} = $value; |
|
| 73 | - } |
|
| 74 | - } |
|
| 67 | + public static function fromArray(array $params) |
|
| 68 | + { |
|
| 69 | + $routeParams = new RouteParameters(); |
|
| 70 | + foreach($params as $key => $value) { |
|
| 71 | + if (property_exists($routeParams, $key)) { |
|
| 72 | + $routeParams->{$key} = $value; |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - return $routeParams; |
|
| 77 | - } |
|
| 76 | + return $routeParams; |
|
| 77 | + } |
|
| 78 | 78 | } |
@@ -17,19 +17,19 @@ |
||
| 17 | 17 | |
| 18 | 18 | // Itereate through all the existing activity types |
| 19 | 19 | foreach ($activityTypes->getConstants() as $prop => $value) { |
| 20 | - $activityParameters = ActivityParameters::fromArray(array( |
|
| 21 | - "activity_type" => $value, |
|
| 22 | - "limit" => 2, |
|
| 23 | - "offset" => 0 |
|
| 24 | - )); |
|
| 20 | + $activityParameters = ActivityParameters::fromArray(array( |
|
| 21 | + "activity_type" => $value, |
|
| 22 | + "limit" => 2, |
|
| 23 | + "offset" => 0 |
|
| 24 | + )); |
|
| 25 | 25 | |
| 26 | - $activities = new ActivityParameters(); |
|
| 27 | - $results = $activities->searcActivities($activityParameters); |
|
| 26 | + $activities = new ActivityParameters(); |
|
| 27 | + $results = $activities->searcActivities($activityParameters); |
|
| 28 | 28 | |
| 29 | - foreach ($results as $key => $activity) { |
|
| 30 | - Route4Me::simplePrint($activity); |
|
| 31 | - echo "<br>"; |
|
| 32 | - } |
|
| 29 | + foreach ($results as $key => $activity) { |
|
| 30 | + Route4Me::simplePrint($activity); |
|
| 31 | + echo "<br>"; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - echo "------------------- <br><br>"; |
|
| 34 | + echo "------------------- <br><br>"; |
|
| 35 | 35 | } |