mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-07 13:08:40 +00:00
Fix after tests
This commit is contained in:
parent
56b0a40c81
commit
7c2ebba47b
|
|
@ -26,6 +26,15 @@ namespace phpOMS\Utils\Converter;
|
||||||
*/
|
*/
|
||||||
class Measurement
|
class Measurement
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @codeCoverageIgnore
|
||||||
|
*/
|
||||||
|
private function __construct()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert temperature.
|
* Convert temperature.
|
||||||
|
|
@ -88,7 +97,7 @@ class Measurement
|
||||||
$value = ($value - 273.15) * 1.5 - 100;
|
$value = ($value - 273.15) * 1.5 - 100;
|
||||||
break;
|
break;
|
||||||
case TemperatureType::NEWTON:
|
case TemperatureType::NEWTON:
|
||||||
$value = ($value - 273.15) / 0.33;
|
$value = ($value - 273.15) * 0.33;
|
||||||
break;
|
break;
|
||||||
case TemperatureType::ROMER:
|
case TemperatureType::ROMER:
|
||||||
$value = ($value - 273.15) * 0.525 + 7.5;
|
$value = ($value - 273.15) * 0.525 + 7.5;
|
||||||
|
|
@ -1221,7 +1230,7 @@ class Measurement
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public static function convertEnergie(float $value, string $from = EnergyPowerType::JOULS, string $to = EnergyPowerType::KILOWATT_HOUERS) : float
|
public static function convertEnergy(float $value, string $from = EnergyPowerType::JOULS, string $to = EnergyPowerType::KILOWATT_HOUERS) : float
|
||||||
{
|
{
|
||||||
switch ($from) {
|
switch ($from) {
|
||||||
case EnergyPowerType::JOULS:
|
case EnergyPowerType::JOULS:
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ class Numeric
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
private function __construct()
|
private function __construct()
|
||||||
{
|
{
|
||||||
|
|
@ -73,7 +74,7 @@ class Numeric
|
||||||
$newOutput = 0;
|
$newOutput = 0;
|
||||||
|
|
||||||
for ($i = 1; $i <= $numberLen; $i++) {
|
for ($i = 1; $i <= $numberLen; $i++) {
|
||||||
$newOutput = bcadd($newOutput, bcmul(array_search($number[$i - 1], $fromBase), bcpow($fromLen, $numberLen - $i)));
|
$newOutput = bcadd((string) $newOutput, bcmul((string) array_search($number[$i - 1], $fromBase), bcpow((string) $fromLen, (string) ($numberLen - $i))));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $newOutput;
|
return $newOutput;
|
||||||
|
|
@ -86,8 +87,8 @@ class Numeric
|
||||||
}
|
}
|
||||||
|
|
||||||
while ($base10 !== '0') {
|
while ($base10 !== '0') {
|
||||||
$newOutput = $toBase[bcmod($base10, $toLen)] . $newOutput;
|
$newOutput = $toBase[bcmod($base10, (string) $toLen)] . $newOutput;
|
||||||
$base10 = bcdiv($base10, $toLen, 0);
|
$base10 = bcdiv($base10, (string) $toLen, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $newOutput;
|
return $newOutput;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user