当前位置: 首页>>代码示例>>PHP>>正文


PHP Less_Environment::operate方法代码示例

本文整理汇总了PHP中Less_Environment::operate方法的典型用法代码示例。如果您正苦于以下问题:PHP Less_Environment::operate方法的具体用法?PHP Less_Environment::operate怎么用?PHP Less_Environment::operate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Less_Environment的用法示例。


在下文中一共展示了Less_Environment::operate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: operate

 public function operate($env, $op, $other)
 {
     $value = Less_Environment::operate($env, $op, $this->value, $other->value);
     $unit = clone $this->unit;
     if ($op === '+' || $op === '-') {
         if (!count($unit->numerator) && !count($unit->denominator)) {
             $unit->numerator = $other->unit->numerator;
             $unit->denominator = $other->unit->denominator;
         } elseif (!count($other->unit->numerator) && !count($other->unit->denominator)) {
             // do nothing
         } else {
             $other = $other->convertTo($this->unit->usedUnits());
             if ($env->strictUnits && $other->unit->toString() !== $unit->toCSS()) {
                 throw new Less_CompilerException("Incompatible units. Change the units or use the unit function. Bad units: '" . $unit->toString() . "' and " . $other->unit->toString() + "'.");
             }
             $value = Less_Environment::operate($env, $op, $this->value, $other->value);
         }
     } elseif ($op === '*') {
         $unit->numerator = array_merge($unit->numerator, $other->unit->numerator);
         $unit->denominator = array_merge($unit->denominator, $other->unit->denominator);
         sort($unit->numerator);
         sort($unit->denominator);
         $unit->cancel();
     } elseif ($op === '/') {
         $unit->numerator = array_merge($unit->numerator, $other->unit->denominator);
         $unit->denominator = array_merge($unit->denominator, $other->unit->numerator);
         sort($unit->numerator);
         sort($unit->denominator);
         $unit->cancel();
     }
     return new Less_Tree_Dimension($value, $unit);
 }
开发者ID:satokora,项目名称:IT354Project,代码行数:32,代码来源:Dimension.php

示例2: operate

 public function operate($env, $op, $other)
 {
     $result = array();
     if (!$other instanceof Less_Tree_Color) {
         $other = $other->toColor();
     }
     for ($c = 0; $c < 3; $c++) {
         $result[$c] = Less_Environment::operate($env, $op, $this->rgb[$c], $other->rgb[$c]);
     }
     return new Less_Tree_Color($result, $this->alpha + $other->alpha);
 }
开发者ID:satokora,项目名称:IT354Project,代码行数:11,代码来源:Color.php


注:本文中的Less_Environment::operate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。