1 | <?php |
||
6 | class TableTransformation extends \ArrayObject implements TableDataInterface |
||
7 | { |
||
8 | protected $headers; |
||
9 | protected $rowLabels; |
||
10 | protected $layout; |
||
11 | |||
12 | const TABLE_LAYOUT = 'table'; |
||
13 | const LIST_LAYOUT = 'list'; |
||
14 | 7 | ||
15 | public function __construct($data, $fieldLabels, $rowLabels = []) |
||
23 | |||
24 | 3 | public function setLayout($layout) |
|
28 | |||
29 | public function getLayout() |
||
33 | |||
34 | 7 | public function isList() |
|
38 | |||
39 | 7 | protected static function transformRows($data, $fieldLabels) |
|
47 | |||
48 | 7 | protected static function transformRow($row, $fieldLabels) |
|
56 | |||
57 | 7 | public function getHeaders() |
|
61 | |||
62 | 3 | public function getHeader($key) |
|
69 | |||
70 | public function getRowLabels() |
||
74 | |||
75 | 7 | public function getRowLabel($rowid) |
|
82 | 7 | ||
83 | public function getData() |
||
87 | 3 | ||
88 | 3 | public function getTableData($includeRowKey = false) |
|
99 | 3 | ||
100 | 3 | protected function convertTableToList() |
|
101 | 3 | { |
|
102 | 3 | $result = []; |
|
103 | 3 | foreach ($this as $row) { |
|
104 | 3 | foreach ($row as $key => $value) { |
|
105 | 3 | $result[$key][] = $value; |
|
106 | } |
||
107 | } |
||
108 | return $result; |
||
109 | } |
||
110 | |||
111 | protected function getRowDataWithKey($data) |
||
122 | } |
||
123 |