class ColumnWidths (View source)

Calculate the width of data in table cells in preparation for word wrapping.

Properties

protected $widths

Methods

__construct($widths = [])

No description

paddingSpace($paddingInEachCell, $extraPaddingAtEndOfLine = 0, $extraPaddingAtBeginningOfLine = 0)

No description

findShortColumns($thresholdWidth)

Find all of the columns that are shorter than the specified threshold.

findUndersizedColumns($minimumWidths)

Find all of the columns that are shorter than the corresponding minimum widths.

findColumnsUnderThreshold(array $thresholdWidths)

No description

adjustMinimumWidths($availableWidth, $dataCellWidths)

If the widths specified by this object do not fit within the provided avaiable width, then reduce them all proportionally.

distribute($availableWidth)

Return proportional weights

lastColumn()

No description

count()

Return the number of columns.

averageWidth($availableWidth)

Calculate how much space is available on average for all columns.

keys()

Return the available keys (column identifiers) from the calculated data set.

setWidth($key, $width)

Set the length of the specified column.

width($key)

Return the length of the specified column.

widths()

Return all of the lengths

isEmpty()

Return true if there is no data in this object

totalWidth()

Return the sum of the lengths of the provided widths.

static 
sumWidth($widths)

Return the sum of the lengths of the provided widths.

enforceMinimums($minimumWidths)

Ensure that every item in $widths that has a corresponding entry in $minimumWidths is as least as large as the minimum value held there.

removeColumns($columnKeys)

Remove all of the specified columns from this data structure.

selectColumns($columnKeys)

Select all columns that exist in the provided list of keys.

combine(ColumnWidths $combineWith)

Combine this set of widths with another set, and return a new set that contains the entries from both.

Details

__construct($widths = [])

No description

Parameters

$widths

paddingSpace($paddingInEachCell, $extraPaddingAtEndOfLine = 0, $extraPaddingAtBeginningOfLine = 0)

No description

Parameters

$paddingInEachCell
$extraPaddingAtEndOfLine
$extraPaddingAtBeginningOfLine

findShortColumns($thresholdWidth)

Find all of the columns that are shorter than the specified threshold.

Parameters

$thresholdWidth

findUndersizedColumns($minimumWidths)

Find all of the columns that are shorter than the corresponding minimum widths.

Parameters

$minimumWidths

protected findColumnsUnderThreshold(array $thresholdWidths)

No description

Parameters

array $thresholdWidths

adjustMinimumWidths($availableWidth, $dataCellWidths)

If the widths specified by this object do not fit within the provided avaiable width, then reduce them all proportionally.

Parameters

$availableWidth
$dataCellWidths

distribute($availableWidth)

Return proportional weights

Parameters

$availableWidth

lastColumn()

No description

count()

Return the number of columns.

averageWidth($availableWidth)

Calculate how much space is available on average for all columns.

Parameters

$availableWidth

keys()

Return the available keys (column identifiers) from the calculated data set.

setWidth($key, $width)

Set the length of the specified column.

Parameters

$key
$width

width($key)

Return the length of the specified column.

Parameters

$key

widths()

Return all of the lengths

isEmpty()

Return true if there is no data in this object

totalWidth()

Return the sum of the lengths of the provided widths.

static sumWidth($widths)

Return the sum of the lengths of the provided widths.

Parameters

$widths

enforceMinimums($minimumWidths)

Ensure that every item in $widths that has a corresponding entry in $minimumWidths is as least as large as the minimum value held there.

Parameters

$minimumWidths

removeColumns($columnKeys)

Remove all of the specified columns from this data structure.

Parameters

$columnKeys

selectColumns($columnKeys)

Select all columns that exist in the provided list of keys.

Parameters

$columnKeys

combine(ColumnWidths $combineWith)

Combine this set of widths with another set, and return a new set that contains the entries from both.

Parameters

ColumnWidths $combineWith