本文整理汇总了PHP中Field::check方法的典型用法代码示例。如果您正苦于以下问题:PHP Field::check方法的具体用法?PHP Field::check怎么用?PHP Field::check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Field
的用法示例。
在下文中一共展示了Field::check方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check
public function check()
{
if (!$this->required && !$this->value) {
return;
}
if ($error = parent::check()) {
return $error;
}
if (!is_numeric($this->value)) {
return array('number', $this->printName());
}
if ($this->min !== null) {
if ($this->value < $this->min) {
return array('number_min', $this->printName(), $this->min);
}
}
if ($this->max !== null) {
if ($this->value > $this->max) {
return array('number_max', $this->printName(), $this->max);
}
}
if ($this->step != 'any') {
$step = abs((double) $this->step);
$value = abs((double) $this->value);
$factor = round($value / $step) * $step;
$delta = $value - $factor;
if ($delta > 1.0E-5) {
return array('number_step', $this->printName(), $this->step);
}
}
}
示例2: check
public function check()
{
if ($error = parent::check()) {
return $error;
}
foreach ($this->options as $opt) {
if ($this->value == $opt->getValue()) {
return;
}
}
return array('should_choose', $this->printName());
}
示例3: check
public function check()
{
if (!$this->required && !$this->value) {
return;
}
if ($error = parent::check()) {
return $error;
}
if (!filter_var($this->value, FILTER_VALIDATE_EMAIL)) {
return array('bad_email', $this->printName());
}
return;
}
示例4: check
public function check()
{
if ($error = parent::check()) {
return $error;
}
if (!$this->required && $this->value == '') {
return;
} else {
foreach ($this->options as $opt) {
if ($this->multiple && in_array($opt->getValue(), $this->value) || !$this->multiple && $this->value == $opt->getValue()) {
return;
}
}
}
return array('should_choose', $this->printName());
}