Rename toInt to toNumber

This commit is contained in:
Nabeel Shahzad 2018-02-20 15:32:49 -06:00
parent b9e88527dd
commit 8386951511
7 changed files with 33 additions and 6 deletions

View File

@ -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
*/

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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
*/

View File

@ -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();
}

View File

@ -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
*/

View File

@ -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']);
}
/**