X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/db3ced17bbfff00411f506d8c84419c875959d5e..b8a73192128b162ea32bf2f622875a543a39d955:/lib-php/SearchContext.php?ds=sidebyside diff --git a/lib-php/SearchContext.php b/lib-php/SearchContext.php index 8316a012..3223b5c9 100644 --- a/lib-php/SearchContext.php +++ b/lib-php/SearchContext.php @@ -1,4 +1,12 @@ sqlCountryList = '('.join(',', array_map('addQuotes', $aCountries)).')'; + $this->aCountryList = $aCountries; } /** @@ -279,6 +290,19 @@ class SearchContext return ''; } + /** + * Check if the given country is covered by the search context. + * + * @param string $sCountryCode Country code of the country to check. + * + * @return True, if no country code restrictions are set or the + * country is included in the country list. + */ + public function isCountryApplicable($sCountryCode) + { + return $this->aCountryList === null || in_array($sCountryCode, $this->aCountryList); + } + public function debugInfo() { return array(