protected function mergeDataTables(DataTable\DataTableInterface $dataTable, DataTable\DataTableInterface $dataTable2)
{
if ($dataTable instanceof DataTable\Map) {
$dataTables = $dataTable->getDataTables();
foreach ($dataTables as $label => $table) {
$versionDataTables = $dataTable2->getDataTables();
if (!array_key_exists($label, $versionDataTables)) {
continue;
}
$newDataTable = $this->mergeDataTables($table, $versionDataTables[$label]);
$dataTable->addTable($newDataTable, $label);
}
} else {
if (!$dataTable->getRowsCount() && $dataTable2->getRowsCount()) {
$dataTable2->filter('GroupBy', array('label', function ($label) {
if (preg_match("/(.+) [0-9]+(?:\\.[0-9]+)?\$/", $label, $matches)) {
return $matches[1];
// should match for browsers
}
if (strpos($label, ';')) {
return substr($label, 0, 3);
// should match for os
}
return $label;
}));
return $dataTable2;
}
}
return $dataTable;
}