Symfony\Component\BrowserKit\Client::followRedirects PHP Method

followRedirects() public method

Sets whether to automatically follow redirects or not.
public followRedirects ( boolean $followRedirect = true )
$followRedirect boolean Whether to follow redirects
    public function followRedirects($followRedirect = true)
    {
        $this->followRedirects = (Boolean) $followRedirect;
    }

Usage Example

 /**
  * @param $result
  * @return mixed
  */
 protected function redirectIfNecessary($result, $maxRedirects, $redirectCount)
 {
     $locationHeader = $this->client->getInternalResponse()->getHeader('Location');
     if ($locationHeader) {
         if ($redirectCount == $maxRedirects) {
             throw new \LogicException(sprintf('The maximum number (%d) of redirections was reached.', $maxRedirects));
         }
         $this->debugSection('Redirecting to', $locationHeader);
         $result = $this->client->followRedirect();
         $this->debugResponse($locationHeader);
         return $this->redirectIfNecessary($result, $maxRedirects, $redirectCount + 1);
     }
     $this->client->followRedirects(true);
     return $result;
 }
All Usage Examples Of Symfony\Component\BrowserKit\Client::followRedirects