class WordWrapper (View source)

Properties

protected $width
protected $minimumWidths
protected $extraPaddingAtBeginningOfLine
protected $extraPaddingAtEndOfLine
protected $paddingInEachCell

Methods

__construct($width)

No description

setPaddingFromStyle(TableStyle $style)

Calculate our padding widths from the specified table style.

setPaddingFromSymfony5Style(TableStyle $style)

Calculate our padding widths from the specified table style.

setMinimumWidths(array $minimumWidths)

If columns have minimum widths, then set them here.

minimumWidth($colkey, $width)

Set the minimum width of just one column

array
wrap(array $rows, $widths = [])

Wrap the cells in each part of the provided data table

calculateWidths($rows, $widths = [])

Determine what widths we'll use for wrapping.

mixed
wrapCell(mixed $cell, string $cellWidth)

Wrap one cell. Guard against modifying non-strings and then call through to wordwrap().

Details

__construct($width)

No description

Parameters

$width

setPaddingFromStyle(TableStyle $style)

Calculate our padding widths from the specified table style.

Parameters

TableStyle $style

setPaddingFromSymfony5Style(TableStyle $style)

Calculate our padding widths from the specified table style.

Parameters

TableStyle $style

setMinimumWidths(array $minimumWidths)

If columns have minimum widths, then set them here.

Parameters

array $minimumWidths

minimumWidth($colkey, $width)

Set the minimum width of just one column

Parameters

$colkey
$width

array wrap(array $rows, $widths = [])

Wrap the cells in each part of the provided data table

Parameters

array $rows
$widths

Return Value

array

protected calculateWidths($rows, $widths = [])

Determine what widths we'll use for wrapping.

Parameters

$rows
$widths

protected mixed wrapCell(mixed $cell, string $cellWidth)

Wrap one cell. Guard against modifying non-strings and then call through to wordwrap().

Parameters

mixed $cell
string $cellWidth

Return Value

mixed