10000 Revert "[HttpFoundation] Adds getAcceptableFormats() method for Request" by Tobion · Pull Request #29047 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Revert "[HttpFoundation] Adds getAcceptableFormats() method for Request" #29047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Revert "[HttpFoundation] Adds getAcceptableFormats() method for Request"
This reverts commit 8a127ea.
  • Loading branch information
Tobion committed Oct 31, 2018
commit 397ed83c3cbc6217e0350cbbbb5c53202b1df279
1 change: 0 additions & 1 deletion src/Symfony/Component/HttpFoundation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ CHANGELOG
4.2.0
-----

* added `getAcceptableFormats()` for reading acceptable formats based on Accept header
* the default value of the "$secure" and "$samesite" arguments of Cookie's constructor
will respectively change from "false" to "null" and from "null" to "lax" in Symfony
5.0, you should define their values explicitly or use "Cookie::create()" instead.
Expand Down
19 changes: 0 additions & 19 deletions src/Symfony/Component/HttpFoundation/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,6 @@ class Request
*/
protected $format;

/**
* @var array
*/
private $acceptableFormats;

/**
* @var \Symfony\Component\HttpFoundation\Session\SessionInterface
*/
Expand Down Expand Up @@ -268,7 +263,6 @@ public function initialize(array $query = array(), array $request = array(), arr
$this->charsets = null;
$this->encodings = null;
$this->acceptableContentTypes = null;
$this->acceptableFormats = null;
$this->pathInfo = null;
$this->requestUri = null;
$this->baseUrl = null;
Expand Down Expand Up @@ -456,7 +450,6 @@ public function duplicate(array $query = null, array $request = null, array $att
$dup->charsets = null;
$dup->encodings = null;
$dup->acceptableContentTypes = null;
$dup->acceptableFormats = null;
$dup->pathInfo = null;
$dup->requestUri = null;
$dup->baseUrl = null;
Expand Down Expand Up @@ -1368,18 +1361,6 @@ public function getContentType()
return $this->getFormat($this->headers->get('CONTENT_TYPE'));
}

/**
* Gets the acceptable client formats associated with the request.
*/
public function getAcceptableFormats(): array
{
if (null !== $this->acceptableFormats) {
return $this->acceptableFormats;
}

return $this->acceptableFormats = array_values(array_unique(array_filter(array_map(array($this, 'getFormat'), $this->getAcceptableContentTypes()))));
}

/**
* Sets the default locale.
*
Expand Down
10 changes: 0 additions & 10 deletions src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1432,16 +1432,6 @@ public function testGetAcceptableContentTypes()
$this->assertEquals(array('application/vnd.wap.wmlscriptc', 'text/vnd.wap.wml', 'application/vnd.wap.xhtml+xml', 'application/xhtml+xml', 'text/html', 'multipart/mixed', '*/*'), $request->getAcceptableContentTypes());
}

public function testGetAcceptableFormats()
{
$request = new Request();
$this->assertEquals(array(), $request->getAcceptableFormats());

$request = new Request();
$request->headers->set('Accept', 'text/html, application/xhtml+xml, application/xml;q=0.9, */*');
$this->assertEquals(array('html', 'xml'), $request->getAcceptableFormats());
}

public function testGetLanguages()
{
$request = new Request();
Expand Down
0