From f92d4d6252777caad20ebb1ffb3c481c7e20e452 Mon Sep 17 00:00:00 2001 From: Laury GvR Date: Wed, 7 Aug 2019 19:16:41 -0400 Subject: [PATCH] POI route, added default values for latlon parameters --- setup/routes/pointsOfInterest.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/setup/routes/pointsOfInterest.php b/setup/routes/pointsOfInterest.php index 5d33fc9..5e90390 100644 --- a/setup/routes/pointsOfInterest.php +++ b/setup/routes/pointsOfInterest.php @@ -61,29 +61,26 @@ class GLMA_POI_Rest_Controller 'callback' => function( $request ) { // Defaults - $limit = 1; - // Parameter collection & assignment $this->params = $request->get_params(); - $latMin = $this->params['latMin']; + $addons = explode( ",", $this->params['addons'] ); + + $latMin = $this->params['latMin'] ?? -90.0; $lastLatMin = $this->params['lastLatMin']; - $latMax = $this->params['latMax']; + $latMax = $this->params['latMax'] ?? 90.0; $lastLatMax = $this->params['lastLatMax']; - $lonMin = $this->params['lonMin']; + $lonMin = $this->params['lonMin'] ?? -180.0; $lastLonMin = $this->params['lastLonMin']; - $lonMax = $this->params['lonMax']; + $lonMax = $this->params['lonMax'] ?? 180.0; $lastLonMax = $this->params['lastLonMax']; - $poiRequest = $this->params['poiRequest']; + $poiRequest = $this->params['poiRequest'] ?? "Anywhere"; - $addons = explode( ",", $this->params['addons'] ); $searchText = "test"; - if (isset($this->params['limit'])) { - $limit = $this->params['limit']; - } + $limit = $this->params['limit'] ?? 5; //$mapItems = $MapItems->modelAction($data['request'], $data['area'], $data['filter']); -- 2.17.1