POI route, added default values for latlon parameters
authorLaury GvR <laury@gaslightmedia.com>
Wed, 7 Aug 2019 23:16:41 +0000 (19:16 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Wed, 7 Aug 2019 23:16:41 +0000 (19:16 -0400)
setup/routes/pointsOfInterest.php

index 5d33fc9..5e90390 100644 (file)
@@ -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']);