| @@ 48-59 (lines=12) @@ | ||
| 45 | } |
|
| 46 | } |
|
| 47 | ||
| 48 | public function checkTotalDigits($v) |
|
| 49 | { |
|
| 50 | if (null == $this->totalDigits) { |
|
| 51 | return; |
|
| 52 | } |
|
| 53 | $stringVal = explode('.', (string)$v); |
|
| 54 | if ($this->totalDigits < strlen($stringVal[0])) { |
|
| 55 | throw new \InvalidArgumentException( |
|
| 56 | 'The number of fractionDigits for ' . get_class($this) . ' is greater than allowed.' |
|
| 57 | ); |
|
| 58 | } |
|
| 59 | } |
|
| 60 | ||
| 61 | /** |
|
| 62 | * @param int $fd Specifies the maximum number of decimal places allowed. Must be equal to or greater than zero |
|
| @@ 75-88 (lines=14) @@ | ||
| 72 | * |
|
| 73 | * @param float $v the value to check fraction digits on |
|
| 74 | */ |
|
| 75 | public function checkFractionDigits($v) |
|
| 76 | { |
|
| 77 | if (null == $this->fractionDigits) { |
|
| 78 | return; |
|
| 79 | } |
|
| 80 | $stringVal = explode('.', (string)$v); |
|
| 81 | if (2 == count($stringVal)) { |
|
| 82 | if ($this->fractionDigits < strlen($stringVal[1])) { |
|
| 83 | throw new \InvalidArgumentException( |
|
| 84 | 'The number of fractionDigits for ' . get_class($this) . ' is greater than allowed.' |
|
| 85 | ); |
|
| 86 | } |
|
| 87 | } |
|
| 88 | } |
|
| 89 | ||
| 90 | /** |
|
| 91 | * @param float $v the digit to be fixed |
|