SassLiteral::op_div PHP Method

op_div() public method

SassScript '/' operation.
public op_div ( SassLiteral $other ) : sassString
$other SassLiteral value to divide by
return sassString the string values of this and other seperated by '/'
    public function op_div($other)
    {
        return new SassString($this->toString() . ' / ' . $other->toString());
    }

Usage Example

Esempio n. 1
0
 /**
  * Divides this value by the value of other
  * 
  * @param
  *        	mixed SassNumber|SassColour: value to divide by
  * @return mixed SassNumber if other is a SassNumber or
  *         SassColour if it is a SassColour
  */
 public function op_div($other)
 {
     if ($other instanceof SassColour) {
         return $other->op_div($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);
     } elseif ($this->inExpression || $other->inExpression) {
         return new SassNumber($this->value / $other->value . $this->unitString(array_merge($this->numeratorUnits, $other->denominatorUnits), array_merge($this->denominatorUnits, $other->numeratorUnits)));
     } else {
         return parent::op_div($other);
     }
 }