Skip to content

Commit

Permalink
passes phpcs (for probably the first time ever)
Browse files Browse the repository at this point in the history
  • Loading branch information
okonomiyaki3000 committed Nov 20, 2014
1 parent ca073b9 commit fcd0643
Showing 1 changed file with 35 additions and 23 deletions.
58 changes: 35 additions & 23 deletions plugins/system/debug/debug.php
Expand Up @@ -901,9 +901,17 @@ protected function displayQueries()
// Compute the query time.
$queryTime = ($timings[$id * 2 + 1] - $timings[$id * 2]) * 1000;

// Timing. Formats the output for the query time with EXPLAIN query results as tooltip.
$htmlTiming = '<div style="margin: 0px 0 5px;"><span class="dbg-query-time">'
. JText::sprintf('PLG_DEBUG_QUERY_TIME', sprintf('<span class="label ' . $info[$id]->class . '">%.2f&nbsp;ms</span>', $timing[$id]['0']));
// Timing
// Formats the output for the query time with EXPLAIN query results as tooltip:
$htmlTiming = '<div style="margin: 0px 0 5px;"><span class="dbg-query-time">';
$htmlTiming .= JText::sprintf(
'PLG_DEBUG_QUERY_TIME',
sprintf(
'<span class="label %s">%.2f&nbsp;ms</span>',
$info[$id]->class,
$timing[$id]['0']
)
);

if ($timing[$id]['1'])
{
Expand Down Expand Up @@ -960,8 +968,7 @@ protected function displayQueries()
}

$htmlResultsReturned = '<span class="label ' . $labelClass . '">' . (int) $resultsReturned . '</span>';
$htmlTiming .= ' ' . '<span class="dbg-query-rowsnumber">'
. JText::sprintf('PLG_DEBUG_ROWS_RETURNED_BY_QUERY', $htmlResultsReturned) . '</span>';
$htmlTiming .= ' <span class="dbg-query-rowsnumber">' . JText::sprintf('PLG_DEBUG_ROWS_RETURNED_BY_QUERY', $htmlResultsReturned) . '</span>';
}
}

Expand Down Expand Up @@ -1001,8 +1008,8 @@ protected function displayQueries()

if (!$this->linkFormat)
{
$htmlCallStack .= '<div>[<a href="http://xdebug.org/docs/all_settings#file_link_format" target="_blank">'
. JText::_('PLG_DEBUG_LINK_FORMAT') . '</a>]</div>';
$htmlCallStack .= '<div>[<a href="http://xdebug.org/docs/all_settings#file_link_format" target="_blank">';
$htmlCallStack .= JText::_('PLG_DEBUG_LINK_FORMAT') . '</a>]</div>';
}
}

Expand Down Expand Up @@ -1162,11 +1169,11 @@ protected function displayQueries()
}

/**
* Render bars.
* Render the bars.
*
* @param array &$bars Array of bar data.
* @param string $class Optional class for items.
* @param integer $id Id of the bar to highlight.
* @param array &$bars Array of bar data
* @param string $class Optional class for items
* @param integer $id Id if the bar to highlight
*
* @return string
*
Expand Down Expand Up @@ -1198,18 +1205,18 @@ protected function renderBars(&$bars, $class = '', $id = null)
$tip = JHtml::tooltipText($bar->tip, '', 0);
}

$html[] = '<a class="bar dbg-bar ' . $barClass . '" title="' . $tip . '" style="width: '
. $bar->width . '%;" href="#dbg-' . $class . '-' . ($i + 1) . '"></a>';
$html[] = '<a class="bar dbg-bar ' . $barClass . '" title="' . $tip . '" style="width: ' .
$bar->width . '%;" href="#dbg-' . $class . '-' . ($i + 1) . '"></a>';
}

return '<div class="progress dbg-bars dbg-bars-' . $class . '">' . implode('', $html) . '</div>';
}

/**
* Render array as HTML table.
* Render an HTML table based on a multi-dimensional array.
*
* @param array $table Array to be rendered.
* @param boolean &$hasWarnings Changes value to true if warnings are displayed, otherwise untouched.
* @param array $table An array of tabular data.
* @param boolean &$hasWarnings Changes value to true if warnings are displayed, otherwise untouched
*
* @return string
*
Expand Down Expand Up @@ -1284,9 +1291,10 @@ protected function tableToHtml($table, &$hasWarnings)
{
if ($td === 'NULL')
{
// Displays query parts which don't use a key with warning.
$html[] = '<td><strong>' . '<span class="dbg-warning hasTooltip" title="' . JHtml::tooltipText('PLG_DEBUG_WARNING_NO_INDEX_DESC') . '">'
. JText::_('PLG_DEBUG_WARNING_NO_INDEX') . '</span>' . '</strong>';
// Displays query parts which don't use a key with warning:
$html[] = '<td><strong>' . '<span class="dbg-warning hasTooltip" title="' .
JHtml::tooltipText('PLG_DEBUG_WARNING_NO_INDEX_DESC') . '">' .
JText::_('PLG_DEBUG_WARNING_NO_INDEX') . '</span>' . '</strong>';
$hasWarnings = true;
}
else
Expand All @@ -1301,10 +1309,14 @@ protected function tableToHtml($table, &$hasWarnings)
// Replace spaces with &nbsp; (non-breaking spaces) for less tall tables displayed.
$htmlTd = preg_replace('/([^;]) /', '\1&nbsp;', $htmlTd);

// Displays warnings for "Using filesort".
$htmlTdWithWarnings = str_replace('Using&nbsp;filesort', '<span class="dbg-warning hasTooltip" title="'
. JHtml::tooltipText('PLG_DEBUG_WARNING_USING_FILESORT_DESC') . '">' . JText::_('PLG_DEBUG_WARNING_USING_FILESORT') . '</span>', $htmlTd
);
// Displays warnings for "Using filesort":
$htmlTdWithWarnings = str_replace(
'Using&nbsp;filesort',
'<span class="dbg-warning hasTooltip" title="' .
JHtml::tooltipText('PLG_DEBUG_WARNING_USING_FILESORT_DESC') . '">' .
JText::_('PLG_DEBUG_WARNING_USING_FILESORT') . '</span>',
$htmlTd
);

if ($htmlTdWithWarnings !== $htmlTd)
{
Expand Down

0 comments on commit fcd0643

Please sign in to comment.