1 | <?php |
||
8 | class WordWrapper |
||
9 | { |
||
10 | protected $width; |
||
11 | protected $minimumWidths; |
||
12 | |||
13 | // For now, hardcode these to match what the Symfony Table helper does. |
||
14 | // Note that these might actually need to be adjusted depending on the |
||
15 | // table style. |
||
16 | protected $extraPaddingAtBeginningOfLine = 0; |
||
17 | protected $extraPaddingAtEndOfLine = 0; |
||
18 | protected $paddingInEachCell = 3; |
||
19 | |||
20 | public function __construct($width) |
||
25 | |||
26 | /** |
||
27 | * Calculate our padding widths from the specified table style. |
||
28 | * @param TableStyle $style |
||
29 | */ |
||
30 | public function setPaddingFromStyle(TableStyle $style) |
||
39 | |||
40 | /** |
||
41 | * If columns have minimum widths, then set them here. |
||
42 | * @param array $minimumWidths |
||
43 | */ |
||
44 | public function setMinimumWidths($minimumWidths) |
||
48 | |||
49 | /** |
||
50 | * Set the minimum width of just one column |
||
51 | */ |
||
52 | public function minimumWidth($colkey, $width) |
||
56 | |||
57 | /** |
||
58 | * Wrap the cells in each part of the provided data table |
||
59 | * @param array $rows |
||
60 | * @return array |
||
61 | */ |
||
62 | public function wrap($rows, $widths = []) |
||
81 | |||
82 | /** |
||
83 | * Determine what widths we'll use for wrapping. |
||
84 | */ |
||
85 | protected function calculateWidths($rows, $widths = []) |
||
106 | |||
107 | /** |
||
108 | * Wrap one cell. Guard against modifying non-strings and |
||
109 | * then call through to wordwrap(). |
||
110 | * |
||
111 | * @param mixed $cell |
||
112 | * @param string $cellWidth |
||
113 | * @return mixed |
||
114 | */ |
||
115 | protected function wrapCell($cell, $cellWidth) |
||
122 | } |
||
123 |