<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Field; use ModStart\Core\Exception\BizException; class Currency 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($cBDsM) { $this->setVariable('autoColor', $cBDsM); return $this; } public function signShow($cBDsM) { $this->setVariable('signShow', $cBDsM); 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 ZcZUl; Y1Ak6: 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 Fg0Ay; Fg0Ay: return $cBDsM; goto ub7OV; ZcZUl: if ('' === $cBDsM || null === $cBDsM) { return null; } goto w1qli; w1qli: 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 Y1Ak6; ub7OV: } }