MDL-71258 questions: privacy support for settings defaults preferences

This commit is contained in:
Mahmoud Kassaei 2021-04-14 16:54:49 +01:00 committed by Tim Hunt
parent 5b315fa595
commit d25f0453cf
28 changed files with 1587 additions and 72 deletions

View file

@ -80,4 +80,18 @@ class transform {
return get_string('no');
}
}
/**
* Translate a float value which should be between 0.0 and 1.0 into percentage.
*
* @param float $value The value between 0.0 and 1.0.
* @return float|string
*/
public static function percentage(float $value) {
if (is_float($value)) {
return (100 * $value) . '%';
} else {
return $value;
}
}
}