public function Response::isRedirect

Same name in this branch

Is the response a redirect of some form?

@api

Parameters

string $location:

Return value

Boolean

1 call to Response::isRedirect()
RedirectResponse::__construct in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RedirectResponse.php
Creates a redirect response so that it conforms to the rules defined for a redirect status code.

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php, line 1132

Class

Response
Response represents an HTTP response.

Namespace

Symfony\Component\HttpFoundation

Code

public function isRedirect($location = null) {
  return in_array($this->statusCode, array(
    201,
    301,
    302,
    303,
    307,
    308,
  )) && (null === $location ?: $location == $this->headers
    ->get('Location'));
}