@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | protected function configureOptions(OptionsResolver $resolver) |
| 53 | 53 | { |
| 54 | 54 | $resolver->setDefaults([ |
| 55 | - 'show_prefix' => function (Options $options) { |
|
| 55 | + 'show_prefix' => function(Options $options) { |
|
| 56 | 56 | if ($options['measurement_unit'] !== null) { |
| 57 | 57 | /** @var MeasurementUnit $unit */ |
| 58 | 58 | $unit = $options['measurement_unit']; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | return false; |
| 62 | 62 | }, |
| 63 | - 'is_integer' => function (Options $options) { |
|
| 63 | + 'is_integer' => function(Options $options) { |
|
| 64 | 64 | if ($options['measurement_unit'] !== null) { |
| 65 | 65 | /** @var MeasurementUnit $unit */ |
| 66 | 66 | $unit = $options['measurement_unit']; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | return true; |
| 70 | 70 | }, |
| 71 | - 'unit' => function (Options $options) { |
|
| 71 | + 'unit' => function(Options $options) { |
|
| 72 | 72 | if ($options['measurement_unit'] !== null) { |
| 73 | 73 | /** @var MeasurementUnit $unit */ |
| 74 | 74 | $unit = $options['measurement_unit']; |
@@ -77,12 +77,12 @@ discard block |
||
| 77 | 77 | return ''; |
| 78 | 78 | }, |
| 79 | 79 | 'decimals' => 2, |
| 80 | - 'error_mapping' => [ '.' => 'value'] |
|
| 80 | + 'error_mapping' => ['.' => 'value'] |
|
| 81 | 81 | ]); |
| 82 | 82 | |
| 83 | 83 | $resolver->setAllowedTypes('decimals', 'int'); |
| 84 | 84 | |
| 85 | - $resolver->setNormalizer('decimals', function (Options $options, $value) { |
|
| 85 | + $resolver->setNormalizer('decimals', function(Options $options, $value) { |
|
| 86 | 86 | // If the unit is integer based, then dont show any decimals |
| 87 | 87 | if ($options['is_integer']) { |
| 88 | 88 | return 0; |
@@ -125,9 +125,9 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | //Otherwise just output it |
| 127 | 127 | if (!empty($options['unit'])) { |
| 128 | - $format_string = '%.' . $options['decimals'] . 'f ' . $options['unit']; |
|
| 128 | + $format_string = '%.'.$options['decimals'].'f '.$options['unit']; |
|
| 129 | 129 | } else { //Dont add space after number if no unit was specified |
| 130 | - $format_string = '%.' . $options['decimals'] . 'f'; |
|
| 130 | + $format_string = '%.'.$options['decimals'].'f'; |
|
| 131 | 131 | } |
| 132 | 132 | return sprintf($format_string, $value); |
| 133 | 133 | } |
@@ -55,8 +55,8 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function getPrefixByMagnitude(int $magnitude) : array |
| 57 | 57 | { |
| 58 | - $prefixes_pos = ['' ,'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']; |
|
| 59 | - $prefixes_neg = ['' ,'m', 'μ', 'n', 'p', 'f', 'a', 'z', 'y']; |
|
| 58 | + $prefixes_pos = ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']; |
|
| 59 | + $prefixes_neg = ['', 'm', 'μ', 'n', 'p', 'f', 'a', 'z', 'y']; |
|
| 60 | 60 | |
| 61 | 61 | if ($magnitude >= 0) { |
| 62 | 62 | $nearest = (int) floor(abs($magnitude) / 3); |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | $value /= $divisor; |
| 106 | 106 | //Build the format string, e.g.: %.2d km |
| 107 | 107 | if ($unit !== '' || $symbol !== '') { |
| 108 | - $format_string = '%.' . $decimals . 'f ' . $symbol . $unit; |
|
| 108 | + $format_string = '%.'.$decimals.'f '.$symbol.$unit; |
|
| 109 | 109 | } else { |
| 110 | - $format_string = '%.' . $decimals . 'f'; |
|
| 110 | + $format_string = '%.'.$decimals.'f'; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | return sprintf($format_string, $value); |