public function Request::duplicate in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/http-foundation/Request.php \Symfony\Component\HttpFoundation\Request::duplicate()
Clones a request and overrides some of its parameters.
Parameters
array $query The GET parameters:
array $request The POST parameters:
array $attributes The request attributes (parameters parsed from the PATH_INFO, ...):
array $cookies The COOKIE parameters:
array $files The FILES parameters:
array $server The SERVER parameters:
Return value
Request The duplicated request
File
- vendor/
symfony/ http-foundation/ Request.php, line 426
Class
- Request
- Request represents an HTTP request.
Namespace
Symfony\Component\HttpFoundationCode
public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null) {
$dup = clone $this;
if ($query !== null) {
$dup->query = new ParameterBag($query);
}
if ($request !== null) {
$dup->request = new ParameterBag($request);
}
if ($attributes !== null) {
$dup->attributes = new ParameterBag($attributes);
}
if ($cookies !== null) {
$dup->cookies = new ParameterBag($cookies);
}
if ($files !== null) {
$dup->files = new FileBag($files);
}
if ($server !== null) {
$dup->server = new ServerBag($server);
$dup->headers = new HeaderBag($dup->server
->getHeaders());
}
$dup->languages = null;
$dup->charsets = null;
$dup->encodings = null;
$dup->acceptableContentTypes = null;
$dup->pathInfo = null;
$dup->requestUri = null;
$dup->baseUrl = null;
$dup->basePath = null;
$dup->method = null;
$dup->format = null;
if (!$dup
->get('_format') && $this
->get('_format')) {
$dup->attributes
->set('_format', $this
->get('_format'));
}
if (!$dup
->getRequestFormat(null)) {
$dup
->setRequestFormat($this
->getRequestFormat(null));
}
return $dup;
}