public static function calculate($currentValue, $pastValue, $quotientPrecision = 0, $appendPercentSign = true)
    {
        $number = self::getPercentageValue($currentValue - $pastValue, $pastValue, $quotientPrecision);
        if ($appendPercentSign) {
            return NumberFormatter::getInstance()->formatPercent($number, $quotientPrecision);
        }

        return NumberFormatter::getInstance()->format($number, $quotientPrecision);
    }
public static function calculate($currentValue, $pastValue, $quotientPrecision = 0, $appendPercentSign = true)
    {
        $number = self::getPercentageValue($currentValue - $pastValue, $pastValue, $quotientPrecision);
        if ($appendPercentSign) {
            return NumberFormatter::getInstance()->formatPercent($number, $quotientPrecision);
        }

        return NumberFormatter::getInstance()->format($number, $quotientPrecision);
    }
public static function calculate ( $ currentValue , $ pastValue , $ quotientPrecision = 0 , $ appendPercentSign = true ) { $ number = self :: getPercentageValue ( $ currentValue - $ pastValue , $ pastValue , $ quotientPrecision ) ; if ( $ appendPercentSign ) { return NumberFormatter :: getInstance ( ) -> formatPercent ( $ number , $ quotientPrecision ) ; } return NumberFormatter :: getInstance ( ) -> format ( $ number , $ quotientPrecision ) ; }
Calculates the evolution percentage for two arbitrary values.

@param float|int $currentValue The current metric value.
@param float|int $pastValue The value of the metric in the past. We measure the % change
from this value to $currentValue.
@param float|int $quotientPrecision The quotient precision to round to.
@param bool $appendPercentSign Whether to append a '%' sign to the end of the number or not.

@return string The evolution percent, eg `'15%'`.
Calculates the evolution percentage for two arbitrary values .