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


PHP Rule::run方法代码示例

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


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

示例1: repeat

 public function repeat($val, $element)
 {
     $data = $this->parseFunction($val, $element);
     //$this->dataStorage[$element] = $data;
     foreach ($data as $iteration) {
         $clone = $element->cloneNode(true);
         $this->dataStorage[$clone] = $iteration;
         $element->parentNode->insertBefore($clone, $element);
         //Re-run the hook on the new element, but use the iterated data
         $newRule = $this->rule;
         //Don't run repeat on the clones element or it will loop forever
         unset($newRule['rules']['repeat']);
         $hook = new Rule($newRule, $iteration, $this->dataStorage);
         $hook->run($clone);
     }
     //Remove the original element so only the ones that have been looped over will show
     $element->parentNode->removeChild($element);
     return false;
 }
开发者ID:TomBZombie,项目名称:cds-benchmarks,代码行数:19,代码来源:Rule.php

示例2: run

 /**
  * @see Rule::run()
  **/
 public function run()
 {
     return parent::run(!($this->value >= $this->min && $this->value <= $this->max));
 }
开发者ID:ToddBudde,项目名称:phrails,代码行数:7,代码来源:IntegerRangeRule.php

示例3: repeat

 public function repeat($value, $element, $rule)
 {
     foreach ($value as $iteration) {
         $clone = $element->cloneNode(true);
         $this->data->bind($clone, $iteration);
         $element->parentNode->insertBefore($clone, $element);
         //Re-run the hook on the new element, but use the iterated data
         $newRules = $rule->getRules();
         //Don't run repeat on the clones element or it will loop forever
         unset($newRules['repeat']);
         $hook = new Rule($newRules, $rule->getPseudoMatcher(), $this->data);
         foreach ($rule->getProperties() as $obj) {
             $hook->registerProperties($obj);
         }
         $hook->run($clone);
     }
     //Remove the original element so only the ones that have been looped over will show
     $element->parentNode->removeChild($element);
     return false;
 }
开发者ID:smolinari,项目名称:Transphporm,代码行数:20,代码来源:BasicProperties.php

示例4: run

 /**
  * @see Rule::run()
  **/
 public function run()
 {
     return parent::run(strlen($this->value) != $this->length);
 }
开发者ID:ToddBudde,项目名称:phrails,代码行数:7,代码来源:LengthRule.php

示例5: repeat

 public function repeat($value, $element, $rule)
 {
     if ($element->getAttribute('transphporm') === 'added') {
         return $element->parentNode->removeChild($element);
     }
     foreach ($value as $key => $iteration) {
         $clone = $element->cloneNode(true);
         //Mark this node as having been added by transphporm
         $clone->setAttribute('transphporm', 'added');
         $this->data->bind($clone, $iteration, 'iteration');
         $this->data->bind($clone, $key, 'key');
         $element->parentNode->insertBefore($clone, $element);
         //Re-run the hook on the new element, but use the iterated data
         $newRules = $rule->getRules();
         //Don't run repeat on the clones element or it will loop forever
         unset($newRules['repeat']);
         $hook = new Rule($newRules, $rule->getPseudoMatcher(), $this->data);
         foreach ($rule->getProperties() as $obj) {
             $hook->registerProperties($obj);
         }
         $hook->run($clone);
     }
     //Flag the original element for removal
     $element->setAttribute('transphporm', 'remove');
     return false;
 }
开发者ID:beingsane,项目名称:Transphporm,代码行数:26,代码来源:BasicProperties.php

示例6: run

 /**
  * @see Rule::run()
  **/
 public function run()
 {
     return parent::run(!preg_match($this->preg, $this->value));
 }
开发者ID:ToddBudde,项目名称:phrails,代码行数:7,代码来源:PregRule.php

示例7: run

 /**
  * @see Rule::run()
  **/
 public function run()
 {
     return parent::run($this->value == '' || $this->value == null);
 }
开发者ID:ToddBudde,项目名称:phrails,代码行数:7,代码来源:RequiredRule.php

示例8: run

 /**
  * @see Rule::run()
  **/
 public function run()
 {
     return parent::run(true);
 }
开发者ID:ToddBudde,项目名称:phrails,代码行数:7,代码来源:LockedRule.php

示例9: run

 /**
  * @see Rule::run()
  **/
 public function run()
 {
     return parent::run(!is_numeric($this->value));
 }
开发者ID:ToddBudde,项目名称:phrails,代码行数:7,代码来源:IntegerRule.php

示例10: run

 /**
  * @see Rule::run()
  **/
 public function run()
 {
     return parent::run($this->value != 0 && $this->value != 1);
 }
开发者ID:ToddBudde,项目名称:phrails,代码行数:7,代码来源:BooleanRule.php

示例11: run

 /**
  * @see Rule::run()
  **/
 public function run()
 {
     return parent::run(!(strlen($this->value) >= $this->min && strlen($this->value) <= $this->max));
 }
开发者ID:ToddBudde,项目名称:phrails,代码行数:7,代码来源:LengthRangeRule.php


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