Class CriticalI_Command_TableFormatter

Description

Formats information in an ASCII table for output by command line utilities.

Several formatting options are available. They are:

  • max-width: The maximum width of the table in characters (default 76)
  • border-top: A string to use for the table top border (default '')
  • border-header: A string to use for the border below the header (default '-')
  • border-row: A string to use for the border between rows (default '')
  • border-bottom: A string to use for the table bottom border (default '')
  • border-left: A string to use for the table left border (default '')
  • border-right: A string to use for the table right border (default '')
  • border-cell: A string to use for the vertical border between cells (default ' ')

Located in /Core/lib/CriticalI/Command/TableFormatter.php (line 19)


	
			
Variable Summary
 mixed $header
 mixed $options
 mixed $rows
Method Summary
 CriticalI_Command_TableFormatter __construct ([array $options = array()])
 void add_row (mixed $row)
 void apportion_width ( $columns,  $fullWidth,  $maxWidth,  $maxMethod,  $minMethod,  &$width)
 void build_columns ( &$width)
 void calculate_column_width ( $columns,  $fullWidth,  $wordWidth,  &$width)
 void format_row ( &$columns,  $width,  &$row,  &$output)
 void set_header (mixed $header)
 string to_string ()
Variables
mixed $header (line 22)
  • access: protected
mixed $options (line 21)
  • access: protected
mixed $rows (line 23)
  • access: protected
Methods
Constructor __construct (line 30)

Constructor

  • access: public
CriticalI_Command_TableFormatter __construct ([array $options = array()])
  • array $options: Formatting options
add_row (line 68)

Add a row of data to the table

  • access: public
void add_row (mixed $row)
  • mixed $row: A string or array of string for the row
apportion_width (line 209)

Determines column width when it is constrained

  • access: protected
void apportion_width ( $columns,  $fullWidth,  $maxWidth,  $maxMethod,  $minMethod,  &$width)
  • $columns
  • $fullWidth
  • $maxWidth
  • $maxMethod
  • $minMethod
  • &$width
build_columns (line 151)

Build the columns for formatting the table

  • access: protected
void build_columns ( &$width)
  • &$width
calculate_column_width (line 191)

Calculate the width to use for a set of columns

  • access: protected
void calculate_column_width ( $columns,  $fullWidth,  $wordWidth,  &$width)
  • $columns
  • $fullWidth
  • $wordWidth
  • &$width
format_row (line 118)

Format an individual row of data for output

  • access: protected
void format_row ( &$columns,  $width,  &$row,  &$output)
  • &$columns
  • $width
  • &$row
  • &$output
set_header (line 53)

Set the header for the table

  • access: public
void set_header (mixed $header)
  • mixed $header: A string or array of strings for the header
to_string (line 85)

Format the table and return it as a string

  • access: public
string to_string ()

Documentation generated on Wed, 25 Apr 2012 09:46:45 -0700 by phpDocumentor 1.4.3