| 1 | <?php |
||
| 14 | class TableRenderer { |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Starts the table. |
||
| 18 | * |
||
| 19 | * @param null|string $classes |
||
| 20 | * @return string |
||
| 21 | */ |
||
| 22 | 33 | public function open(? string $classes = null) : string |
|
| 26 | |||
| 27 | /** |
||
| 28 | * Closes the table. |
||
| 29 | * |
||
| 30 | * @return string |
||
| 31 | */ |
||
| 32 | 33 | public function close() : string |
|
| 36 | |||
| 37 | /** |
||
| 38 | * Renders the column headers. |
||
| 39 | * |
||
| 40 | * @param array $headers |
||
| 41 | * @param array $formatters |
||
| 42 | * @return string |
||
| 43 | */ |
||
| 44 | 33 | public function renderHeaders(array $headers, array $formatters = []) : string |
|
| 57 | |||
| 58 | /** |
||
| 59 | * Displays the table body. |
||
| 60 | * |
||
| 61 | * @param Collection $data |
||
| 62 | * |
||
| 63 | * @param array $columns |
||
| 64 | * @return string |
||
| 65 | */ |
||
| 66 | 33 | public function renderBody(Collection $data, array $columns = []) : string |
|
| 76 | |||
| 77 | /** |
||
| 78 | * Displays a single row. |
||
| 79 | * |
||
| 80 | * @param Model $rowModel |
||
| 81 | * |
||
| 82 | * @param array $columns |
||
| 83 | * @return string |
||
| 84 | */ |
||
| 85 | 33 | private function _renderRow(Model $rowModel, array $columns) : string |
|
| 97 | } |
||
| 98 |