1 | <?php |
||
13 | class HtmlTableBuilder { |
||
14 | |||
15 | /** |
||
16 | * @var HtmlTableHeaderBuilder[] |
||
17 | */ |
||
18 | private $headers = []; |
||
19 | |||
20 | /** |
||
21 | * Array of HtmlTableCellBuilder arrays |
||
22 | * |
||
23 | * @var array[] |
||
24 | */ |
||
25 | private $rows = []; |
||
26 | |||
27 | /** |
||
28 | * @var bool |
||
29 | */ |
||
30 | private $isSortable; |
||
31 | |||
32 | /** |
||
33 | * @param array $headers |
||
34 | */ |
||
35 | public function __construct( array $headers ) { |
||
40 | |||
41 | /** |
||
42 | * @param string|HtmlTableHeaderBuilder $header |
||
43 | * |
||
44 | * @throws InvalidArgumentException |
||
45 | */ |
||
46 | private function addHeader( $header ) { |
||
59 | |||
60 | /** |
||
61 | * @return HtmlTableHeaderBuilder[] |
||
62 | */ |
||
63 | public function getHeaders() { |
||
66 | |||
67 | /** |
||
68 | * @return array[] |
||
69 | */ |
||
70 | public function getRows() { |
||
73 | |||
74 | /** |
||
75 | * @return bool |
||
76 | */ |
||
77 | public function isSortable() { |
||
80 | |||
81 | /** |
||
82 | * Adds row with specified cells to table. |
||
83 | * |
||
84 | * @param string[]|HtmlTableCellBuilder[] $cells |
||
85 | * |
||
86 | * @throws InvalidArgumentException |
||
87 | */ |
||
88 | public function appendRow( array $cells ) { |
||
99 | |||
100 | /** |
||
101 | * Adds rows with specified cells to table. |
||
102 | * |
||
103 | * @param array[] $rows |
||
104 | * |
||
105 | * @throws InvalidArgumentException |
||
106 | */ |
||
107 | public function appendRows( array $rows ) { |
||
116 | |||
117 | /** |
||
118 | * Returns table as html. |
||
119 | * |
||
120 | * @return string |
||
121 | */ |
||
122 | public function toHtml() { |
||
156 | |||
157 | } |
||
158 |