File "class.debugger.inc"
Full Path: /home/analogde/www/FTP/Code03/inc/class.debugger.inc
File size: 1.48 KB
MIME-type: text/x-php
Charset: utf-8
<?php
//
// $Id: class.debugger.inc,v1.0 2004-12-13 1:33a EST Onion Exp $
//
/*
* Debugger Class
*
* Just so that I don't have to see random errors and broken XML all over the place in case of a boo-boo.
*/
class Debugger {
/*
* Private Properties
*/
private $file = '';
private $class = '';
private $method = '';
private $line = 0;
private $expect = '';
private $result = '';
private $vars = array ();
/*
* Constructor
*
* void __construct ( string file, string class, string method, string line, string expect, string result, array vars )
*/
final public function __construct ( $file, $class, $method, $line, $expect, $result, $vars ) {
$this->file = $file;
$this->class = $class;
$this->method = $method;
$this->line = $line;
$this->expect = $expect;
$this->result = $result;
$this->vars = $vars;
}
/*
* toString Method
*
* string __toString ( void )
*/
final public function __toString ( ) {
$var_info = array ();
foreach ($this->vars as $var_name => $var) {
$var_info[] = "\tVariable: \$$var_name\n\tContents: ".var_export ($var, 1);
}
$reflect = new ReflectionMethod ($this->class, $this->method);
return vsprintf ("###########\n### BUG ###\n###########\n\nFile: %s\nClass: %s\nMethod: %s\nLine: %d\nExpected: %s\nActual Result: %s\nVariable Information: %s\nMethod Code: %s\n", array ($this->file, $this->class, $this->method, $this->line, $this->expect, $this->result, implode ("\n", $var_info), $reflect->__toString ()));
}
}