* @copyright 2005 by gERD Schaufelberger * @package wombatSite * @subpackage debugger */ /** * Debugger_Text * * @version 1.0.0 * @package wombatSite * @subpackage debugger */ class wbDebugger_Text extends wbDebugger { /** * format string for output * * @abstract * @access public * @param string $var */ function sprint( $var ) { return $var; } /** * capture output of print_r to add it to debug info * * @access public * @param mixed &$var * @param string $type print_r|var_dump */ function sprint_r( &$var, $type = 'print_r' ) { ob_start(); $type( $var ); $tmp = ob_get_contents(); ob_end_clean(); return $tmp; } /** * echo debug messages * * * @access private * @param string $part named part * @return boolean $result true on success */ function printMessages( $part = null ) { if( !$this->_active ) { return true; } echo "\n Debugger::Text\n"; echo "=========================================================================\n"; echo " Wombat Web Bench http://wombat.exit0.net\n"; echo "=========================================================================\n"; $empty = true; if( $part != null ) { $parts = array( $part ); } else { $parts = array_keys( $this->_msg ); } foreach( $parts as $part ) { if( empty( $this->_msg[$part] ) ) { continue; } $empty = false; echo "\n-------------------------------------------------------------------------\n"; echo " $part\n"; echo "-------------------------------------------------------------------------\n"; if( !empty( $this->_msg[$part] ) ) { for( $i = 0; $i < count( $this->_msg[$part] ); ++$i ) { $text = $this->_msg[$part][$i]['text']; $title = $this->_msg[$part][$i]['title']; echo sprintf( "%13.13s : %s\n", $title, $text ); } } else { echo " --- empty log ---\n"; } } if( $empty ) { echo " --- empty log ---\n"; return true; } return true; } } ?>