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