RequestContext (Component\Routing)
Symfony\Component\Routing\RequestContext
class RequestContext
Holds information about the current request.
This class implements a fluent interface.
Methods
__construct(string $baseUrl = '', string $method = 'GET', string $host = 'localhost', string $scheme = 'http', int $httpPort = 80, int $httpsPort = 443, string $path = '/', string $queryString = '') Constructor. | ||
RequestContext | fromRequest(Request $request) Updates the RequestContext information based on a HttpFoundation Request. | |
string | getBaseUrl() Gets the base URL. | |
RequestContext | setBaseUrl(string $baseUrl) Sets the base URL. | |
string | getPathInfo() Gets the path info. | |
RequestContext | setPathInfo(string $pathInfo) Sets the path info. | |
string | getMethod() Gets the HTTP method. | |
RequestContext | setMethod(string $method) Sets the HTTP method. | |
string | getHost() Gets the HTTP host. | |
RequestContext | setHost(string $host) Sets the HTTP host. | |
string | getScheme() Gets the HTTP scheme. | |
RequestContext | setScheme(string $scheme) Sets the HTTP scheme. | |
int | getHttpPort() Gets the HTTP port. | |
RequestContext | setHttpPort(int $httpPort) Sets the HTTP port. | |
int | getHttpsPort() Gets the HTTPS port. | |
RequestContext | setHttpsPort(int $httpsPort) Sets the HTTPS port. | |
string | getQueryString() Gets the query string. | |
RequestContext | setQueryString(string $queryString) Sets the query string. | |
array | getParameters() Returns the parameters. | |
RequestContext | 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. | |
RequestContext | setParameter(string $name, mixed $parameter) Sets a parameter value. |
Details
public __construct(string $baseUrl = '', string $method = 'GET', string $host = 'localhost', string $scheme = 'http', int $httpPort = 80, int $httpsPort = 443, string $path = '/', string $queryString = '')
Constructor.
public RequestContext fromRequest(Request $request)
Updates the RequestContext information based on a HttpFoundation Request.
public string getBaseUrl()
Gets the base URL.
public RequestContext setBaseUrl(string $baseUrl)
Sets the base URL.
public string getPathInfo()
Gets the path info.
public RequestContext setPathInfo(string $pathInfo)
Sets the path info.
public string getMethod()
Gets the HTTP method.
The method is always an uppercased string.
public RequestContext setMethod(string $method)
Sets the HTTP method.
public string getHost()
Gets the HTTP host.
The host is always lowercased because it must be treated case-insensitive.
public RequestContext setHost(string $host)
Sets the HTTP host.
public string getScheme()
Gets the HTTP scheme.
public RequestContext setScheme(string $scheme)
Sets the HTTP scheme.
public int getHttpPort()
Gets the HTTP port.
public RequestContext setHttpPort(int $httpPort)
Sets the HTTP port.
public int getHttpsPort()
Gets the HTTPS port.
public RequestContext setHttpsPort(int $httpsPort)
Sets the HTTPS port.
public string getQueryString()
Gets the query string.
public RequestContext setQueryString(string $queryString)
Sets the query string.
public array getParameters()
Returns the parameters.
public RequestContext setParameters(array $parameters)
Sets the parameters.
public mixed getParameter(string $name)
Gets a parameter value.
public bool hasParameter(string $name)
Checks if a parameter value is set for the given parameter.
public RequestContext setParameter(string $name, mixed $parameter)
Sets a parameter value.
© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.0/Symfony/Component/Routing/RequestContext.html