Setzt die maximale Anzahl der Redirects, denen gefolgt werden soll.

@param  int $maxRedirects

@return $this
4693
public function setMaxRedirects($maxRedirects) {
        if (!is_int($maxRedirects)) throw new IllegalTypeException('Illegal type of parameter $maxRedirects: '.gettype($maxRedirects));

        $this->maxRedirects = $maxRedirects;
        return $this;
    }
1331303
private function createWildcardRoute(Redirect $redirect)
    {
        $origin = $redirect->getOrigin();
        $target = $redirect->getTarget();
        $url = $this->context->getPathInfo();

        $origin = substr($origin, 0, -1);
        $target = substr($target, 0, -1);
        $pathInfo = str_replace($origin, $target, $url);

        $this->context->setPathInfo($pathInfo);

        return new Route(
            $url, array(
                    '_controller' => 'FrameworkBundle:Redirect:urlRedirect',
                    'path' => $url,
                    'permanent' => $redirect->isPermanent(),
                ));
    }
1188172
public function setMaxResults($maxResults)
    {
        $this->_maxResults = $maxResults;
        $this->_state      = self::STATE_DIRTY;

        return $this;
    }
552772
public function setMaxChoices($maxChoices)
    {
        if (is_int($maxChoices) === true && $maxChoices >= 0) {
            $this->maxChoices = $maxChoices;
        } else {
            $msg = "The 'maxChoices' argument must be a positive (>= 0) integer, '" . gettype($maxChoices) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
1216239
public function redirectByUrl($defaultRedirect = null, $key = null) {
		$redirectUrl = $this->getRedirectUrl($defaultRedirect, $key);

		return $this->_controller->redirect($redirectUrl);
	}
385874
public function setPreFlightCacheMaxAge(int $cacheMaxAge): self
    {
        \assert($cacheMaxAge >= 0);

        $this->preFlightCacheMaxAge   = $cacheMaxAge;
        $this->isPreFlightCanBeCached = $cacheMaxAge > 0;

        return $this;
    }
806804
public function setMax($max)
    {
        if ($max <= 0) {
            throw new InvalidArgumentException(sprintf('Supplied max value: %d must be greater than 0', $max));
        }
        $this->max = $max;
        return $this;
    }
354463
public function setUri($uri)
    {
        if (in_array($uri, $this->uris, TRUE)) {
            throw new \Exception('Redirecting loop detected');
        }
        $this->uris[] = $uri;
        return $this;
    }
1024168
private function checkNumberRedirects($url)
    {
        ++self::$nbRedirect;

        // keep initial url in case of endless redirect
        if ('' === self::$initialUrl) {
            self::$initialUrl = $url;
        }

        if (self::$nbRedirect > $this->config['max_redirect']) {
            $this->logger->warning('Endless redirect: ' . self::$nbRedirect . ' on "{url}"', ['url' => $url]);

            return false;
        }

        return true;
    }
1085585
public function setMax(string $max)
    {
        $this->doSetMax($max);
        $this->getTag()->setAttribute('max', $max);

        return $this;
    }
1020255
public function allowMaxConditions($max)
    {
        if ($this->_maxConditions) {
            throw new BadMethodCallException('You can only set the maximum conditions only once.');
        }
        $this->_maxConditions = $max;
        $this->_allowNesting = false;
        $this->checkRestrictions();
        return $this;
    }
905483
public function setMax($value)
    {
        $this->max = $value === null ? null : (int) $value;

        return $this;
    }
321793
public static function maxRedirectsExceeded($uri, $maxRedirects, $adapter)
    {
        return self::cannotFetchUri($uri, $adapter, sprintf('Max redirects exceeded (%d)', $maxRedirects));
    }
747422
public function redirect($path)
    {
        $args = func_get_args();
        $url = call_user_func_array([$this, 'getUrl'], $args);
        $this->response = $this->createRedirectResponse($url);
        $this->disableRendering();
        return $this;
    }
979798
public function setRedirectUrl($sRedirectUrl)
    {
        if (!$this->bIsLocked) {
            $this->sRedirectUrl = $sRedirectUrl;
            $this->setIsRedirect(!empty($sRedirectUrl));
        }
        return $this;
    }
443227
public function redirect_custom(string $url) {
		self::$code = 301;
		self::$head = ["Location: $url"];
		self::$body_raw = self::$body = "Location: $url";
		self::$errno = 0;
		self::$data = [$url];
	}
1122265
protected static function httpRedirect($url, $headers = [], $redirectCode = 301)
    {
        $url = new UrlObject($url);

        $headers['Location'] = $url->val();
        $response = new Response('', $redirectCode, $headers);
        $response->sendHeaders();
    }