trait LocalAwareRedirectResponseTrait (View source)

Provides a trait which ensures that a URL is safe to redirect to.

Properties

protected RequestContext $requestContext

The request context.

Methods

bool
isLocal(string $url)

Determines whether a path is local.

getRequestContext()

Returns the request context.

$this
setRequestContext(RequestContext $request_context)

Sets the request context.

Details

protected bool isLocal(string $url)

Determines whether a path is local.

Parameters

string $url

The internal path or external URL being linked to, such as "node/34" or "http://example.com/foo".

Return Value

bool

TRUE or FALSE, where TRUE indicates a local path.

protected RequestContext getRequestContext()

Returns the request context.

Return Value

RequestContext

The request context.

$this setRequestContext(RequestContext $request_context)

Sets the request context.

Parameters

RequestContext $request_context

The request context.

Return Value

$this