Packageindex Classtrees Modulegroups Elementlist Report XML Files

Softerra

Debug::Corban

public module Corban

"Corban, dear" - Debug Output Library.

Capable of facilitating the application development process quite considerably. It allows developers to derive information on variables, objects and resources. While the current version features just the html output derivation, the following releases are going to be supplemented with more info derivation types like ‘file’, ‘port’, ‘email’ and ‘database’.

Linkshttp://www.softerra.com/products/ - [Softerra PHP Developer Library Home Page]
AuthorsSofterra <phplib@softerra.com>
SincePHP 4.0.1pl2
Version1.3.5
Copyright(c) 1999-2002 Softerra, LLC

 

Public Method Summary

void cd(mixed $val, [ string $name, string $comment, boolean $die ])
Outputs a debug message.
void ci([ mixed $name ])
Inits the specified timer.
void cs([ mixed $name, string $comment ])
Displays timer value.

Private Method Summary

void corban_dear(mixed $val, [ string $name, string $comment, boolean $die, string $internal ])
Outputs a debug message.
void corban_die(boolean $die)
Outputs the die message and die a script.
string corban_bold(string $text)
Applies bold style to text.
string corban_format(string $text, [ string $color, integer $size ])
Formats text with specified color and size.
void corban_scalar(string $val, string $type, string $prefix)
Prints a debug message.
void corban_array(array $arr, string $prefix)
Outputs an array.
mixed corban_unserialize(string &$varlist)
Gets and returns a variable from a serialized object or its part.
void corban_object(object stdClass $obj, string $prefix)
Outputs an object.
void corban_resource(resource $res, string $prefix)
Outputs a resourse.
double corban_microtime()
Returns current time in microseconds.
double corban_timer([ mixed $name ])
Returns the specified timer value.
void corban_inittimer([ mixed $name ])
Inits the specified timer.
void corban_showtimer([ mixed $name, string $comment ])
Displays timer value.

Private Constant Summary

BR >><br><< Break line.
NBSP >>&nbsp;<< Non-breakable space.
FONTTEXT >><font face=\"Arial\" color=\"%s\" style=\"font-size:%dpt\">%s</font><< Default text style.
BOLDTEXT >><b>%s</b><< Bold text style.
CORBAN_DIE_SCREAM >><br>CORBAN MUST DIE!<br><< Die message.
CORBAN_PREFIX >>&nbsp;Corban, dear! [%d]:&nbsp;<< Debug message prefix.

Public Method Details

cd

public void cd( mixed $val, [ string $name, string $comment, boolean $die ] )

  Outputs a debug message.

cd() outputs a debug message. Supported PHP variable types:

  • boolean (green color);
  • integer (red color);
  • double (magenta color);
  • string (blue color);
  • array (navy color);
  • object (olive color);
  • resource (maroon color).
Note: The NULL type is not supported. If the variable type is NULL, the folowing message will be displayed: "...is not set or NULL".

You can use this function to output control debug messages or in case you want to check value and type of the specific variable.

Output format:

[Debug prefix Calls counter:] [Debug message comment] ( Variable name | Variable type) = (Variable value | "is not set" | "is empty")

Example:

  //Include required files
  require_once "corban.lib.php";
  require_once "sqlstorage.class.php";

  //Outputs the $HTTP_POST_VARS array
  cd ($HTTP_POST_VARS, "HTTP_POST_VARS");

  $storage = new sqlStorage ();
  //Outputs information on all the $storage object properties
  cd ($storage);
 

Parameter
mixed $val
Variable
string $name = >>""<<
Variable name to display
string $comment = >>""<<
Comment for variable
boolean $die = >>false<<
Defines to die or not after displaying
Returns void

See Also corban_dear()

ci

public void ci( [ mixed $name ] )

  Inits the specified timer.

Example:

  require_once "corban.lib.php";

  // Init timer with name "query"
  ci ("query");

  $query = "select * from USERS";
  mysql_query ($query, $connection);

  // Show timer with name "query"
  cs ("query");
 

Parameter
mixed $name = >>0<<
Timer name
Returns void

See Also corban_inittimer(), cs(), corban_showtimer()

cs

public void cs( [ mixed $name, string $comment ] )

  Displays timer value.

Parameter
mixed $name = >>0<<
Timer name
string $comment = >>""<<
Some comment text
Returns void

See Also corban_inittimer(), ci(), corban_showtimer()

Private Method Details

corban_dear

private void corban_dear( mixed $val, [ string $name, string $comment, boolean $die, string $internal ] )

  Outputs a debug message.

Parameter
mixed $val
Variable
string $name = >>""<<
Variable name to display
string $comment = >>""<<
Comment for variable
boolean $die = >>false<<
Defines to die or not after displaying
string $internal = >>""<<
Function call type
Returns void

Required global variables
$corban_counter Internal calls counter
$corban_blabla Defines need to output CORBAN_PREFIX
$corban_color Used colors array

corban_die

private void corban_die( boolean $die )

  Outputs the die message and die a script.

Parameter
boolean $die
Returns void

Required global variables
$corban_blabla Defines need to output CORBAN_PREFIX
$corban_color Used colors array

corban_bold

private string corban_bold( string $text )

  Applies bold style to text.

Parameter
string $text
Returns string

Bold formatted text


corban_format

private string corban_format( string $text, [ string $color, integer $size ] )

  Formats text with specified color and size.

Parameter
string $text
Text string
string $color = >>"black"<<
Text color
integer $size = >>8<<
Text size in pt.
Returns string

Formatted string


corban_scalar

private void corban_scalar( string $val, string $type, string $prefix )

  Prints a debug message.

Parameter
string $val
Variable value
string $type
Variable type
string $prefix
Output prefix
Returns void

Required global variables
array $corban_color Used colors array

corban_array

private void corban_array( array $arr, string $prefix )

  Outputs an array.

Parameter
array $arr
Array to output
string $prefix
Message prefix
Returns void

Required global variables
array $corban_color Used colors array

corban_unserialize

private mixed corban_unserialize( string &$varlist )

  Gets and returns a variable from a serialized object or its part.

Parameter
string &$varlist
Serialized object or it's part
Returns mixed

Unseralized value of object property


corban_object

private void corban_object( object stdClass $obj, string $prefix )

  Outputs an object.

Parameter
object stdClass $obj
Object to output
string $prefix
Debug prefix
Returns void

Required global variables
array $corban_color Used colors array

corban_resource

private void corban_resource( resource $res, string $prefix )

  Outputs a resourse.

Parameter
resource $res
Resource to output
string $prefix
Debug prefix
Returns void

Required global variables
array $corban_color Used colors array

corban_microtime

private double corban_microtime( )

  Returns current time in microseconds.

Returns current time measured in the number of microseconds since the Unix Epoch (0:00:00 January 1, 1970 GMT).

Returns double


corban_timer

private double corban_timer( [ mixed $name ] )

  Returns the specified timer value.

Parameter
mixed $name = >>0<<
Timer name
Returns double

Specified timer value

Required global variables
array $corban_timer Array of timers

corban_inittimer

private void corban_inittimer( [ mixed $name ] )

  Inits the specified timer.

Parameter
mixed $name = >>0<<
Timer name
Returns void

Required global variables
array $corban_timer Array of timers
See Also ci(), cs(), corban_showtimer()

corban_showtimer

private void corban_showtimer( [ mixed $name, string $comment ] )

  Displays timer value.

Parameter
mixed $name = >>0<<
Timer name
string $comment = >>""<<
Some comment text
Returns void

See Also corban_inittimer(), ci(), cs()

Private Constant Details

BR

define( BR, >><br><< )
Case: default: case sensitive

Break line.


NBSP

define( NBSP, >>&nbsp;<< )
Case: default: case sensitive

Non-breakable space.


FONTTEXT

define( FONTTEXT, >><font face=\"Arial\" color=\"%s\" style=\"font-size:%dpt\">%s</font><< )
Case: default: case sensitive

Default text style.


BOLDTEXT

define( BOLDTEXT, >><b>%s</b><< )
Case: default: case sensitive

Bold text style.


CORBAN_DIE_SCREAM

define( CORBAN_DIE_SCREAM, >><br>CORBAN MUST DIE!<br><< )
Case: default: case sensitive

Die message.


CORBAN_PREFIX

define( CORBAN_PREFIX, >>&nbsp;Corban, dear! [%d]:&nbsp;<< )
Case: default: case sensitive

Debug message prefix.



Packageindex Classtrees Modulegroups Elementlist Report XML Files