[ Index ]

PHP Cross Reference of DokuWiki




/vendor/splitbrain/php-cli/src/ -> TableFormatter.php (summary)

(no description)

File Size: 325 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

TableFormatter:: (12 methods):

Class: TableFormatter  - X-Ref

Class TableFormatter

Output text in multiple columns

__construct(Colors $colors = null)   X-Ref
TableFormatter constructor.

param: Colors|null $colors

getBorder()   X-Ref
The currently set border (defaults to ' ')

return: string

setBorder($border)   X-Ref
Set the border. The border is set between each column. Its width is
added to the column widths.

param: string $border

getMaxWidth()   X-Ref
Width of the terminal in characters

initially autodetected

return: int

setMaxWidth($max)   X-Ref
Set the width of the terminal to assume (in characters)

param: int $max

getTerminalWidth()   X-Ref
Tries to figure out the width of the terminal

return: int terminal width, 0 if unknown

calculateColLengths($columns)   X-Ref
Takes an array with dynamic column width and calculates the correct width

Column width can be given as fixed char widths, percentages and a single * width can be given
for taking the remaining available space. When mixing percentages and fixed widths, percentages
refer to the remaining space after allocating the fixed width

return: int[]
param: array $columns

format($columns, $texts, $colors = array()   X-Ref
Displays text in multiple word wrapped columns

return: string
param: int[] $columns list of column widths (in characters, percent or '*')
param: string[] $texts list of texts for each column
param: array $colors A list of color names to use for each column. use empty string for default

pad($string, $len)   X-Ref
Pad the given string to the correct length

return: string
param: string $string
param: int $len

strlen($string)   X-Ref
Measures char length in UTF-8 when possible

return: int
param: $string

substr($string, $start = 0, $length = null)   X-Ref

return: string
param: string $string
param: int $start
param: int|null $length

wordwrap($str, $width = 75, $break = "\n", $cut = false)   X-Ref

return: string
link: http://stackoverflow.com/a/4988494
param: string $str
param: int $width
param: string $break
param: bool $cut