當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。