From 500c61685b16fd1d51e7b5f4738c788a9d00eab4 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Fri, 9 Jul 2021 16:36:42 +0200 Subject: [PATCH] remove unused variables As reported by sonarqube. --- lib-php/AddressDetails.php | 2 +- lib-php/DebugHtml.php | 2 +- lib-php/Geocode.php | 13 +------------ lib-php/ReverseGeocode.php | 4 ---- lib-php/SearchDescription.php | 1 - lib-php/tokenizer/legacy_tokenizer.php | 2 +- 6 files changed, 4 insertions(+), 20 deletions(-) diff --git a/lib-php/AddressDetails.php b/lib-php/AddressDetails.php index bf8defc2..fc7fbec7 100644 --- a/lib-php/AddressDetails.php +++ b/lib-php/AddressDetails.php @@ -61,7 +61,7 @@ class AddressDetails return join(', ', $aParts); } - public function getAddressNames($sCountry = null) + public function getAddressNames() { $aAddress = array(); diff --git a/lib-php/DebugHtml.php b/lib-php/DebugHtml.php index 98da8794..19221b43 100644 --- a/lib-php/DebugHtml.php +++ b/lib-php/DebugHtml.php @@ -78,7 +78,7 @@ class Debug echo 'Address TokensAddress Not'; echo 'countryoperator'; echo 'classtypepostcodehousenumber'; - foreach ($aSearches as $iRank => $aRankedSet) { + foreach ($aSearches as $aRankedSet) { foreach ($aRankedSet as $aRow) { $aRow->dumpAsHtmlTableRow($aWordsIDs); } diff --git a/lib-php/Geocode.php b/lib-php/Geocode.php index a3883b25..ccb8a810 100644 --- a/lib-php/Geocode.php +++ b/lib-php/Geocode.php @@ -417,7 +417,7 @@ class Geocode $iSearchCount = 0; $aSearches = array(); - foreach ($aGroupedSearches as $iScore => $aNewSearches) { + foreach ($aGroupedSearches as $aNewSearches) { $iSearchCount += count($aNewSearches); $aSearches = array_merge($aSearches, $aNewSearches); if ($iSearchCount > 50) break; @@ -503,10 +503,6 @@ class Geocode Debug::newSection('Query Preprocessing'); - $sLanguagePrefArraySQL = $this->oDB->getArraySQL( - $this->oDB->getDBQuotedList($this->aLangPrefOrder) - ); - $sQuery = $this->sQuery; if (!preg_match('//u', $sQuery)) { userError('Query string is not UTF-8 encoded.'); @@ -891,15 +887,8 @@ class Geocode $aToFilter = $aSearchResults; $aSearchResults = array(); - $bFirst = true; foreach ($aToFilter as $aResult) { $this->aExcludePlaceIDs[$aResult['place_id']] = $aResult['place_id']; - if ($bFirst) { - $fLat = $aResult['lat']; - $fLon = $aResult['lon']; - if (isset($aResult['zoom'])) $iZoom = $aResult['zoom']; - $bFirst = false; - } if (!$this->oPlaceLookup->doDeDupe() || (!isset($aOSMIDDone[$aResult['osm_type'].$aResult['osm_id']]) && !isset($aClassTypeNameDone[$aResult['osm_type'].$aResult['class'].$aResult['type'].$aResult['name'].$aResult['admin_level']])) ) { diff --git a/lib-php/ReverseGeocode.php b/lib-php/ReverseGeocode.php index cf396b7a..0a3841f2 100644 --- a/lib-php/ReverseGeocode.php +++ b/lib-php/ReverseGeocode.php @@ -74,8 +74,6 @@ class ReverseGeocode protected function lookupLargeArea($sPointSQL, $iMaxRank) { - $oResult = null; - if ($iMaxRank > 4) { $aPlace = $this->lookupPolygon($sPointSQL, $iMaxRank); if ($aPlace) { @@ -190,7 +188,6 @@ class ReverseGeocode if ($aPoly) { // if a polygon is found, search for placenodes begins ... - $iParentPlaceID = $aPoly['parent_place_id']; $iRankAddress = $aPoly['rank_address']; $iRankSearch = $aPoly['rank_search']; $iPlaceID = $aPoly['place_id']; @@ -356,7 +353,6 @@ class ReverseGeocode $oResult = new Result($aHouse['place_id'], Result::TABLE_OSMLINE); $oResult->iHouseNumber = closestHouseNumber($aHouse); $aPlace = $aHouse; - $iRankAddress = 30; } } diff --git a/lib-php/SearchDescription.php b/lib-php/SearchDescription.php index 3c572f2f..6091fd61 100644 --- a/lib-php/SearchDescription.php +++ b/lib-php/SearchDescription.php @@ -415,7 +415,6 @@ class SearchDescription public function query(&$oDB, $iMinRank, $iMaxRank, $iLimit) { $aResults = array(); - $iHousenumber = -1; if ($this->sCountryCode && empty($this->aName) diff --git a/lib-php/tokenizer/legacy_tokenizer.php b/lib-php/tokenizer/legacy_tokenizer.php index 0fb37fd0..50207c31 100644 --- a/lib-php/tokenizer/legacy_tokenizer.php +++ b/lib-php/tokenizer/legacy_tokenizer.php @@ -105,7 +105,7 @@ class Tokenizer // now compute all possible tokens $aWordLists = array(); $aTokens = array(); - foreach ($aNormPhrases as $sTitle => $sPhrase) { + foreach ($aNormPhrases as $sPhrase) { if (strlen($sPhrase) > 0) { $aWords = explode(' ', $sPhrase); Tokenizer::addTokens($aTokens, $aWords); -- 2.39.5