RequestOptions::setMaxRedirects( int|null $maxRedirects ): void

In this article

Sets the maximum number of redirects to follow.

Description

Set to 0 to disable redirects, null for unspecified, or a positive integer to enable redirects with a maximum count.

Parameters

$maxRedirectsint|nullrequired
Maximum redirects to follow, or 0 to disable, or null for unspecified.

Return

void

Source

public function setMaxRedirects(?int $maxRedirects): void
{
    if ($maxRedirects !== null && $maxRedirects < 0) {
        throw new InvalidArgumentException('Request option "maxRedirects" must be greater than or equal to 0.');
    }
    $this->maxRedirects = $maxRedirects;
}

Changelog

VersionDescription
0.2.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.