/** * Compare distance to last set * @param float $currentDistance [km] * @param float $previousDistance [km] * @return string */ protected function distanceComparison($currentDistance, $previousDistance) { $Percentage = $this->distanceComparisonPercentage($currentDistance, $previousDistance); $String = $Percentage != 0 ? sprintf("%+d", $Percentage) . ' %' : '-'; $Stress = new Stresscolor($Percentage); $Stress->scale(0, 30); return ' <small style="display:inline-block;width:55px;color:#' . $Stress->rgb() . '">' . $String . '</small>'; }
/** * Compare distance to last set * @return string */ private function distanceComparison() { if (!$this->compareKM) { return ''; } $Percentage = $this->distanceComparisonPercentage(); $String = $Percentage != 0 ? sprintf("%+d", $Percentage) . ' %' : '-'; $this->kmOfLastSet = $this->Activity->distance(); $Stress = new Stresscolor($Percentage); $Stress->scale(0, 30); return ' <small style="display:inline-block;width:55px;color:#' . $Stress->rgb() . '">' . $String . '</small>'; }