function _format_report_number in Acquia Lift Connector 7.2
Formats a number value for use in reports.
Parameters
$value: The number of format (or an empty value).
$trim: Boolean indicating whether the number should be trimmed of trailing 0s.
$decimals: The number of decimal places to display.
$padding: The total number of characters to pad to the left of the decimal point.
Return value
string The formatted number to display.
6 calls to _format_report_number()
- AcquiaLiftLearnReport::getAggregatedData in includes/
AcquiaLiftLearnReport.inc - Returns the per-variation confidence report data aggregated over dates.
- AcquiaLiftLearnReport::getDailyData in includes/
AcquiaLiftLearnReport.inc - Gets the per-day confidence report from the report data source.
- _build_overview_report in ./
acquia_lift.admin.inc - Returns a render array representing the overview report for the given dates.
- _extract_daily_data in ./
acquia_lift.admin.inc - Extracts daily stats from the reporting API into results that can be displayed.
- _extract_experiment_results in ./
acquia_lift.admin.inc - Extracts aggregated stats from the reporting API into results that can be displayed.
File
- ./
acquia_lift.admin.inc, line 2838 - acquia_lift.admin.inc Provides functions needed for the admin UI.
Code
function _format_report_number($value, $trim = TRUE, $decimals = 2, $padding = 1) {
if (is_numeric($value)) {
$value = number_format($value, $decimals);
if ($trim && strpos('.', $value) !== FALSE) {
$value = rtrim(rtrim($value, '0'), '.');
}
if ($padding > 0) {
$value = str_pad($value, $padding, '0', STR_PAD_LEFT);
}
}
if (empty($value)) {
$value = 0;
}
return $value;
}