public function SassColour::op_plus in Sassy 7.3
Same name and namespace in other branches
- 7 phamlp/sass/script/literals/SassColour.php \SassColour::op_plus()
Colour addition
Parameters
mixed SassColour|SassNumber value to add:
Return value
sassColour the colour result
Overrides SassLiteral::op_plus
File
- phpsass/
script/ literals/ SassColour.php, line 350
Class
- SassColour
- SassColour class. A SassScript object representing a CSS colour.
Code
public function op_plus($other) {
if ($other instanceof SassNumber) {
if (!$other
->isUnitless()) {
throw new SassColourException('Number must be a unitless number', SassScriptParser::$context->node);
}
$this->red = $this
->getRed() + $other->value;
$this->green = $this
->getGreen() + $other->value;
$this->blue = $this
->getBlue() + $other->value;
}
elseif (!$other instanceof SassColour) {
throw new SassColourException('Argument must be a SassColour or SassNumber', SassScriptParser::$context->node);
}
else {
$this->red = $this
->getRed() + $other
->getRed();
$this->green = $this
->getGreen() + $other
->getGreen();
$this->blue = $this
->getBlue() + $other
->getBlue();
}
return $this;
}