public function SassNumber::hasLegalUnits in Sassy 7.3
Same name and namespace in other branches
- 7 phamlp/sass/script/literals/SassNumber.php \SassNumber::hasLegalUnits()
Returns a value indicating if this number has units that can be represented in CSS.
Return value
boolean true if this number has units that can be represented in CSS, false if not
1 call to SassNumber::hasLegalUnits()
- SassNumber::toString in phpsass/
script/ literals/ SassNumber.php - Converts the number to a string with it's units if any. If the units are px the result is rounded down to the nearest integer, otherwise the result is rounded to the specified precision.
File
- phpsass/
script/ literals/ SassNumber.php, line 408
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
public function hasLegalUnits() {
return (empty($this->numeratorUnits) || count($this->numeratorUnits) === 1) && empty($this->denominatorUnits);
}