CalculateWidths
class CalculateWidths (View source)
Calculate column widths for table cells.
Influenced by Drush and webmozart/console.
Methods
No description
Given the total amount of available space, and the width of the columns to place, calculate the optimum column widths to use.
Calculate the longest cell data from any row of each of the cells.
Calculate the longest word and longest line in the provided data.
No description
Return all of the columns whose longest line length is less than or equal to the average width.
Distribute the remainig space among the columns that were not included in the list of "short" columns.
Return the length of the longest word in the string.
Details
__construct()
No description
calculate($availableWidth, ColumnWidths $dataWidths, ColumnWidths $minimumWidths)
Given the total amount of available space, and the width of the columns to place, calculate the optimum column widths to use.
calculateLongestCell($rows)
Calculate the longest cell data from any row of each of the cells.
calculateLongestWord($rows)
Calculate the longest word and longest line in the provided data.
protected
calculateColumnWidths($rows, callable $fn)
No description
getShortColumns($availableWidth, ColumnWidths $dataWidths, ColumnWidths $minimumWidths)
Return all of the columns whose longest line length is less than or equal to the average width.
distributeLongColumns($availableWidth, ColumnWidths $dataWidths, ColumnWidths $minimumWidths)
Distribute the remainig space among the columns that were not included in the list of "short" columns.
static protected int
longestWordLength(string $str)
Return the length of the longest word in the string.