Greatly expanded report functionality.

This commit is contained in:
James Cole
2014-12-28 08:54:53 +01:00
parent 9f23462c42
commit 4944b233b6
14 changed files with 540 additions and 316 deletions

View File

@@ -116,4 +116,25 @@ class ReportHelper implements ReportHelperInterface
return $array;
}
/**
* Sort an array where all 'amount' keys are positive floats.
*
* @param array $array
*
* @return array
*/
public function sortArray(array $array) {
uasort(
$array, function ($left, $right) {
if ($left['amount'] == $right['amount']) {
return 0;
}
return ($left['amount'] < $right['amount']) ? 1 : -1;
}
);
return $array;
}
}