]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib-php/TokenPostcode.php
add typing information to DB properties
[nominatim.git] / lib-php / TokenPostcode.php
index f0dbd4571676ac59b0030b91a5bd9700ad9b3860..0ff92929cb58f2b496275fe23d016ac0d4dfdef2 100644 (file)
@@ -25,7 +25,12 @@ class Postcode
     public function __construct($iId, $sPostcode, $sCountryCode = '')
     {
         $this->iId = $iId;
     public function __construct($iId, $sPostcode, $sCountryCode = '')
     {
         $this->iId = $iId;
-        $this->sPostcode = $sPostcode;
+        $iSplitPos = strpos($sPostcode, '@');
+        if ($iSplitPos === false) {
+            $this->sPostcode = $sPostcode;
+        } else {
+            $this->sPostcode = substr($sPostcode, 0, $iSplitPos);
+        }
         $this->sCountryCode = empty($sCountryCode) ? '' : $sCountryCode;
     }
 
         $this->sCountryCode = empty($sCountryCode) ? '' : $sCountryCode;
     }