| @@ 211-222 (lines=12) @@ | ||
| 208 | * |
|
| 209 | * @return self |
|
| 210 | */ |
|
| 211 | public function withRecursionDepth($depth) |
|
| 212 | { |
|
| 213 | /** @psalm-suppress DocblockTypeContradiction */ |
|
| 214 | if (null !== $depth && !(is_int($depth) && $depth >= 0)) { |
|
| 215 | $msg = 'Recursion depth must be null (infinite) or integer >= 0!'; |
|
| 216 | throw new \InvalidArgumentException($msg); |
|
| 217 | } |
|
| 218 | ||
| 219 | $self = clone $this; |
|
| 220 | $self->recursionDepth = $depth; |
|
| 221 | ||
| 222 | return $self; |
|
| 223 | } |
|
| 224 | ||
| 225 | /** |
|
| @@ 235-246 (lines=12) @@ | ||
| 232 | * |
|
| 233 | * @return self |
|
| 234 | */ |
|
| 235 | public function withMaxIterations($iterations) |
|
| 236 | { |
|
| 237 | /** @psalm-suppress DocblockTypeContradiction */ |
|
| 238 | if (null !== $iterations && !(is_int($iterations) && $iterations > 0)) { |
|
| 239 | $msg = 'Maximum number of iterations must be null (infinite) or integer > 0!'; |
|
| 240 | throw new \InvalidArgumentException($msg); |
|
| 241 | } |
|
| 242 | ||
| 243 | $self = clone $this; |
|
| 244 | $self->maxIterations = $iterations; |
|
| 245 | ||
| 246 | return $self; |
|
| 247 | } |
|
| 248 | ||
| 249 | /** |
|