本文整理汇总了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;
}
示例2: run
/**
* @see Rule::run()
**/
public function run()
{
return parent::run(!($this->value >= $this->min && $this->value <= $this->max));
}
示例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;
}
示例4: run
/**
* @see Rule::run()
**/
public function run()
{
return parent::run(strlen($this->value) != $this->length);
}
示例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;
}
示例6: run
/**
* @see Rule::run()
**/
public function run()
{
return parent::run(!preg_match($this->preg, $this->value));
}
示例7: run
/**
* @see Rule::run()
**/
public function run()
{
return parent::run($this->value == '' || $this->value == null);
}
示例8: run
/**
* @see Rule::run()
**/
public function run()
{
return parent::run(true);
}
示例9: run
/**
* @see Rule::run()
**/
public function run()
{
return parent::run(!is_numeric($this->value));
}
示例10: run
/**
* @see Rule::run()
**/
public function run()
{
return parent::run($this->value != 0 && $this->value != 1);
}
示例11: run
/**
* @see Rule::run()
**/
public function run()
{
return parent::run(!(strlen($this->value) >= $this->min && strlen($this->value) <= $this->max));
}