public function SassNumber::op_div in Sassy 7.3
Same name and namespace in other branches
- 7 phamlp/sass/script/literals/SassNumber.php \SassNumber::op_div()
Divides this value by the value of other
Parameters
mixed SassNumber|SassColour: value to divide by:
Return value
mixed SassNumber if other is a SassNumber or SassColour if it is a SassColour
Overrides SassLiteral::op_div
File
- phpsass/
script/ literals/ SassNumber.php, line 183
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 op_div($other) {
if ($other instanceof SassColour) {
return $other
->op_div($this);
}
elseif (!$other instanceof SassNumber) {
throw new SassNumberException('Number must be a number', SassScriptParser::$context->node);
}
elseif ($this->inExpression || $other->inExpression) {
return new SassNumber($this->value / $other->value . $this
->unitString(array_merge($this->numeratorUnits, $other->denominatorUnits), array_merge($this->denominatorUnits, $other->numeratorUnits)));
}
else {
return parent::op_div($other);
}
}