Skip to content

Commit 65d100e

Browse files
Andrei Ignajaviereguiluz
Andrei Igna
authored andcommitted
[HttpFoundation] Add info for getAcceptableFormats() method
1 parent 62b3c9f commit 65d100e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

components/http_foundation.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,21 @@ by using the following methods:
290290
:method:`Symfony\\Component\\HttpFoundation\\Request::getAcceptableContentTypes`
291291
Returns the list of accepted content types ordered by descending quality.
292292

293+
:method:`Symfony\\Component\\HttpFoundation\\Request::getAcceptableFormats`
294+
Returns the list of accepted client formats associated with the request.
295+
296+
Note that
297+
:method:`Symfony\\Component\\HttpFoundation\\Request::getAcceptableFormats`
298+
will use the data from
299+
:method:`Symfony\\Component\\HttpFoundation\\Request::getAcceptableContentTypes`
300+
and return the client acceptable formats::
301+
302+
$request->getAcceptableContentTypes();
303+
// returns ['text/html', 'application/xhtml+xml', 'application/xml', '*/*']
304+
305+
$request->getAcceptableFormats();
306+
// returns ['html', 'xml']
307+
293308
:method:`Symfony\\Component\\HttpFoundation\\Request::getLanguages`
294309
Returns the list of accepted languages ordered by descending quality.
295310

0 commit comments

Comments
 (0)