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