isStatic() public static method

public static isStatic ( $callable ) : boolean
return boolean
Exemplo n.º 1
0
 /**
  * @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;
 }
Exemplo n.º 2
0
 /**
  * @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;
 }