public function fromRequest(Request $request) {
$this
->setBaseUrl($request
->getBaseUrl());
$this
->setPathInfo($request
->getPathInfo());
$this
->setMethod($request
->getMethod());
$this
->setHost($request
->getHost());
$this
->setScheme($request
->getScheme());
$this
->setHttpPort($request
->isSecure() ? $this->httpPort : $request
->getPort());
$this
->setHttpsPort($request
->isSecure() ? $request
->getPort() : $this->httpsPort);
$this
->setQueryString($request->server
->get('QUERY_STRING'));
}