ReportMetric represents a report data source metric.

Public Methods

public __construct()

public __construct(
    string $code,
    string $databaseColumnName,
    string $displayName,
    string $aggregateFunction,
    ?array $intlFormatOptions = null
): void

__construct a new metric instance.

public static findMetricByCode()

public static findMetricByCode(
    array $availableMetrics,
    string $metricCode
): ReportMetric|null 

Finds a metric by its code.

public static findMetricByCodeStrict()

public static findMetricByCodeStrict(
    array $availableMetrics,
    string $metricCode,
    bool $throw = true
): ?ReportMetric 

Finds a metric by its code. Throws an exception if the metric is not found.

public getAggregateFunction()

public getAggregateFunction(): string 

Returns the metric aggregate function.

public getCacheUniqueCode()

public getCacheUniqueCode(): string 

Returns code unique for this metric to be used as a part of a cache key.

public getCode()

public getCode(): string 

Returns the metric code.

public getDataSetColumName()

public getDataSetColumName(): string 

Returns a query column name corresponding to this metric.

public getDatabaseColumnName()

public getDatabaseColumnName(): string 

Returns the database column name for this metric.

public getDisplayName()

public getDisplayName(): string 

Returns the metric display name.

public getIntlFormatOptions()

public getIntlFormatOptions(): ?array 

Returns client-side data formatting options.