<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Field; use ModStart\Core\Exception\BizException; class Decimal extends AbstractField { protected $view = 'modstart::core.field.number'; protected $rules = array('regex:/^-?\\d+(\\.\\d+)?$/i'); protected function setup() { $this->addVariables(array('autoColor' => false, 'signShow' => false, '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 unserializeValue($cBDsM, AbstractField $Ldet7) { if ('' === $cBDsM || null === $cBDsM) { return null; } return $cBDsM; } public function serializeValue($cBDsM, $GMqtO) { if ('' === $cBDsM || null === $cBDsM) { return null; } return $cBDsM; } public function prepareInput($cBDsM, $GMqtO) { goto TwrLL; XLA1k: return $cBDsM; goto SQmmz; TwrLL: if ('' === $cBDsM || null === $cBDsM) { return null; } goto mgUvM; ODBUL: 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 XLA1k; mgUvM: 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 ODBUL; SQmmz: } }