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()
 
  40                && $oPosition->maybePhrase('country')
 
  41                && $oSearch->getContext()->isCountryApplicable($this->sCountryCode);
 
  45      * Derive new searches by adding this token to an existing search.
 
  47      * @param object  $oSearch      Partial search description derived so far.
 
  48      * @param object  $oPosition    Description of the token position within
 
  51      * @return SearchDescription[] List of derived search descriptions.
 
  53     public function extendSearch($oSearch, $oPosition)
 
  55         $oNewSearch = $oSearch->clone($oPosition->isLastToken() ? 1 : 6);
 
  56         $oNewSearch->setCountry($this->sCountryCode);
 
  58         return array($oNewSearch);
 
  61     public function debugInfo()
 
  66                 'Info' => $this->sCountryCode
 
  70     public function debugCode()