@@ -5,7 +5,7 @@ |
||
| 5 | 5 | |
| 6 | 6 | return static function(ECSConfig $ecsConfig): void { |
| 7 | 7 | $ecsConfig->paths([ |
| 8 | - __DIR__ . '/src', |
|
| 8 | + __DIR__.'/src', |
|
| 9 | 9 | __FILE__, |
| 10 | 10 | ]); |
| 11 | 11 | $ecsConfig->parallel(); |
@@ -108,7 +108,7 @@ |
||
| 108 | 108 | { |
| 109 | 109 | list($whole, $decimal) = $this->float2parts($value); |
| 110 | 110 | |
| 111 | - return $whole . ' ' . $this->float2ratio($decimal); |
|
| 111 | + return $whole.' '.$this->float2ratio($decimal); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -106,7 +106,7 @@ |
||
| 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 | |
@@ -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 | /** |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | public function getValuePartsFraction(): array |
| 256 | 256 | { |
| 257 | 257 | $parts = Units::$variable->float2parts($this->value); |
| 258 | - $parts[0] = (string)$parts[0]; |
|
| 258 | + $parts[0] = (string) $parts[0]; |
|
| 259 | 259 | $parts[1] = Units::$variable->float2ratio($parts[1]); |
| 260 | 260 | |
| 261 | 261 | return $parts; |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | protected function physicalQuantityToUnitsData(PhysicalQuantityInterface $quantity): UnitsData |
| 275 | 275 | { |
| 276 | 276 | $unitsClass = get_class($quantity); |
| 277 | - list($value, $units) = explode(' ', (string)$quantity); |
|
| 277 | + list($value, $units) = explode(' ', (string) $quantity); |
|
| 278 | 278 | $config = [ |
| 279 | 279 | 'unitsClass' => $unitsClass, |
| 280 | 280 | 'value' => $value, |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | if (!empty($value)) { |
| 158 | 158 | // Handle a numeric value coming in (perhaps from a Number field) |
| 159 | 159 | if (is_numeric($value)) { |
| 160 | - $config['value'] = (float)$value; |
|
| 160 | + $config['value'] = (float) $value; |
|
| 161 | 161 | } elseif (is_string($value)) { |
| 162 | 162 | $config = Json::decodeIfJson($value); |
| 163 | 163 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | // Typecast it to a float |
| 169 | - $config['value'] = (float)$config['value']; |
|
| 169 | + $config['value'] = (float) $config['value']; |
|
| 170 | 170 | // Create and validate the model |
| 171 | 171 | $unitsData = new UnitsData($config); |
| 172 | 172 | if (!$unitsData->validate()) { |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | 'prefix' => Craft::$app->getView()->namespaceInputId(''), |
| 230 | 230 | ]; |
| 231 | 231 | $jsonVars = Json::encode($jsonVars); |
| 232 | - Craft::$app->getView()->registerJs("$('#{$namespacedId}-field').UnitsUnits(" . $jsonVars . ");"); |
|
| 232 | + Craft::$app->getView()->registerJs("$('#{$namespacedId}-field').UnitsUnits(".$jsonVars.");"); |
|
| 233 | 233 | |
| 234 | 234 | // Render the input template |
| 235 | 235 | return Craft::$app->getView()->renderTemplate( |
@@ -114,6 +114,6 @@ |
||
| 114 | 114 | public static function getName($context = null): string |
| 115 | 115 | { |
| 116 | 116 | /** @var Units $context */ |
| 117 | - return $context->handle . '_UnitsData'; |
|
| 117 | + return $context->handle.'_UnitsData'; |
|
| 118 | 118 | } |
| 119 | 119 | } |