class Percentage (View source)

Helper methods for the batch system.

Methods

static string
format(int $total, int $current)

Formats the percent completion for a batch set.

Details

static string format(int $total, int $current)

Formats the percent completion for a batch set.

Parameters

int $total

The total number of operations.

int $current

The number of the current operation. This may be a floating point number rather than an integer in the case of a multi-step operation that is not yet complete; in that case, the fractional part of $current represents the fraction of the operation that has been completed.

Return Value

string

The properly formatted percentage, as a string. We output percentages using the correct number of decimal places so that we never print "100%" until we are finished, but we also never print more decimal places than are meaningful.

See also

_batch_process()