<?php
+/**
+ * SPDX-License-Identifier: GPL-2.0-only
+ *
+ * This file is part of Nominatim. (https://nominatim.org)
+ *
+ * Copyright (C) 2022 by the Nominatim developer community.
+ * For a full list of authors see the git log.
+ */
namespace Nominatim;
public $sqlViewboxLarge = '';
/// Reference along a route (as SQL).
public $sqlViewboxCentre = '';
+ /// List of countries to restrict search to (as array).
+ public $aCountryList = null;
/// List of countries to restrict search to (as SQL).
public $sqlCountryList = '';
/// List of place IDs to exclude (as SQL).
public function setCountryList($aCountries)
{
$this->sqlCountryList = '('.join(',', array_map('addQuotes', $aCountries)).')';
+ $this->aCountryList = $aCountries;
}
/**
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(