phpvms/app/Support/Units/Fuel.php

32 lines
628 B
PHP
Raw Normal View History

<?php
namespace App\Support\Units;
2018-02-21 12:33:09 +08:00
use App\Contracts\Unit;
use PhpUnitsOfMeasure\PhysicalQuantity\Mass;
class Fuel extends Unit
{
public $responseUnits = [
'kg',
'lbs',
];
/**
* @param float $value
* @param string $unit
2018-08-27 00:40:04 +08:00
*
* @throws \PhpUnitsOfMeasure\Exception\NonNumericValue
* @throws \PhpUnitsOfMeasure\Exception\NonStringUnitName
*/
public function __construct($value, string $unit)
{
if (empty($value)) {
$value = 0;
}
$this->unit = setting('units.fuel');
$this->instance = new Mass($value, $unit);
}
}