private function SassNumber::convert in Sassy 7.3
Same name and namespace in other branches
- 7 phamlp/sass/script/literals/SassNumber.php \SassNumber::convert()
Converts values and units. If this is a unitless numeber it will take the units of other; if not other is coerced to the units of this.
Parameters
SassNumber the other number:
Return value
SassNumber the other number with its value and units coerced if neccessary
Throws
SassNumberException if the units are incompatible
2 calls to SassNumber::convert()
- SassNumber::op_minus in phpsass/
script/ literals/ SassNumber.php - Subtracts the value of other from this value
- SassNumber::op_plus in phpsass/
script/ literals/ SassNumber.php - Adds the value of other to the value of this
File
- phpsass/
script/ literals/ SassNumber.php, line 292
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 = 22mm. @package PHamlP @subpackage …
Code
private function convert($other) {
if ($this
->isUnitless()) {
$this->numeratorUnits = $other->numeratorUnits;
$this->denominatorUnits = $other->denominatorUnits;
}
else {
$other = $other
->coerce($this->numeratorUnits, $this->denominatorUnits);
}
return $other;
}