3 namespace Nominatim\Token;
10 /// Database word id, if available.
12 /// Two-letter country code (lower-cased).
13 private $sCountryCode;
15 public function __construct($iId, $sCountryCode)
18 $this->sCountryCode = $sCountryCode;
21 public function getId()
27 * Check if the token can be added to the given search.
28 * Derive new searches by adding this token to an existing search.
30 * @param object $oSearch Partial search description derived so far.
31 * @param object $oPosition Description of the token position within
34 * @return True if the token is compatible with the search configuration
37 public function isExtendable($oSearch, $oPosition)
39 return !$oSearch->hasCountry() && $oPosition->maybePhrase('country');
43 * Derive new searches by adding this token to an existing search.
45 * @param object $oSearch Partial search description derived so far.
46 * @param object $oPosition Description of the token position within
49 * @return SearchDescription[] List of derived search descriptions.
51 public function extendSearch($oSearch, $oPosition)
53 $oNewSearch = $oSearch->clone($oPosition->isLastToken() ? 1 : 6);
54 $oNewSearch->setCountry($this->sCountryCode);
56 return array($oNewSearch);
59 public function debugInfo()
64 'Info' => $this->sCountryCode
68 public function debugCode()