X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/2c42bda9cef0877ac2f14f0e5353876e3abd8d73..ff85da0a31874050c32712d9bb1d1a5592c50a81:/lib/DebugHtml.php
diff --git a/lib/DebugHtml.php b/lib/DebugHtml.php
index ce2b8361..98da8794 100644
--- a/lib/DebugHtml.php
+++ b/lib/DebugHtml.php
@@ -39,33 +39,48 @@ class Debug
public static function printDebugTable($sHeading, $aVar)
{
echo ''.$sHeading.":\n";
- echo '
';
+ echo "\n";
if (!empty($aVar)) {
- echo '';
+ echo "
\n";
$aKeys = array();
$aInfo = reset($aVar);
if (!is_array($aInfo)) {
$aInfo = $aInfo->debugInfo();
}
foreach ($aInfo as $sKey => $mVal) {
- echo ''.$sKey.' | ';
+ echo ' '.$sKey.' | '."\n";
$aKeys[] = $sKey;
}
- echo '
';
+ echo " \n";
foreach ($aVar as $oRow) {
$aInfo = $oRow;
if (!is_array($oRow)) {
$aInfo = $oRow->debugInfo();
}
- echo '';
+ echo "
\n";
foreach ($aKeys as $sKey) {
- echo '';
+ echo ' ';
if (isset($aInfo[$sKey])) {
Debug::outputVar($aInfo[$sKey], '');
}
- echo ' | ';
+ echo ' | '."\n";
}
- echo '
';
+ echo "
\n";
+ }
+ }
+ echo "
\n";
+ }
+
+ public static function printGroupedSearch($aSearches, $aWordsIDs)
+ {
+ echo '';
+ echo 'rank | Name Tokens | Name Not | ';
+ echo 'Address Tokens | Address Not | ';
+ echo 'country | operator | ';
+ echo 'class | type | postcode | housenumber |
';
+ foreach ($aSearches as $iRank => $aRankedSet) {
+ foreach ($aRankedSet as $aRow) {
+ $aRow->dumpAsHtmlTableRow($aWordsIDs);
}
}
echo '
';
@@ -74,38 +89,40 @@ class Debug
public static function printGroupTable($sHeading, $aVar)
{
echo ''.$sHeading.":\n";
- echo '';
+ echo "\n";
if (!empty($aVar)) {
- echo 'Group | ';
+ echo "
---|
\n";
+ echo ' Group | '."\n";
$aKeys = array();
- $aInfo = reset(reset($aVar));
+ $aInfo = reset($aVar)[0];
if (!is_array($aInfo)) {
$aInfo = $aInfo->debugInfo();
}
foreach ($aInfo as $sKey => $mVal) {
- echo ''.$sKey.' | ';
+ echo ' '.$sKey.' | '."\n";
$aKeys[] = $sKey;
}
- echo '
';
+ echo " \n";
foreach ($aVar as $sGrpKey => $aGroup) {
foreach ($aGroup as $oRow) {
$aInfo = $oRow;
if (!is_array($oRow)) {
$aInfo = $oRow->debugInfo();
}
- echo ''.$sGrpKey.' | ';
+ echo "
\n";
+ echo ' '.$sGrpKey.' | '."\n";
foreach ($aKeys as $sKey) {
- echo '';
+ echo ' ';
if (!empty($aInfo[$sKey])) {
Debug::outputVar($aInfo[$sKey], '');
}
- echo ' | ';
+ echo ' | '."\n";
}
- echo '
';
+ echo "
\n";
}
}
}
- echo '
';
+ echo "
\n";
}
public static function printSQL($sSQL)
@@ -128,14 +145,18 @@ class Debug
$sPre = "\n".$sPreNL;
}
} elseif (is_array($mVar) && isset($mVar['__debug_format'])) {
- if (!empty($mVar[data])) {
+ if (!empty($mVar['data'])) {
$sPre = '';
- foreach ($mVar[data] as $mValue) {
+ foreach ($mVar['data'] as $mValue) {
echo $sPre;
Debug::outputSimpleVar($mValue);
$sPre = ', ';
}
}
+ } elseif (is_object($mVar) && method_exists($mVar, 'debugInfo')) {
+ Debug::outputVar($mVar->debugInfo(), $sPreNL);
+ } elseif (is_a($mVar, 'stdClass')) {
+ Debug::outputVar(json_decode(json_encode($mVar), true), $sPreNL);
} else {
Debug::outputSimpleVar($mVar);
}