<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Field; use ModStart\Core\Exception\BizException; class Number extends AbstractField { protected function setup() { $this->addVariables(array('autoColor' => false, 'signShow' => false, 'unit' => null, 'min' => null, 'max' => null, 'step' => null)); } public function min($cBDsM) { $this->setVariable('min', $cBDsM); return $this; } public function max($cBDsM) { $this->setVariable('max', $cBDsM); return $this; } public function step($cBDsM) { $this->setVariable('step', $cBDsM); return $this; } public function autoColor($uQg0u) { $this->setVariable('autoColor', $uQg0u); return $this; } public function signShow($uQg0u) { $this->setVariable('signShow', $uQg0u); return $this; } public function unit($cBDsM) { $this->setVariable('unit', $cBDsM); return $this; } public function unserializeValue($cBDsM, AbstractField $Ldet7) { if ('' === $cBDsM || null === $cBDsM) { return null; } return intval($cBDsM); } public function serializeValue($cBDsM, $GMqtO) { if ('' === $cBDsM || null === $cBDsM) { return null; } return intval($cBDsM); } public function prepareInput($cBDsM, $GMqtO) { goto xhMmt; k7Wp8: return $cBDsM; goto SGtTJ; cyVUx: if (null !== ($knQyJ = $this->getVariable('min'))) { if ($cBDsM < $knQyJ) { BizException::throws(str_replace(array(':attribute', ':min'), array($this->label, $knQyJ), L('validation.min.numeric'))); } } goto pcLPc; qSmti: $cBDsM = intval($cBDsM); goto cyVUx; pcLPc: if (null !== ($knQyJ = $this->getVariable('max'))) { if ($cBDsM > $knQyJ) { BizException::throws(str_replace(array(':attribute', ':max'), array($this->label, $knQyJ), L('validation.max.numeric'))); } } goto k7Wp8; xhMmt: if ('' === $cBDsM || null === $cBDsM) { return null; } goto qSmti; SGtTJ: } }