@@ 225-242 (lines=18) @@ | ||
222 | * @throws \InvalidArgumentException If the depth is not an integer greater |
|
223 | * than or equal to zero. |
|
224 | */ |
|
225 | public function setMaxDepth($maxDepth) |
|
226 | { |
|
227 | if (!is_int($maxDepth)) { |
|
228 | throw new \InvalidArgumentException(sprintf( |
|
229 | 'The maximum depth should be an integer. Got: %s', |
|
230 | is_object($maxDepth) ? get_class($maxDepth) : gettype($maxDepth) |
|
231 | )); |
|
232 | } |
|
233 | ||
234 | if ($maxDepth < 1) { |
|
235 | throw new \InvalidArgumentException(sprintf( |
|
236 | 'The maximum depth should 1 or greater. Got: %s', |
|
237 | $maxDepth |
|
238 | )); |
|
239 | } |
|
240 | ||
241 | $this->maxDepth = $maxDepth; |
|
242 | } |
|
243 | ||
244 | /** |
|
245 | * Returns the decoding of JSON objects. |
@@ 610-627 (lines=18) @@ | ||
607 | * @throws \InvalidArgumentException If the depth is not an integer greater |
|
608 | * than or equal to zero. |
|
609 | */ |
|
610 | public function setMaxDepth($maxDepth) |
|
611 | { |
|
612 | if (!is_int($maxDepth)) { |
|
613 | throw new \InvalidArgumentException(sprintf( |
|
614 | 'The maximum depth should be an integer. Got: %s', |
|
615 | is_object($maxDepth) ? get_class($maxDepth) : gettype($maxDepth) |
|
616 | )); |
|
617 | } |
|
618 | ||
619 | if ($maxDepth < 1) { |
|
620 | throw new \InvalidArgumentException(sprintf( |
|
621 | 'The maximum depth should 1 or greater. Got: %s', |
|
622 | $maxDepth |
|
623 | )); |
|
624 | } |
|
625 | ||
626 | $this->maxDepth = $maxDepth; |
|
627 | } |
|
628 | } |
|
629 |