Class

Symfony\Component\Routing\RequestContext

class RequestContext

Holds information about the current request.

Methods

__construct(string $baseUrl = '', string $method = 'GET', string $host = 'localhost', string $scheme = 'http', int $httpPort = 80, int $httpsPort = 443, string $path = '/', string $queryString = '')

Constructor.

fromRequest(Request $request)

string getBaseUrl()

Gets the base URL.

setBaseUrl(string $baseUrl)

Sets the base URL.

string getPathInfo()

Gets the path info.

setPathInfo(string $pathInfo)

Sets the path info.

string getMethod()

Gets the HTTP method.

setMethod(string $method)

Sets the HTTP method.

string getHost()

Gets the HTTP host.

setHost(string $host)

Sets the HTTP host.

string getScheme()

Gets the HTTP scheme.

setScheme(string $scheme)

Sets the HTTP scheme.

string getHttpPort()

Gets the HTTP port.

setHttpPort(string $httpPort)

Sets the HTTP port.

string getHttpsPort()

Gets the HTTPS port.

setHttpsPort(string $httpsPort)

Sets the HTTPS port.

string getQueryString()

Gets the query string.

setQueryString(string $queryString)

Sets the query string.

array getParameters()

Returns the parameters.

Route setParameters(array $parameters)

Sets the parameters.

mixed getParameter(string $name)

Gets a parameter value.

bool hasParameter(string $name)

Checks if a parameter value is set for the given parameter.

setParameter(string $name, mixed $parameter)

Sets a parameter value.

Details

at line 53
public __construct(string $baseUrl = '', string $method = 'GET', string $host = 'localhost', string $scheme = 'http', int $httpPort = 80, int $httpsPort = 443, string $path = '/', string $queryString = '')

Constructor.

Parameters

string $baseUrl The base URL
string $method The HTTP method
string $host The HTTP host name
string $scheme The HTTP scheme
int $httpPort The HTTP port
int $httpsPort The HTTPS port
string $path The path
string $queryString The query string

at line 65
public fromRequest(Request $request)

Parameters

Request $request

at line 82
public string getBaseUrl()

Gets the base URL.

Return Value

string The base URL

at line 94
public setBaseUrl(string $baseUrl)

Sets the base URL.

Parameters

string $baseUrl The base URL

at line 104
public string getPathInfo()

Gets the path info.

Return Value

string The path info

at line 114
public setPathInfo(string $pathInfo)

Sets the path info.

Parameters

string $pathInfo The path info

at line 126
public string getMethod()

Gets the HTTP method.

The method is always an uppercased string.

Return Value

string The HTTP method

at line 138
public setMethod(string $method)

Sets the HTTP method.

Parameters

string $method The HTTP method

at line 148
public string getHost()

Gets the HTTP host.

Return Value

string The HTTP host

at line 160
public setHost(string $host)

Sets the HTTP host.

Parameters

string $host The HTTP host

at line 170
public string getScheme()

Gets the HTTP scheme.

Return Value

string The HTTP scheme

at line 182
public setScheme(string $scheme)

Sets the HTTP scheme.

Parameters

string $scheme The HTTP scheme

at line 192
public string getHttpPort()

Gets the HTTP port.

Return Value

string The HTTP port

at line 204
public setHttpPort(string $httpPort)

Sets the HTTP port.

Parameters

string $httpPort The HTTP port

at line 214
public string getHttpsPort()

Gets the HTTPS port.

Return Value

string The HTTPS port

at line 226
public setHttpsPort(string $httpsPort)

Sets the HTTPS port.

Parameters

string $httpsPort The HTTPS port

at line 236
public string getQueryString()

Gets the query string.

Return Value

string The query string

at line 248
public setQueryString(string $queryString)

Sets the query string.

Parameters

string $queryString The query string

at line 258
public array getParameters()

Returns the parameters.

Return Value

array The parameters

at line 272
public Route setParameters(array $parameters)

Sets the parameters.

This method implements a fluent interface.

Parameters

array $parameters The parameters

Return Value

Route The current Route instance

at line 286
public mixed getParameter(string $name)

Gets a parameter value.

Parameters

string $name A parameter name

Return Value

mixed The parameter value

at line 298
public bool hasParameter(string $name)

Checks if a parameter value is set for the given parameter.

Parameters

string $name A parameter name

Return Value

bool true if the parameter value is set, false otherwise

at line 311
public setParameter(string $name, mixed $parameter)

Sets a parameter value.

Parameters

string $name A parameter name
mixed $parameter The parameter value