本文整理汇总了PHP中Less_Environment::isMathOn方法的典型用法代码示例。如果您正苦于以下问题:PHP Less_Environment::isMathOn方法的具体用法?PHP Less_Environment::isMathOn怎么用?PHP Less_Environment::isMathOn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Less_Environment
的用法示例。
在下文中一共展示了Less_Environment::isMathOn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compile
public function compile($env)
{
$doubleParen = false;
if ($this->parens && !$this->parensInOp) {
Less_Environment::$parensStack++;
}
$returnValue = null;
if ($this->value) {
$count = count($this->value);
if ($count > 1) {
$ret = array();
foreach ($this->value as $e) {
$ret[] = $e->compile($env);
}
$returnValue = new Less_Tree_Expression($ret);
} else {
if ($this->value[0] instanceof Less_Tree_Expression && $this->value[0]->parens && !$this->value[0]->parensInOp) {
$doubleParen = true;
}
$returnValue = $this->value[0]->compile($env);
}
} else {
$returnValue = $this;
}
if ($this->parens) {
if (!$this->parensInOp) {
Less_Environment::$parensStack--;
} elseif (!Less_Environment::isMathOn() && !$doubleParen) {
$returnValue = new Less_Tree_Paren($returnValue);
}
}
return $returnValue;
}
示例2: compile
public function compile($env)
{
if (Less_Environment::isMathOn()) {
$ret = new Less_Tree_Operation('*', array(new Less_Tree_Dimension(-1), $this->value));
return $ret->compile($env);
}
return new Less_Tree_Negative($this->value->compile($env));
}
示例3: compile
public function compile($env)
{
$a = $this->operands[0]->compile($env);
$b = $this->operands[1]->compile($env);
if (Less_Environment::isMathOn()) {
if ($a instanceof Less_Tree_Dimension && $b instanceof Less_Tree_Color) {
$a = $a->toColor();
} elseif ($b instanceof Less_Tree_Dimension && $a instanceof Less_Tree_Color) {
$b = $b->toColor();
}
if (!method_exists($a, 'operate')) {
throw new Less_Exception_Compiler("Operation on an invalid type");
}
return $a->operate($this->op, $b);
}
return new Less_Tree_Operation($this->op, array($a, $b), $this->isSpaced);
}