'color_name_using_css_names')
*
* @var array(int=>string)
*/
private $verbosityColors = array();
/**
* Constructs a new HTML reporter.
*/
public function __construct()
{
}
/**
* Sets the output $color of debug messages of the verbosity $verbosity.
*
* $color must be specified in a CSS color value.
*
* @param int $verbosity
* @param string $color
*
* @deprecated This method does not have any effect anymore. Use CSS instead.
*/
public function setVerbosityColor( $verbosity, $color )
{
$this->verbosityColors[$verbosity] = $color;
}
/**
* Returns a string containing the HTML formatted output.
*
* Returns the data submitted in $timerData and $writerData as an HTML
* formatted string to be displayed in a web browser.
*
* @param array $writerData
* @param array(ezcDebugStructure) $timerData
* @return string
*/
public function generateOutput( array $writerData, array $timerData )
{
$str = '
';
$str .= $this->getLog( $writerData );
$str .= $this->getTimingsAccumulator( $timerData );
$str .= "
\n";
return $str;
}
/**
* Returns a string containing the HTML formatted output based on $writerData.
*
* @param array $writerData
* @return string
*/
public function getLog( array $writerData )
{
$str = "\n";
foreach ( $writerData as $w )
{
$color = isset( $this->verbosityColors[$w->verbosity]) ? $this->verbosityColors[$w->verbosity] : "";
$date = date( 'Y-m-d H:i:s O', $w->datetime );
$str .= <<
\n";
return $str;
}
/**
* Returns an HTML formatted representation of the given $stackTrace.
*
* Iterates through the given $stackTrace and returns an HTML formatted
* string representation.
*
* @param ezcDebugStacktraceIterator $stackTrace
* @return string
*/
public function formatStackTrace( ezcDebugStacktraceIterator $stackTrace )
{
$res = <<
#
|
Function
|
Location
|
EOT;
foreach ( $stackTrace as $index => $element )
{
$function = ( isset( $element['class'] ) ? "{$element['class']}::" : '' )
. $element['function'] . '('
. implode( ', ', $element['params'] )
. ')';
$location = "{$element['file']}:{$element['line']}";
$res .= <<
$index
|
$function
|
$location
|
EOT;
}
$res .= "\n";
return $res;
}
/**
* Returns a string containing the HTML formatted output based on $timerData.
*
* @param array(ezcDebugStructure) $timerData
* @return string
*/
public function getTimingsAccumulator( array $timerData )
{
$groups = $this->getGroups( $timerData );
if ( sizeof( $groups ) > 0 )
{
$str = <<
Timings |
Elapsed |
Percent |
Count |
Average |
ENDT;
foreach ( $groups as $groupName => $group )
{
$str .= <<