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