本文整理匯總了PHP中Nette\Utils\Callback::isStatic方法的典型用法代碼示例。如果您正苦於以下問題:PHP Callback::isStatic方法的具體用法?PHP Callback::isStatic怎麽用?PHP Callback::isStatic使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Nette\Utils\Callback
的用法示例。
在下文中一共展示了Callback::isStatic方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: exportRules
/**
* @return array
*/
public static function exportRules(Rules $rules)
{
$payload = array();
foreach ($rules as $rule) {
if (!is_string($op = $rule->validator)) {
if (!Nette\Utils\Callback::isStatic($op)) {
continue;
}
$op = Nette\Utils\Callback::toString($op);
}
if ($rule->branch) {
$item = array('op' => ($rule->isNegative ? '~' : '') . $op, 'rules' => static::exportRules($rule->branch), 'control' => $rule->control->getHtmlName());
if ($rule->branch->getToggles()) {
$item['toggle'] = $rule->branch->getToggles();
}
} else {
$item = array('op' => ($rule->isNegative ? '~' : '') . $op, 'msg' => Validator::formatMessage($rule, FALSE));
}
if (is_array($rule->arg)) {
foreach ($rule->arg as $key => $value) {
$item['arg'][$key] = $value instanceof IControl ? array('control' => $value->getHtmlName()) : $value;
}
} elseif ($rule->arg !== NULL) {
$item['arg'] = $rule->arg instanceof IControl ? array('control' => $rule->arg->getHtmlName()) : $rule->arg;
}
$payload[] = $item;
}
return $payload;
}
示例2: exportRules
/**
* @return array
*/
protected static function exportRules($rules)
{
$payload = array();
foreach ($rules as $rule) {
if (!is_string($op = $rule->operation)) {
if (!Nette\Utils\Callback::isStatic($op)) {
continue;
}
$op = Nette\Utils\Callback::toString($op);
}
if ($rule->type === Rule::VALIDATOR) {
$item = array('op' => ($rule->isNegative ? '~' : '') . $op, 'msg' => $rules->formatMessage($rule, FALSE));
} elseif ($rule->type === Rule::CONDITION) {
$item = array('op' => ($rule->isNegative ? '~' : '') . $op, 'rules' => static::exportRules($rule->subRules), 'control' => $rule->control->getHtmlName());
if ($rule->subRules->getToggles()) {
$item['toggle'] = $rule->subRules->getToggles();
}
}
if (is_array($rule->arg)) {
foreach ($rule->arg as $key => $value) {
$item['arg'][$key] = $value instanceof IControl ? array('control' => $value->getHtmlName()) : $value;
}
} elseif ($rule->arg !== NULL) {
$item['arg'] = $rule->arg instanceof IControl ? array('control' => $rule->arg->getHtmlName()) : $rule->arg;
}
$payload[] = $item;
}
return $payload;
}