You are here

protected function AcquiaLiftReportBase::formatReportNumber in Acquia Lift Connector 7

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 AcquiaLiftReportBase::formatReportNumber()
AcquiaLiftReport::extractConfidenceReportData in plugins/agent_types/AcquiaLiftAgent.inc
Extracts the required confidence report data from the items returned by Acquia Lift.
AcquiaLiftReport::extractTargetingReportData in plugins/agent_types/AcquiaLiftAgent.inc
Extracts the required targeting report data from the items returned by Acquia Lift.
AcquiaLiftReportBase::extractConversionReportData in plugins/agent_types/AcquiaLiftAgent.inc
Extracts data from the raw confidence detail report that is prepared for use within the conversion report rendering process.
AcquiaLiftReportBase::extractConversionSummaryData in plugins/agent_types/AcquiaLiftAgent.inc
Extracts data from the raw aggregate confidence report that is prepared for use within the report rendering process.
AcquiaLiftReportBase::extractOverviewReportData in plugins/agent_types/AcquiaLiftAgent.inc
Extracts the required overview data from the report data returned by Acquia Lift.

... See full list

File

plugins/agent_types/AcquiaLiftAgent.inc, line 1530
Provides an agent type for Acquia Lift

Class

AcquiaLiftReportBase
Base class providing report data loading functionality common to all Acquia Lift Reports.

Code

protected function formatReportNumber($value, $trim = TRUE, $decimals = 2, $padding = 1) {
  if (is_numeric($value)) {
    $value = number_format($value, $decimals);
    if ($trim) {
      $value = rtrim(rtrim($value, '0'), '.');
    }
    if ($padding > 0) {
      $value = str_pad($value, $padding, '0', STR_PAD_LEFT);
    }
  }
  if (empty($value)) {
    $value = 0;
  }
  return $value;
}