SassColour::op_plus PHP Méthode

op_plus() public méthode

Colour addition
public op_plus ( $other ) : sassColour
Résultat sassColour the colour result
    public function op_plus($other)
    {
        if ($other instanceof SassNumber) {
            if (!$other->isUnitless()) {
                return new SassString($this->toString() . $other->value);
                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) {
            return new SassString($this->toString() . $other->value);
            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;
    }