ExportInterface::getLabels should return a closure

This commit is contained in:
2016-12-22 17:56:53 +01:00
parent 49b3a7154e
commit e19868e595
3 changed files with 19 additions and 11 deletions

View File

@@ -315,18 +315,13 @@ class CSVFormatter implements FormatterInterface
foreach ($results as $row) {
$line = array();
foreach ($headers as $key) {
if (!array_key_exists($row[$key], $labels[$key])) {
throw new \LogicException("The value '".$row[$key]."' "
. "is not available from the labels defined by aggregator or report. "
. "The key provided by aggregator or report is '$key'");
}
$line[] = $labels[$key][$row[$key]];
$line[] = call_user_func($labels[$key], $row[$key]);
}
//append result
foreach ($resultsKeys as $key) {
$line[] = $labels[$key][$row[$key]];
$line[] = call_user_func($labels[$key], $row[$key]);
}
$r[] = $line;