diff --git a/app/Support/Units/Altitude.php b/app/Support/Units/Altitude.php index 4ea014cf..428dacfb 100644 --- a/app/Support/Units/Altitude.php +++ b/app/Support/Units/Altitude.php @@ -19,6 +19,15 @@ class Altitude extends \PhpUnitsOfMeasure\PhysicalQuantity\Length implements Arr return (string) round($value, 2); } + /** + * Return value in native unit as integer + * @return array + */ + public function toNumber() + { + return $this->toArray(); + } + /** * For the HTTP Resource call */ diff --git a/app/Support/Units/Distance.php b/app/Support/Units/Distance.php index 5cf390e0..6bcdd939 100644 --- a/app/Support/Units/Distance.php +++ b/app/Support/Units/Distance.php @@ -23,7 +23,7 @@ class Distance extends \PhpUnitsOfMeasure\PhysicalQuantity\Length implements Arr * Return value in native unit as integer * @return array */ - public function toInt() + public function toNumber() { return $this->toArray(); } diff --git a/app/Support/Units/Fuel.php b/app/Support/Units/Fuel.php index 28d0f541..7ae413d0 100644 --- a/app/Support/Units/Fuel.php +++ b/app/Support/Units/Fuel.php @@ -23,7 +23,7 @@ class Fuel extends \PhpUnitsOfMeasure\PhysicalQuantity\Mass implements Arrayable * Return value in native unit as integer * @return array */ - public function toInt() + public function toNumber() { return $this->toArray(); } diff --git a/app/Support/Units/Mass.php b/app/Support/Units/Mass.php index 26a5387d..0adf3d4e 100644 --- a/app/Support/Units/Mass.php +++ b/app/Support/Units/Mass.php @@ -19,6 +19,15 @@ class Mass extends \PhpUnitsOfMeasure\PhysicalQuantity\Mass implements Arrayable return (string) round($value, 2); } + /** + * Return value in native unit as integer + * @return array + */ + public function toNumber() + { + return $this->toArray(); + } + /** * For the HTTP Resource call */ diff --git a/app/Support/Units/Velocity.php b/app/Support/Units/Velocity.php index 7112493e..bdc3df56 100644 --- a/app/Support/Units/Velocity.php +++ b/app/Support/Units/Velocity.php @@ -23,7 +23,7 @@ class Velocity extends \PhpUnitsOfMeasure\PhysicalQuantity\Velocity implements A * Return value in native unit as integer * @return array */ - public function toInt() + public function toNumber() { return $this->toArray(); } diff --git a/app/Support/Units/Volume.php b/app/Support/Units/Volume.php index b425ebd2..922156fc 100644 --- a/app/Support/Units/Volume.php +++ b/app/Support/Units/Volume.php @@ -19,6 +19,15 @@ class Volume extends \PhpUnitsOfMeasure\PhysicalQuantity\Volume implements Array return (string) round($value, 2); } + /** + * Return value in native unit as integer + * @return array + */ + public function toNumber() + { + return $this->toArray(); + } + /** * For the HTTP Resource call */ diff --git a/tests/PIREPTest.php b/tests/PIREPTest.php index 756e9b37..b43c9bbe 100644 --- a/tests/PIREPTest.php +++ b/tests/PIREPTest.php @@ -131,15 +131,15 @@ class PIREPTest extends TestCase // Check that it has the fuel units $this->assertHasKeys($body['fuel_used'], ['lbs', 'kg']); - $this->assertEquals($pirep->fuel_used->toInt(), $body['fuel_used']['lbs']); + $this->assertEquals($pirep->fuel_used->toNumber(), $body['fuel_used']['lbs']); // Check that it has the distance units $this->assertHasKeys($body['distance'], ['km', 'nmi', 'mi']); - $this->assertEquals($pirep->distance->toInt(), $body['distance']['nmi']); + $this->assertEquals($pirep->distance->toNumber(), $body['distance']['nmi']); // Check the planned_distance field $this->assertHasKeys($body['planned_distance'], ['km', 'nmi', 'mi']); - $this->assertEquals($pirep->planned_distance->toInt(), $body['planned_distance']['nmi']); + $this->assertEquals($pirep->planned_distance->toNumber(), $body['planned_distance']['nmi']); } /**