Cleanup SI Unit classes and interface for REST responses; fixes to a few METAR parsing issues
This commit is contained in:
@@ -10,6 +10,11 @@ use PhpUnitsOfMeasure\PhysicalQuantity\Velocity as VelocityUnit;
|
||||
*/
|
||||
class Velocity extends Unit
|
||||
{
|
||||
public $responseUnits = [
|
||||
'km/h',
|
||||
'knots',
|
||||
];
|
||||
|
||||
/**
|
||||
* @param float $value
|
||||
* @param string $unit
|
||||
@@ -21,10 +26,5 @@ class Velocity extends Unit
|
||||
{
|
||||
$this->unit = setting('units.speed');
|
||||
$this->instance = new VelocityUnit($value, $unit);
|
||||
|
||||
$this->units = [
|
||||
'knots' => round($this->instance->toUnit('knots'), 2),
|
||||
'km/h' => round($this->instance->toUnit('km/h'), 2),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user