X-Git-Url: https://git.openstreetmap.org/nominatim.git/blobdiff_plain/c700421aa7a5509d096d6064379b2793ed191d69..71ae7f10f74251ebef13abe8d186276e6255b5d4:/lib/Phrase.php diff --git a/lib/Phrase.php b/lib/Phrase.php index 0fe1d313..7cf3f297 100644 --- a/lib/Phrase.php +++ b/lib/Phrase.php @@ -9,7 +9,7 @@ namespace Nominatim; */ class Phrase { - CONST MAX_DEPTH = 7; + const MAX_DEPTH = 7; // Complete phrase as a string. private $sPhrase; @@ -83,7 +83,7 @@ class Phrase $aResult = array(array(join(' ', $aWords))); $sFirstToken = ''; if ($iDepth < Phrase::MAX_DEPTH) { - while (sizeof($aWords) > 1) { + while (count($aWords) > 1) { $sWord = array_shift($aWords); $sFirstToken .= ($sFirstToken?' ':'').$sWord; $aRest = $this->createWordSets($aWords, $iDepth + 1); @@ -101,7 +101,7 @@ class Phrase $aResult = array(array(join(' ', $aWords))); $sFirstToken = ''; if ($iDepth < Phrase::MAX_DEPTH) { - while (sizeof($aWords) > 1) { + while (count($aWords) > 1) { $sWord = array_pop($aWords); $sFirstToken = $sWord.($sFirstToken?' ':'').$sFirstToken; $aRest = $this->createInverseWordSets($aWords, $iDepth + 1); @@ -113,4 +113,14 @@ class Phrase return $aResult; } -}; + + public function debugInfo() + { + return array( + 'Type' => $this->sPhraseType, + 'Phrase' => $this->sPhrase, + 'Words' => $this->aWords, + 'WordSets' => $this->aWordSets + ); + } +}