public function SassNumber::op_plus in Sassy 7
Same name and namespace in other branches
- 7.3 phpsass/script/literals/SassNumber.php \SassNumber::op_plus()
* Adds the value of other to the value of this *
Parameters
mixed SassNumber|SassColour: value to add: * @return mixed SassNumber if other is a SassNumber or * SassColour if it is a SassColour
Overrides SassLiteral::op_plus
1 call to SassNumber::op_plus()
- SassNumber::isComparableTo in phamlp/
sass/ script/ literals/ SassNumber.php - * Returns a value indicating if this number can be compared to other. *
File
- phamlp/
sass/ script/ literals/ SassNumber.php, line 104
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 op_plus($other) {
if ($other instanceof SassColour) {
return $other
->op_plus($this);
}
elseif (!$other instanceof SassNumber) {
throw new SassNumberException('{what} must be a {type}', array(
'{what}' => Phamlp::t('sass', 'Number'),
'{type}' => Phamlp::t('sass', 'number'),
), SassScriptParser::$context->node);
}
else {
$other = $this
->convert($other);
return new SassNumber($this->value + $other->value . $this->units);
}
}