| @@ 43-54 (lines=12) @@ | ||
| 40 | } |
|
| 41 | } |
|
| 42 | ||
| 43 | public function checkTotalDigits($v) |
|
| 44 | { |
|
| 45 | if (null == $this->totalDigits) { |
|
| 46 | return; |
|
| 47 | } |
|
| 48 | $stringVal = explode(".", (string)$v); |
|
| 49 | if ($this->totalDigits < strlen($stringVal[0])) { |
|
| 50 | throw new \InvalidArgumentException( |
|
| 51 | "the number of fractionDigits for " . __CLASS__ . " is greater the allowed. " |
|
| 52 | ); |
|
| 53 | } |
|
| 54 | } |
|
| 55 | ||
| 56 | public function setFractionDigits($fd) |
|
| 57 | { |
|
| @@ 62-75 (lines=14) @@ | ||
| 59 | $this->fractionDigits = $fd; |
|
| 60 | } |
|
| 61 | ||
| 62 | public function checkFractionDigits($v) |
|
| 63 | { |
|
| 64 | if (null == $this->fractionDigits) { |
|
| 65 | return; |
|
| 66 | } |
|
| 67 | $stringVal = explode(".", (string)$v); |
|
| 68 | if (2 == count($stringVal)) { |
|
| 69 | if ($this->fractionDigits < strlen($stringVal[1])) { |
|
| 70 | throw new \InvalidArgumentException( |
|
| 71 | "the number of fractionDigits for " . __CLASS__ . " is greater the allowed. " |
|
| 72 | ); |
|
| 73 | } |
|
| 74 | } |
|
| 75 | } |
|
| 76 | ||
| 77 | public function fixFractionDigits($v) |
|
| 78 | { |
|