| @@ 226-243 (lines=18) @@ | ||
| 223 | * @throws \InvalidArgumentException If the depth is not an integer greater |
|
| 224 | * than or equal to zero |
|
| 225 | */ |
|
| 226 | public function setMaxDepth($maxDepth) |
|
| 227 | { |
|
| 228 | if (!is_int($maxDepth)) { |
|
| 229 | throw new \InvalidArgumentException(sprintf( |
|
| 230 | 'The maximum depth should be an integer. Got: %s', |
|
| 231 | is_object($maxDepth) ? get_class($maxDepth) : gettype($maxDepth) |
|
| 232 | )); |
|
| 233 | } |
|
| 234 | ||
| 235 | if ($maxDepth < 1) { |
|
| 236 | throw new \InvalidArgumentException(sprintf( |
|
| 237 | 'The maximum depth should 1 or greater. Got: %s', |
|
| 238 | $maxDepth |
|
| 239 | )); |
|
| 240 | } |
|
| 241 | ||
| 242 | $this->maxDepth = $maxDepth; |
|
| 243 | } |
|
| 244 | ||
| 245 | /** |
|
| 246 | * Returns the decoding of JSON objects. |
|
| @@ 625-642 (lines=18) @@ | ||
| 622 | * @throws \InvalidArgumentException If the depth is not an integer greater |
|
| 623 | * than or equal to zero |
|
| 624 | */ |
|
| 625 | public function setMaxDepth($maxDepth) |
|
| 626 | { |
|
| 627 | if (!is_int($maxDepth)) { |
|
| 628 | throw new \InvalidArgumentException(sprintf( |
|
| 629 | 'The maximum depth should be an integer. Got: %s', |
|
| 630 | is_object($maxDepth) ? get_class($maxDepth) : gettype($maxDepth) |
|
| 631 | )); |
|
| 632 | } |
|
| 633 | ||
| 634 | if ($maxDepth < 1) { |
|
| 635 | throw new \InvalidArgumentException(sprintf( |
|
| 636 | 'The maximum depth should 1 or greater. Got: %s', |
|
| 637 | $maxDepth |
|
| 638 | )); |
|
| 639 | } |
|
| 640 | ||
| 641 | $this->maxDepth = $maxDepth; |
|
| 642 | } |
|
| 643 | } |
|
| 644 | ||