| @@ -109,7 +109,7 @@ discard block | ||
| 109 | 109 | ]; | 
| 110 | 110 | // Normalize the min | 
| 111 | 111 |          if (!empty($this->min)) { | 
| 112 | - $config['value'] = (float)$this->min; | |
| 112 | + $config['value'] = (float) $this->min; | |
| 113 | 113 | $baseUnit = new UnitsData($config); | 
| 114 | 114 | $this->min = $baseUnit->toUnit($unitsData->units); | 
| 115 | 115 |          } else { | 
| @@ -117,7 +117,7 @@ discard block | ||
| 117 | 117 | } | 
| 118 | 118 | // Normalize the max | 
| 119 | 119 |          if (!empty($this->max)) { | 
| 120 | - $config['value'] = (float)$this->max; | |
| 120 | + $config['value'] = (float) $this->max; | |
| 121 | 121 | $baseUnit = new UnitsData($config); | 
| 122 | 122 | $this->max = $baseUnit->toUnit($unitsData->units); | 
| 123 | 123 |          } else { | 
| @@ -25,7 +25,7 @@ | ||
| 25 | 25 | */ | 
| 26 | 26 | public static function dump($dirs, $file) | 
| 27 | 27 |      { | 
| 28 | - $dirs = (array)$dirs; | |
| 28 | + $dirs = (array) $dirs; | |
| 29 | 29 | $maps = []; | 
| 30 | 30 |          foreach ($dirs as $dir) { | 
| 31 | 31 | $maps = array_merge($maps, static::createMap($dir)); | 
| @@ -163,7 +163,7 @@ discard block | ||
| 163 | 163 |          if (!empty($value)) { | 
| 164 | 164 | // Handle a numeric value coming in (perhaps from a Number field) | 
| 165 | 165 |              if (\is_numeric($value)) { | 
| 166 | - $config['value'] = (float)$value; | |
| 166 | + $config['value'] = (float) $value; | |
| 167 | 167 |              } elseif (\is_string($value)) { | 
| 168 | 168 | $config = Json::decodeIfJson($value); | 
| 169 | 169 | } | 
| @@ -172,7 +172,7 @@ discard block | ||
| 172 | 172 | } | 
| 173 | 173 | } | 
| 174 | 174 | // Typecast it to a float | 
| 175 | - $config['value'] = (float)$config['value']; | |
| 175 | + $config['value'] = (float) $config['value']; | |
| 176 | 176 | // Create and validate the model | 
| 177 | 177 | $unitsData = new UnitsData($config); | 
| 178 | 178 |          if (!$unitsData->validate()) { | 
| @@ -205,7 +205,7 @@ discard block | ||
| 205 | 205 | */ | 
| 206 | 206 | public function toFraction(): string | 
| 207 | 207 |      { | 
| 208 | - return trim(Units::$variable->fraction($this->value) . ' ' . $this->units); | |
| 208 | + return trim(Units::$variable->fraction($this->value).' '.$this->units); | |
| 209 | 209 | } | 
| 210 | 210 | /** | 
| 211 | 211 | * Return the measurement as a fraction, in the given unit of measure | 
| @@ -254,7 +254,7 @@ discard block | ||
| 254 | 254 | public function getValuePartsFraction(): array | 
| 255 | 255 |      { | 
| 256 | 256 | $parts = Units::$variable->float2parts($this->value); | 
| 257 | - $parts[0] = (string)$parts[0]; | |
| 257 | + $parts[0] = (string) $parts[0]; | |
| 258 | 258 | $parts[1] = Units::$variable->float2ratio($parts[1]); | 
| 259 | 259 | |
| 260 | 260 | return $parts; | 
| @@ -273,7 +273,7 @@ discard block | ||
| 273 | 273 | protected function physicalQuantityToUnitsData(PhysicalQuantityInterface $quantity): UnitsData | 
| 274 | 274 |      { | 
| 275 | 275 | $unitsClass = \get_class($quantity); | 
| 276 | -        list($value, $units) = explode(' ', (string)$quantity); | |
| 276 | +        list($value, $units) = explode(' ', (string) $quantity); | |
| 277 | 277 | $config = [ | 
| 278 | 278 | 'unitsClass' => $unitsClass, | 
| 279 | 279 | 'value' => $value, | 
| @@ -71,7 +71,7 @@ discard block | ||
| 71 | 71 | Event::on( | 
| 72 | 72 | Fields::class, | 
| 73 | 73 | Fields::EVENT_REGISTER_FIELD_TYPES, | 
| 74 | -            function (RegisterComponentTypesEvent $event) { | |
| 74 | +            function(RegisterComponentTypesEvent $event) { | |
| 75 | 75 | $event->types[] = UnitsField::class; | 
| 76 | 76 | } | 
| 77 | 77 | ); | 
| @@ -80,7 +80,7 @@ discard block | ||
| 80 | 80 | Event::on( | 
| 81 | 81 | CraftVariable::class, | 
| 82 | 82 | CraftVariable::EVENT_INIT, | 
| 83 | -            function (Event $event) { | |
| 83 | +            function(Event $event) { | |
| 84 | 84 | /** @var CraftVariable $variable */ | 
| 85 | 85 | $variable = $event->sender; | 
| 86 | 86 |                  $variable->set('units', self::$variable); | 
| @@ -90,7 +90,7 @@ discard block | ||
| 90 | 90 | Event::on( | 
| 91 | 91 | Plugins::class, | 
| 92 | 92 | Plugins::EVENT_AFTER_INSTALL_PLUGIN, | 
| 93 | -            function (PluginEvent $event) { | |
| 93 | +            function(PluginEvent $event) { | |
| 94 | 94 |                  if ($event->plugin === $this) { | 
| 95 | 95 | } | 
| 96 | 96 | } | 
| @@ -99,14 +99,14 @@ discard block | ||
| 99 | 99 | Event::on( | 
| 100 | 100 | UnitsField::class, | 
| 101 | 101 | 'craftQlGetFieldSchema', | 
| 102 | -            function ($event) { | |
| 102 | +            function($event) { | |
| 103 | 103 | $field = $event->sender; | 
| 104 | 104 | |
| 105 | 105 |                  if (!$field instanceof UnitsField) { | 
| 106 | 106 | return; | 
| 107 | 107 | } | 
| 108 | 108 | |
| 109 | - $object = $event->schema->createObjectType(ucfirst($field->handle) . 'Units'); | |
| 109 | + $object = $event->schema->createObjectType(ucfirst($field->handle).'Units'); | |
| 110 | 110 |                  $object->addFloatField('value'); | 
| 111 | 111 |                  $object->addStringField('units'); | 
| 112 | 112 | |