Table.phpView Source

Show: PublicProtectedPrivateinherited
Table of Contents
Package
Default  

\Webbtj\Clico\Table

Package: Default
The Clico Table class allows for formatting tabular data for the CLI stdOut.

It utilizes the Text class to allow for decorating text for the CLI stdOut.

Properties

>VPropertyprivate$accessColumn
Details
Type
n/a
>VPropertyprivate$accessRow
Details
Type
n/a
>VPropertyprivate$headerLineCharacter = '='
Default value'='Details
Type
n/a
>VPropertyprivate$pipeCharacter = '|'
Default value'|'Details
Type
n/a
>VPropertyprivate$rowLineCharacter = '-'
Default value'-'Details
Type
n/a
>VPropertyprivate$rows = array()
Default valuearray()Details
Type
n/a

Methods

methodpublic__call(string $method, Array $args) : \Webbtj\Clico\Table

A catch-all used to send Text decoration methods down to table column(s)

Parameters
NameTypeDescription
$methodstring
$argsArray
Returns
TypeDescription
\Webbtj\Clico\Table
methodpublic__construct(Array $data = null, boolean $firstRowAsHeader = true) : void

Constructor. Can optionally populate the data. Can optionally set the first row of data as the header row.

Parameters
NameTypeDescription
$dataArray
$firstRowAsHeaderboolean
methodpublic__toString() : string

Render the entire table using Text instances

Returns
TypeDescription
string
methodpublicaddHeader(Array $row) : \Webbtj\Clico\Table

Add a header row. Unsets the previous header row.

Parameters
NameTypeDescription
$rowArray
Returns
TypeDescription
\Webbtj\Clico\Table
methodpublicaddRow(\Webbtj\Clico\Row $row) : \Webbtj\Clico\Table

Add a row

Parameters
NameTypeDescription
$row\Webbtj\Clico\Row
Returns
TypeDescription
\Webbtj\Clico\Table
methodpubliccell(integer $column, integer $row) : \Webbtj\Clico\Table

Target a specific cell for text decoration

Parameters
NameTypeDescription
$columninteger
$rowinteger
Returns
TypeDescription
\Webbtj\Clico\Table
methodpubliccolumn(integer $index = null) : \Webbtj\Clico\Table

Target an entire column for text decoration

Parameters
NameTypeDescription
$indexinteger
Returns
TypeDescription
\Webbtj\Clico\Table
methodpublicdistributeColumns(integer $maxWidth = 160) : \Webbtj\Clico\Table

Fit all columns to the table (width and height)

Parameters
NameTypeDescription
$maxWidthinteger
Returns
TypeDescription
\Webbtj\Clico\Table
methodpublicgetHeaderLineCharacter() : \Webbtj\Clico\Text

Get the character (decorated) used to separate the header row from the body

Returns
TypeDescription
\Webbtj\Clico\Text
methodpublicgetHeight() : void

Get the number of rows high the table is

methodpublicgetPipeCharacter() : \Webbtj\Clico\Text

Get the character (decorated) used to separate columns

Returns
TypeDescription
\Webbtj\Clico\Text
methodpublicgetRowLineCharacter() : \Webbtj\Clico\Text

Get the character (decorated) used to separate body rows

Returns
TypeDescription
\Webbtj\Clico\Text
methodpublicgetWidth() : integer

Get the number of columns wide the table is

Returns
TypeDescription
integer
methodpublicpopulate(Array $data = null) : \Webbtj\Clico\Table

Reformat Rows' and Columns' widths, heights, and separation characters as necessary.

Optionally add rows of data to the table

Parameters
NameTypeDescription
$dataArray
Returns
TypeDescription
\Webbtj\Clico\Table
methodprivatepushCharactersToRows() : void

Push the separation characters down to the rows

methodpublicrow(integer $index = null) : \Webbtj\Clico\Table

Target an entire row for text decoration

Parameters
NameTypeDescription
$indexinteger
Returns
TypeDescription
\Webbtj\Clico\Table
methodpublicsetFirstRowAsHeader() : \Webbtj\Clico\Table

Make the first row the header row

Returns
TypeDescription
\Webbtj\Clico\Table
methodpublicsetHeaderLineCharacter(String $char, boolean $pushToRows = true) : \Webbtj\Clico\Table

Set the character used to separate the header row from the body

Parameters
NameTypeDescription
$charString
$pushToRowsboolean
Returns
TypeDescription
\Webbtj\Clico\Table
methodpublicsetPipeCharacter(String $char, boolean $pushToRows = true) : \Webbtj\Clico\Table

Set the (decorated) character used to separate columns

Parameters
NameTypeDescription
$charString
$pushToRowsboolean
Returns
TypeDescription
\Webbtj\Clico\Table
methodpublicsetRowLineCharacter(String $char, boolean $pushToRows = true) : \Webbtj\Clico\Table

Set the charater used to separate body rows

Parameters
NameTypeDescription
$charString
$pushToRowsboolean
Returns
TypeDescription
\Webbtj\Clico\Table
Documentation was generated by phpDocumentor 2.8.5.