@@ -32,209 +32,209 @@ |
||
| 32 | 32 | class Places extends Api |
| 33 | 33 | { |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @var string |
|
| 37 | - */ |
|
| 38 | - const SERVICE_ENDPOINT = 'place'; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * @var string |
|
| 42 | - */ |
|
| 43 | - protected $result_collection = PlaceResultsCollection::class; |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * @param string $query |
|
| 47 | - * @param array|null $params |
|
| 48 | - * @param array|null $fields |
|
| 49 | - * |
|
| 50 | - * @return GoogleMapsResultsCollection |
|
| 51 | - * @see https://developers.google.com/places/web-service/search#FindPlaceRequests |
|
| 52 | - */ |
|
| 53 | - public function findPlaceByText( |
|
| 54 | - string $query, |
|
| 55 | - ?array $params = [], |
|
| 56 | - ?array $fields = [] |
|
| 57 | - ): GoogleMapsResultsCollection { |
|
| 58 | - |
|
| 59 | - $params = array_merge($params, [ |
|
| 60 | - GoogleMapsRequestFields::INPUT => $query, |
|
| 61 | - GoogleMapsRequestFields::FIELDS => implode(',', $fields) |
|
| 62 | - ]); |
|
| 63 | - |
|
| 64 | - return $this->findPlace($params); |
|
| 65 | - |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * Find Places requests |
|
| 70 | - * |
|
| 71 | - * @param array $params |
|
| 72 | - * GoogleMapsRequestFields::INPUT required |
|
| 73 | - * |
|
| 74 | - * @see https://developers.google.com/places/web-service/search#FindPlaceRequests |
|
| 75 | - * @return GoogleMapsResultsCollection |
|
| 76 | - * @throws InvalidArgumentException |
|
| 77 | - * @since 0.5.0 |
|
| 78 | - */ |
|
| 79 | - public function findPlace(array $params): GoogleMapsResultsCollection |
|
| 80 | - { |
|
| 81 | - |
|
| 82 | - // see \Biscolab\GoogleMaps\Values\PlaceInputTypeValues |
|
| 83 | - if (empty($params[GoogleMapsRequestFields::INPUTTYPE])) { |
|
| 84 | - $params[GoogleMapsRequestFields::INPUTTYPE] = PlaceInputTypeValues::TEXTQUERY; |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - if (empty($params[GoogleMapsRequestFields::INPUT])) { |
|
| 88 | - throw new InvalidArgumentException(GoogleMapsRequestFields::INPUT . " field is required"); |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - return $this->makeApiCall($params, PlaceServicesEndpoints::FINDPLACEFROMTEXT); |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - /** |
|
| 95 | - * @param array $params |
|
| 96 | - * @param string $endpoint |
|
| 97 | - * |
|
| 98 | - * @return GoogleMapsResultsCollection |
|
| 99 | - * @since 0.5.0 |
|
| 100 | - */ |
|
| 101 | - public function makeApiCall(array $params, string $endpoint): GoogleMapsResultsCollection |
|
| 102 | - { |
|
| 103 | - |
|
| 104 | - return $this->callApi($params, $endpoint); |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * @param string $number |
|
| 109 | - * @param array|null $params |
|
| 110 | - * @param array|null $fields |
|
| 111 | - * |
|
| 112 | - * @return GoogleMapsResultsCollection |
|
| 113 | - */ |
|
| 114 | - public function findPlaceByPhoneNumber( |
|
| 115 | - string $number, |
|
| 116 | - ?array $params = [], |
|
| 117 | - ?array $fields = [] |
|
| 118 | - ): GoogleMapsResultsCollection { |
|
| 119 | - |
|
| 120 | - $params = array_merge($params, [ |
|
| 121 | - GoogleMapsRequestFields::INPUT => $number, |
|
| 122 | - GoogleMapsRequestFields::INPUTTYPE => PlaceInputTypeValues::PHONENUMBER, |
|
| 123 | - GoogleMapsRequestFields::FIELDS => implode(',', $fields) |
|
| 124 | - ]); |
|
| 125 | - |
|
| 126 | - return $this->findPlace($params); |
|
| 127 | - |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - /** |
|
| 131 | - * @param Location $location |
|
| 132 | - * @param int $radius |
|
| 133 | - * @param array|null $params |
|
| 134 | - * |
|
| 135 | - * @return GoogleMapsResultsCollection |
|
| 136 | - */ |
|
| 137 | - public function findNearbyPlaceByRadius( |
|
| 138 | - Location $location, |
|
| 139 | - int $radius, |
|
| 140 | - ?array $params = [] |
|
| 141 | - ): GoogleMapsResultsCollection { |
|
| 142 | - |
|
| 143 | - $params = array_merge($params, [ |
|
| 144 | - GoogleMapsRequestFields::LOCATION => $location, |
|
| 145 | - GoogleMapsRequestFields::RADIUS => $radius |
|
| 146 | - ]); |
|
| 147 | - |
|
| 148 | - return $this->findNearbyPlace($params); |
|
| 149 | - } |
|
| 150 | - |
|
| 151 | - /** |
|
| 152 | - * Nearby Search requests |
|
| 153 | - * |
|
| 154 | - * @param array $params |
|
| 155 | - * |
|
| 156 | - * @return GoogleMapsResultsCollection |
|
| 157 | - * |
|
| 158 | - * @throws InvalidArgumentException |
|
| 159 | - * @see https://developers.google.com/places/web-service/search#PlaceSearchRequests |
|
| 160 | - * @since 0.5.0 |
|
| 161 | - */ |
|
| 162 | - public function findNearbyPlace(array $params): GoogleMapsResultsCollection |
|
| 163 | - { |
|
| 164 | - |
|
| 165 | - if (!empty($params[GoogleMapsRequestFields::LOCATION])) {//-33.8670522,151.1957362 |
|
| 166 | - $location = $params[GoogleMapsRequestFields::LOCATION]; |
|
| 167 | - if (!$location instanceof Location) { |
|
| 168 | - throw new InvalidArgumentException(GoogleMapsRequestFields::LOCATION . ' field must be instance of ' . Location::class . ' class'); |
|
| 169 | - } |
|
| 170 | - $params[GoogleMapsRequestFields::LOCATION] = (string)$params[GoogleMapsRequestFields::LOCATION]; |
|
| 171 | - } else { |
|
| 172 | - throw new InvalidArgumentException(GoogleMapsResultFields::LOCATION . ' field is required'); |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - if (!empty($params[GoogleMapsRequestFields::RANKBY]) && |
|
| 176 | - $params[GoogleMapsRequestFields::RANKBY] === RankByValues::DISTANCE |
|
| 177 | - ) { |
|
| 178 | - if (empty($params[GoogleMapsRequestFields::KEYWORD]) && |
|
| 179 | - empty($params[GoogleMapsRequestFields::NAME]) && |
|
| 180 | - empty($params[GoogleMapsRequestFields::TYPE])) { |
|
| 35 | + /** |
|
| 36 | + * @var string |
|
| 37 | + */ |
|
| 38 | + const SERVICE_ENDPOINT = 'place'; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * @var string |
|
| 42 | + */ |
|
| 43 | + protected $result_collection = PlaceResultsCollection::class; |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * @param string $query |
|
| 47 | + * @param array|null $params |
|
| 48 | + * @param array|null $fields |
|
| 49 | + * |
|
| 50 | + * @return GoogleMapsResultsCollection |
|
| 51 | + * @see https://developers.google.com/places/web-service/search#FindPlaceRequests |
|
| 52 | + */ |
|
| 53 | + public function findPlaceByText( |
|
| 54 | + string $query, |
|
| 55 | + ?array $params = [], |
|
| 56 | + ?array $fields = [] |
|
| 57 | + ): GoogleMapsResultsCollection { |
|
| 58 | + |
|
| 59 | + $params = array_merge($params, [ |
|
| 60 | + GoogleMapsRequestFields::INPUT => $query, |
|
| 61 | + GoogleMapsRequestFields::FIELDS => implode(',', $fields) |
|
| 62 | + ]); |
|
| 63 | + |
|
| 64 | + return $this->findPlace($params); |
|
| 65 | + |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * Find Places requests |
|
| 70 | + * |
|
| 71 | + * @param array $params |
|
| 72 | + * GoogleMapsRequestFields::INPUT required |
|
| 73 | + * |
|
| 74 | + * @see https://developers.google.com/places/web-service/search#FindPlaceRequests |
|
| 75 | + * @return GoogleMapsResultsCollection |
|
| 76 | + * @throws InvalidArgumentException |
|
| 77 | + * @since 0.5.0 |
|
| 78 | + */ |
|
| 79 | + public function findPlace(array $params): GoogleMapsResultsCollection |
|
| 80 | + { |
|
| 81 | + |
|
| 82 | + // see \Biscolab\GoogleMaps\Values\PlaceInputTypeValues |
|
| 83 | + if (empty($params[GoogleMapsRequestFields::INPUTTYPE])) { |
|
| 84 | + $params[GoogleMapsRequestFields::INPUTTYPE] = PlaceInputTypeValues::TEXTQUERY; |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + if (empty($params[GoogleMapsRequestFields::INPUT])) { |
|
| 88 | + throw new InvalidArgumentException(GoogleMapsRequestFields::INPUT . " field is required"); |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + return $this->makeApiCall($params, PlaceServicesEndpoints::FINDPLACEFROMTEXT); |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + /** |
|
| 95 | + * @param array $params |
|
| 96 | + * @param string $endpoint |
|
| 97 | + * |
|
| 98 | + * @return GoogleMapsResultsCollection |
|
| 99 | + * @since 0.5.0 |
|
| 100 | + */ |
|
| 101 | + public function makeApiCall(array $params, string $endpoint): GoogleMapsResultsCollection |
|
| 102 | + { |
|
| 103 | + |
|
| 104 | + return $this->callApi($params, $endpoint); |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * @param string $number |
|
| 109 | + * @param array|null $params |
|
| 110 | + * @param array|null $fields |
|
| 111 | + * |
|
| 112 | + * @return GoogleMapsResultsCollection |
|
| 113 | + */ |
|
| 114 | + public function findPlaceByPhoneNumber( |
|
| 115 | + string $number, |
|
| 116 | + ?array $params = [], |
|
| 117 | + ?array $fields = [] |
|
| 118 | + ): GoogleMapsResultsCollection { |
|
| 119 | + |
|
| 120 | + $params = array_merge($params, [ |
|
| 121 | + GoogleMapsRequestFields::INPUT => $number, |
|
| 122 | + GoogleMapsRequestFields::INPUTTYPE => PlaceInputTypeValues::PHONENUMBER, |
|
| 123 | + GoogleMapsRequestFields::FIELDS => implode(',', $fields) |
|
| 124 | + ]); |
|
| 125 | + |
|
| 126 | + return $this->findPlace($params); |
|
| 127 | + |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + /** |
|
| 131 | + * @param Location $location |
|
| 132 | + * @param int $radius |
|
| 133 | + * @param array|null $params |
|
| 134 | + * |
|
| 135 | + * @return GoogleMapsResultsCollection |
|
| 136 | + */ |
|
| 137 | + public function findNearbyPlaceByRadius( |
|
| 138 | + Location $location, |
|
| 139 | + int $radius, |
|
| 140 | + ?array $params = [] |
|
| 141 | + ): GoogleMapsResultsCollection { |
|
| 142 | + |
|
| 143 | + $params = array_merge($params, [ |
|
| 144 | + GoogleMapsRequestFields::LOCATION => $location, |
|
| 145 | + GoogleMapsRequestFields::RADIUS => $radius |
|
| 146 | + ]); |
|
| 147 | + |
|
| 148 | + return $this->findNearbyPlace($params); |
|
| 149 | + } |
|
| 150 | + |
|
| 151 | + /** |
|
| 152 | + * Nearby Search requests |
|
| 153 | + * |
|
| 154 | + * @param array $params |
|
| 155 | + * |
|
| 156 | + * @return GoogleMapsResultsCollection |
|
| 157 | + * |
|
| 158 | + * @throws InvalidArgumentException |
|
| 159 | + * @see https://developers.google.com/places/web-service/search#PlaceSearchRequests |
|
| 160 | + * @since 0.5.0 |
|
| 161 | + */ |
|
| 162 | + public function findNearbyPlace(array $params): GoogleMapsResultsCollection |
|
| 163 | + { |
|
| 164 | + |
|
| 165 | + if (!empty($params[GoogleMapsRequestFields::LOCATION])) {//-33.8670522,151.1957362 |
|
| 166 | + $location = $params[GoogleMapsRequestFields::LOCATION]; |
|
| 167 | + if (!$location instanceof Location) { |
|
| 168 | + throw new InvalidArgumentException(GoogleMapsRequestFields::LOCATION . ' field must be instance of ' . Location::class . ' class'); |
|
| 169 | + } |
|
| 170 | + $params[GoogleMapsRequestFields::LOCATION] = (string)$params[GoogleMapsRequestFields::LOCATION]; |
|
| 171 | + } else { |
|
| 172 | + throw new InvalidArgumentException(GoogleMapsResultFields::LOCATION . ' field is required'); |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + if (!empty($params[GoogleMapsRequestFields::RANKBY]) && |
|
| 176 | + $params[GoogleMapsRequestFields::RANKBY] === RankByValues::DISTANCE |
|
| 177 | + ) { |
|
| 178 | + if (empty($params[GoogleMapsRequestFields::KEYWORD]) && |
|
| 179 | + empty($params[GoogleMapsRequestFields::NAME]) && |
|
| 180 | + empty($params[GoogleMapsRequestFields::TYPE])) { |
|
| 181 | 181 | // If rankby=distance (described under Optional parameters below) is specified, |
| 182 | 182 | // then one or more of keyword, name, or type is required. |
| 183 | - throw new InvalidArgumentException('If ' . GoogleMapsRequestFields::RANKBY . ' is set as "' . RankByValues::DISTANCE . '" one or more of ' . GoogleMapsRequestFields::KEYWORD . ', ' . GoogleMapsRequestFields::NAME . ', ' . GoogleMapsRequestFields::TYPE . ' fields are required'); |
|
| 184 | - } |
|
| 185 | - if (!empty($params[GoogleMapsRequestFields::RADIUS])) { |
|
| 183 | + throw new InvalidArgumentException('If ' . GoogleMapsRequestFields::RANKBY . ' is set as "' . RankByValues::DISTANCE . '" one or more of ' . GoogleMapsRequestFields::KEYWORD . ', ' . GoogleMapsRequestFields::NAME . ', ' . GoogleMapsRequestFields::TYPE . ' fields are required'); |
|
| 184 | + } |
|
| 185 | + if (!empty($params[GoogleMapsRequestFields::RADIUS])) { |
|
| 186 | 186 | // Note that radius must not be included if rankby=distance (described under Optional parameters below) is specified. |
| 187 | - throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' must not be included if ' . GoogleMapsRequestFields::RANKBY . ' = ' . RankByValues::DISTANCE); |
|
| 188 | - } |
|
| 189 | - } elseif (empty($params[GoogleMapsRequestFields::RADIUS])) { |
|
| 187 | + throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' must not be included if ' . GoogleMapsRequestFields::RANKBY . ' = ' . RankByValues::DISTANCE); |
|
| 188 | + } |
|
| 189 | + } elseif (empty($params[GoogleMapsRequestFields::RADIUS])) { |
|
| 190 | 190 | // radius — Defines the distance (in meters) within which to return place results. |
| 191 | - throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' field is required'); |
|
| 192 | - } |
|
| 191 | + throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' field is required'); |
|
| 192 | + } |
|
| 193 | 193 | |
| 194 | - if (!empty($params[GoogleMapsRequestFields::RADIUS]) && floatval($params[GoogleMapsRequestFields::RADIUS]) > Config::MAX_PLACE_RADIUS_VALUE) { |
|
| 194 | + if (!empty($params[GoogleMapsRequestFields::RADIUS]) && floatval($params[GoogleMapsRequestFields::RADIUS]) > Config::MAX_PLACE_RADIUS_VALUE) { |
|
| 195 | 195 | // The maximum allowed radius is 50 000 meters. |
| 196 | - throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' must be lower than ' . Config::MAX_PLACE_RADIUS_VALUE); |
|
| 197 | - } |
|
| 198 | - |
|
| 199 | - return $this->makeApiCall($params, PlaceServicesEndpoints::NEARBYSEARCH); |
|
| 200 | - } |
|
| 201 | - |
|
| 202 | - /** |
|
| 203 | - * @param Location $location |
|
| 204 | - * @param array $params |
|
| 205 | - * |
|
| 206 | - * @return GoogleMapsResultsCollection |
|
| 207 | - */ |
|
| 208 | - public function findNearbyPlaceByDistance(Location $location, array $params): GoogleMapsResultsCollection |
|
| 209 | - { |
|
| 210 | - |
|
| 211 | - $params = array_merge($params, [ |
|
| 212 | - GoogleMapsRequestFields::LOCATION => $location, |
|
| 213 | - GoogleMapsRequestFields::RANKBY => RankByValues::DISTANCE |
|
| 214 | - ]); |
|
| 215 | - |
|
| 216 | - return $this->findNearbyPlace($params); |
|
| 217 | - } |
|
| 218 | - |
|
| 219 | - /** |
|
| 220 | - * Nearby Search requests |
|
| 221 | - * |
|
| 222 | - * @param string $query |
|
| 223 | - * @param array|null $params |
|
| 224 | - * |
|
| 225 | - * @see https://developers.google.com/places/web-service/search#TextSearchRequests |
|
| 226 | - * @return GoogleMapsResultsCollection |
|
| 227 | - * @throws InvalidArgumentException |
|
| 228 | - * @since 0.5.0 |
|
| 229 | - */ |
|
| 230 | - public function textSearch(string $query, ?array $params = []): GoogleMapsResultsCollection |
|
| 231 | - { |
|
| 232 | - |
|
| 233 | - $params = array_merge($params, [ |
|
| 234 | - GoogleMapsRequestFields::QUERY => $query |
|
| 235 | - ]); |
|
| 236 | - |
|
| 237 | - return $this->makeApiCall($params, PlaceServicesEndpoints::TEXTSEARCH); |
|
| 238 | - } |
|
| 196 | + throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' must be lower than ' . Config::MAX_PLACE_RADIUS_VALUE); |
|
| 197 | + } |
|
| 198 | + |
|
| 199 | + return $this->makeApiCall($params, PlaceServicesEndpoints::NEARBYSEARCH); |
|
| 200 | + } |
|
| 201 | + |
|
| 202 | + /** |
|
| 203 | + * @param Location $location |
|
| 204 | + * @param array $params |
|
| 205 | + * |
|
| 206 | + * @return GoogleMapsResultsCollection |
|
| 207 | + */ |
|
| 208 | + public function findNearbyPlaceByDistance(Location $location, array $params): GoogleMapsResultsCollection |
|
| 209 | + { |
|
| 210 | + |
|
| 211 | + $params = array_merge($params, [ |
|
| 212 | + GoogleMapsRequestFields::LOCATION => $location, |
|
| 213 | + GoogleMapsRequestFields::RANKBY => RankByValues::DISTANCE |
|
| 214 | + ]); |
|
| 215 | + |
|
| 216 | + return $this->findNearbyPlace($params); |
|
| 217 | + } |
|
| 218 | + |
|
| 219 | + /** |
|
| 220 | + * Nearby Search requests |
|
| 221 | + * |
|
| 222 | + * @param string $query |
|
| 223 | + * @param array|null $params |
|
| 224 | + * |
|
| 225 | + * @see https://developers.google.com/places/web-service/search#TextSearchRequests |
|
| 226 | + * @return GoogleMapsResultsCollection |
|
| 227 | + * @throws InvalidArgumentException |
|
| 228 | + * @since 0.5.0 |
|
| 229 | + */ |
|
| 230 | + public function textSearch(string $query, ?array $params = []): GoogleMapsResultsCollection |
|
| 231 | + { |
|
| 232 | + |
|
| 233 | + $params = array_merge($params, [ |
|
| 234 | + GoogleMapsRequestFields::QUERY => $query |
|
| 235 | + ]); |
|
| 236 | + |
|
| 237 | + return $this->makeApiCall($params, PlaceServicesEndpoints::TEXTSEARCH); |
|
| 238 | + } |
|
| 239 | 239 | |
| 240 | 240 | } |
| 241 | 241 | \ No newline at end of file |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | if (empty($params[GoogleMapsRequestFields::INPUT])) { |
| 88 | - throw new InvalidArgumentException(GoogleMapsRequestFields::INPUT . " field is required"); |
|
| 88 | + throw new InvalidArgumentException(GoogleMapsRequestFields::INPUT." field is required"); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | return $this->makeApiCall($params, PlaceServicesEndpoints::FINDPLACEFROMTEXT); |
@@ -165,11 +165,11 @@ discard block |
||
| 165 | 165 | if (!empty($params[GoogleMapsRequestFields::LOCATION])) {//-33.8670522,151.1957362 |
| 166 | 166 | $location = $params[GoogleMapsRequestFields::LOCATION]; |
| 167 | 167 | if (!$location instanceof Location) { |
| 168 | - throw new InvalidArgumentException(GoogleMapsRequestFields::LOCATION . ' field must be instance of ' . Location::class . ' class'); |
|
| 168 | + throw new InvalidArgumentException(GoogleMapsRequestFields::LOCATION.' field must be instance of '.Location::class.' class'); |
|
| 169 | 169 | } |
| 170 | - $params[GoogleMapsRequestFields::LOCATION] = (string)$params[GoogleMapsRequestFields::LOCATION]; |
|
| 170 | + $params[GoogleMapsRequestFields::LOCATION] = (string) $params[GoogleMapsRequestFields::LOCATION]; |
|
| 171 | 171 | } else { |
| 172 | - throw new InvalidArgumentException(GoogleMapsResultFields::LOCATION . ' field is required'); |
|
| 172 | + throw new InvalidArgumentException(GoogleMapsResultFields::LOCATION.' field is required'); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | if (!empty($params[GoogleMapsRequestFields::RANKBY]) && |
@@ -180,20 +180,20 @@ discard block |
||
| 180 | 180 | empty($params[GoogleMapsRequestFields::TYPE])) { |
| 181 | 181 | // If rankby=distance (described under Optional parameters below) is specified, |
| 182 | 182 | // then one or more of keyword, name, or type is required. |
| 183 | - throw new InvalidArgumentException('If ' . GoogleMapsRequestFields::RANKBY . ' is set as "' . RankByValues::DISTANCE . '" one or more of ' . GoogleMapsRequestFields::KEYWORD . ', ' . GoogleMapsRequestFields::NAME . ', ' . GoogleMapsRequestFields::TYPE . ' fields are required'); |
|
| 183 | + throw new InvalidArgumentException('If '.GoogleMapsRequestFields::RANKBY.' is set as "'.RankByValues::DISTANCE.'" one or more of '.GoogleMapsRequestFields::KEYWORD.', '.GoogleMapsRequestFields::NAME.', '.GoogleMapsRequestFields::TYPE.' fields are required'); |
|
| 184 | 184 | } |
| 185 | 185 | if (!empty($params[GoogleMapsRequestFields::RADIUS])) { |
| 186 | 186 | // Note that radius must not be included if rankby=distance (described under Optional parameters below) is specified. |
| 187 | - throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' must not be included if ' . GoogleMapsRequestFields::RANKBY . ' = ' . RankByValues::DISTANCE); |
|
| 187 | + throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS.' must not be included if '.GoogleMapsRequestFields::RANKBY.' = '.RankByValues::DISTANCE); |
|
| 188 | 188 | } |
| 189 | 189 | } elseif (empty($params[GoogleMapsRequestFields::RADIUS])) { |
| 190 | 190 | // radius — Defines the distance (in meters) within which to return place results. |
| 191 | - throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' field is required'); |
|
| 191 | + throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS.' field is required'); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | if (!empty($params[GoogleMapsRequestFields::RADIUS]) && floatval($params[GoogleMapsRequestFields::RADIUS]) > Config::MAX_PLACE_RADIUS_VALUE) { |
| 195 | 195 | // The maximum allowed radius is 50 000 meters. |
| 196 | - throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' must be lower than ' . Config::MAX_PLACE_RADIUS_VALUE); |
|
| 196 | + throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS.' must be lower than '.Config::MAX_PLACE_RADIUS_VALUE); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | return $this->makeApiCall($params, PlaceServicesEndpoints::NEARBYSEARCH); |
@@ -17,8 +17,8 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | class Config |
| 19 | 19 | { |
| 20 | - /** |
|
| 21 | - * @var int |
|
| 22 | - */ |
|
| 23 | - const MAX_PLACE_RADIUS_VALUE = 50000; |
|
| 20 | + /** |
|
| 21 | + * @var int |
|
| 22 | + */ |
|
| 23 | + const MAX_PLACE_RADIUS_VALUE = 50000; |
|
| 24 | 24 | } |
| 25 | 25 | \ No newline at end of file |