You are here

public function SassNumber::op_times in Sassy 7

Same name and namespace in other branches
  1. 7.3 phpsass/script/literals/SassNumber.php \SassNumber::op_times()

* Multiplies this value by the value of other *

Parameters

mixed SassNumber|SassColour: value to multiply by: * @return mixed SassNumber if other is a SassNumber or * SassColour if it is a SassColour

Overrides SassLiteral::op_times

File

phamlp/sass/script/literals/SassNumber.php, line 162

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_times($other) {
  if ($other instanceof SassColour) {
    return $other
      ->op_times($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 {
    return new SassNumber($this->value * $other->value . $this
      ->unitString(array_merge($this->numeratorUnits, $other->numeratorUnits), array_merge($this->denominatorUnits, $other->denominatorUnits)));
  }
}