]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/AddressDetails.php
refactor import_wiki* script for readability
[nominatim.git] / lib / AddressDetails.php
index 2d40c84f4efc35e90421798cc14f35a35bde3f68..61823b4ce9dc504010ed33e67aeb575df400d047 100644 (file)
@@ -14,10 +14,10 @@ class AddressDetails
     public function __construct(&$oDB, $iPlaceID, $sHousenumber, $mLangPref)
     {
         if (is_array($mLangPref)) {
-            $mLangPref = 'ARRAY['.join(',', array_map('getDBQuoted', $mLangPref)).']';
+            $mLangPref = $oDB->getArraySQL($oDB->getDBQuotedList($mLangPref));
         }
 
-        if (!$sHousenumber) {
+        if (!isset($sHousenumber)) {
             $sHousenumber = -1;
         }
 
@@ -76,14 +76,14 @@ class AddressDetails
                 $bFallback = true;
             }
 
-            $sName = false;
-            if (isset($aLine['localname']) && $aLine['localname']) {
+            $sName = null;
+            if (isset($aLine['localname']) && $aLine['localname']!=='') {
                 $sName = $aLine['localname'];
-            } elseif (isset($aLine['housenumber']) && $aLine['housenumber']) {
+            } elseif (isset($aLine['housenumber']) && $aLine['housenumber']!=='') {
                 $sName = $aLine['housenumber'];
             }
 
-            if ($sName) {
+            if (isset($sName)) {
                 $sTypeLabel = strtolower(isset($aTypeLabel['simplelabel']) ? $aTypeLabel['simplelabel'] : $aTypeLabel['label']);
                 $sTypeLabel = str_replace(' ', '_', $sTypeLabel);
                 if (!isset($aAddress[$sTypeLabel])
@@ -97,6 +97,7 @@ class AddressDetails
                 }
             }
         }
+
         return $aAddress;
     }