ColumnWidths
class ColumnWidths (View source)
Calculate the width of data in table cells in preparation for word wrapping.
Properties
protected | $widths |
Methods
No description
No description
Find all of the columns that are shorter than the specified threshold.
Find all of the columns that are shorter than the corresponding minimum widths.
No description
If the widths specified by this object do not fit within the provided avaiable width, then reduce them all proportionally.
Return proportional weights
No description
Return the number of columns.
Calculate how much space is available on average for all columns.
Return the available keys (column identifiers) from the calculated data set.
Set the length of the specified column.
Return the length of the specified column.
Return all of the lengths
Return true if there is no data in this object
Return the sum of the lengths of the provided widths.
Return the sum of the lengths of the provided widths.
Ensure that every item in $widths that has a corresponding entry in $minimumWidths is as least as large as the minimum value held there.
Remove all of the specified columns from this data structure.
Select all columns that exist in the provided list of keys.
Combine this set of widths with another set, and return a new set that contains the entries from both.
Details
__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.
protected
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.