You are here

public function SassNumber::toInt in Sassy 7

Same name and namespace in other branches
  1. 7.3 phpsass/script/literals/SassNumber.php \SassNumber::toInt()

* Returns the integer value. *

Return value

integer the integer value. * @throws SassNumberException if the number is not an integer

File

phamlp/sass/script/literals/SassNumber.php, line 485

Class

SassNumber
SassNumber class. Provides operations and type testing for Sass numbers. Units are of the passed value are converted the those of the class value if it has units. e.g. 2cm + 20mm = 4cm while 2 + 20mm =…

Code

public function toInt() {
  if (!$this
    ->isInt()) {
    throw new SassNumberException('Not an integer: {value}', array(
      '{value}' => $this->value,
    ), SassScriptParser::$context->node);
  }
  return intval($this->value);
}