private function ManageFilesForm::precentage in Minify JS 8.2
Same name and namespace in other branches
- 8 src/Form/ManageFilesForm.php \Drupal\minifyjs\Form\ManageFilesForm::precentage()
Helper function to format the savings percentage.
Parameters
object $file: The file to generate the percentage for.
Return value
string The percentage value.
1 call to ManageFilesForm::precentage()
- ManageFilesForm::buildForm in src/
Form/ ManageFilesForm.php - Form constructor.
File
- src/
Form/ ManageFilesForm.php, line 367
Class
- ManageFilesForm
- Manage files form class.
Namespace
Drupal\minifyjs\FormCode
private function precentage($file) {
if ($file->minified_uri) {
if ($file->minified_size > 0) {
return round(($file->size - $file->minified_size) / $file->size * 100, 2) . '%';
}
return 0 . '%';
}
return '-';
}