You are here

public static function SassScriptFunctions::round in Sassy 7.3

Same name and namespace in other branches
  1. 7 phamlp/sass/script/SassScriptFunctions.php \SassScriptFunctions::round()

Rounds a number to the nearest whole number. For example: round(10.4px) => 10px round(10.6px) => 11px

Parameters

SassNumber The number to round:

Return value

new SassNumber The rounded number

Throws

SassScriptFunctionException If $number is not a number

File

phpsass/script/SassScriptFunctions.php, line 618

Class

SassScriptFunctions
SassScript functions class. A collection of functions for use in SassSCript. @package PHamlP @subpackage Sass.script

Code

public static function round($number) {
  SassLiteral::assertType($number, 'SassNumber');
  return new SassNumber(round($number->value) . $number->units);
}