| @@ 34-45 (lines=12) @@ | ||
| 31 | return $this->reorderFieldLabels($fields, $fieldLabels, $data); |
|
| 32 | } |
|
| 33 | ||
| 34 | protected function reorderFieldLabels($fields, $fieldLabels, $data) |
|
| 35 | { |
|
| 36 | $result = []; |
|
| 37 | foreach ($fields as $field) { |
|
| 38 | if (array_key_exists($field, $data[0])) { |
|
| 39 | if (array_key_exists($field, $fieldLabels)) { |
|
| 40 | $result[$field] = $fieldLabels[$field]; |
|
| 41 | } |
|
| 42 | } |
|
| 43 | } |
|
| 44 | return $result; |
|
| 45 | } |
|
| 46 | ||
| 47 | protected function getSelectedFieldKeys($fields, $fieldLabels) |
|
| 48 | { |
|
| @@ 18-25 (lines=8) @@ | ||
| 15 | } |
|
| 16 | } |
|
| 17 | ||
| 18 | protected function transformRow($row, $fieldLabels) |
|
| 19 | { |
|
| 20 | $result = []; |
|
| 21 | foreach ($fieldLabels as $key => $label) { |
|
| 22 | $result[$key] = array_key_exists($key, $row) ? $row[$key] : ''; |
|
| 23 | } |
|
| 24 | return $result; |
|
| 25 | } |
|
| 26 | ||
| 27 | public function getHeaders() |
|
| 28 | { |
|