@@ -127,8 +127,8 @@ |
||
| 127 | 127 | 'units/settings', |
| 128 | 128 | [ |
| 129 | 129 | 'settings' => $this->getSettings(), |
| 130 | - 'unitsClassMap' => $unitsClassMap, |
|
| 131 | - ] |
|
| 130 | + 'unitsClassMap' => $unitsClassMap, |
|
| 131 | + ] |
|
| 132 | 132 | ); |
| 133 | 133 | } |
| 134 | 134 | } |
@@ -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 | |
@@ -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 { |
@@ -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, |
@@ -25,7 +25,7 @@ discard block |
||
| 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)); |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | break; |
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | - $classes[] = ltrim($namespace . $class, '\\'); |
|
| 135 | + $classes[] = ltrim($namespace.$class, '\\'); |
|
| 136 | 136 | break; |
| 137 | 137 | default: |
| 138 | 138 | break; |
@@ -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 | /** |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | if (!empty($value)) { |
| 163 | 163 | // Handle a numeric value coming in (perhaps from a Number field) |
| 164 | 164 | if (\is_numeric($value)) { |
| 165 | - $config['value'] = (float)$value; |
|
| 165 | + $config['value'] = (float) $value; |
|
| 166 | 166 | } elseif (\is_string($value)) { |
| 167 | 167 | $config = Json::decodeIfJson($value); |
| 168 | 168 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | // Typecast it to a float |
| 174 | - $config['value'] = (float)$config['value']; |
|
| 174 | + $config['value'] = (float) $config['value']; |
|
| 175 | 175 | // Create and validate the model |
| 176 | 176 | $unitsData = new UnitsData($config); |
| 177 | 177 | if (!$unitsData->validate()) { |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | 'prefix' => Craft::$app->getView()->namespaceInputId(''), |
| 235 | 235 | ]; |
| 236 | 236 | $jsonVars = Json::encode($jsonVars); |
| 237 | - Craft::$app->getView()->registerJs("$('#{$namespacedId}-field').UnitsUnits(" . $jsonVars . ");"); |
|
| 237 | + Craft::$app->getView()->registerJs("$('#{$namespacedId}-field').UnitsUnits(".$jsonVars.");"); |
|
| 238 | 238 | |
| 239 | 239 | // Render the input template |
| 240 | 240 | return Craft::$app->getView()->renderTemplate( |