public static function Calculator::ceil in Commerce Core 8.2
Calculates the next highest whole value of a number.
Parameters
string $number: A numeric string value.
Return value
string The result.
1 call to Calculator::ceil()
- CalculatorTest::testRounding in modules/
price/ tests/ src/ Unit/ CalculatorTest.php - @covers ::ceil @covers ::floor @covers ::round
File
- modules/
price/ src/ Calculator.php, line 109
Class
- Calculator
- Provides helpers for bcmath-based arithmetic.
Namespace
Drupal\commerce_priceCode
public static function ceil(string $number) : string {
if (self::compare($number, 0) == 1) {
$result = bcadd($number, '1', 0);
}
else {
$result = bcadd($number, '0', 0);
}
return $result;
}