Skip to content

Commit d3d25d0

Browse files
committed
Merge pull request symfony#2435 from joelclermont/issue_2395
[WIP] re-read of http-foundation component docs
2 parents 2564469 + 20a75cb commit d3d25d0

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

components/http_foundation/introduction.rst

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ You can install the component in 2 different ways:
2727
Request
2828
-------
2929

30-
The most common way to create request is to base it on the current PHP global
30+
The most common way to create a request is to base it on the current PHP global
3131
variables with
3232
:method:`Symfony\\Component\\HttpFoundation\\Request::createFromGlobals`::
3333

@@ -66,7 +66,7 @@ can be accessed via several public properties:
6666
* ``server``: equivalent of ``$_SERVER``;
6767

6868
* ``headers``: mostly equivalent to a sub-set of ``$_SERVER``
69-
(``$request->headers->get('Content-Type')``).
69+
(``$request->headers->get('user-agent')``).
7070

7171
Each property is a :class:`Symfony\\Component\\HttpFoundation\\ParameterBag`
7272
instance (or a sub-class of), which is a data holder class:
@@ -128,7 +128,7 @@ has some methods to filter the input values:
128128
parameter value converted to integer;
129129

130130
* :method:`Symfony\\Component\\HttpFoundation\\ParameterBag::filter`: Filters the
131-
parameter by using the PHP ``filter_var()`` function.
131+
parameter by using the PHP :phpfunction:`filter_var` function.
132132

133133
All getters takes up to three arguments: the first one is the parameter name
134134
and the second one is the default value to return if the parameter does not
@@ -150,7 +150,7 @@ When PHP imports the request query, it handles request parameters like
150150
``foo[bar]=bar`` in a special way as it creates an array. So you can get the
151151
``foo`` parameter and you will get back an array with a ``bar`` element. But
152152
sometimes, you might want to get the value for the "original" parameter name:
153-
``foo[bar]``. This is possible with all the `ParameterBag` getters like
153+
``foo[bar]``. This is possible with all the ``ParameterBag`` getters like
154154
:method:`Symfony\\Component\\HttpFoundation\\Request::get` via the third
155155
argument::
156156

@@ -172,7 +172,8 @@ thanks to the public ``attributes`` property, which is also an instance of
172172
:class:`Symfony\\Component\\HttpFoundation\\ParameterBag`. This is mostly used
173173
to attach information that belongs to the Request and that needs to be
174174
accessed from many different points in your application. For information
175-
on how this is used in the Symfony2 framework, see :ref:`read more<book-fundamentals-attributes>`.
175+
on how this is used in the Symfony2 framework, see
176+
:ref:`the Symfony2 book<book-fundamentals-attributes>`.
176177

177178
Identifying a Request
178179
~~~~~~~~~~~~~~~~~~~~~
@@ -188,8 +189,8 @@ this is done via the "path info" of the request, which can be accessed via the
188189
Simulating a Request
189190
~~~~~~~~~~~~~~~~~~~~
190191

191-
Instead of creating a Request based on the PHP globals, you can also simulate
192-
a Request::
192+
Instead of creating a request based on the PHP globals, you can also simulate
193+
a request::
193194

194195
$request = Request::create(
195196
'/hello-world',
@@ -198,7 +199,7 @@ a Request::
198199
);
199200

200201
The :method:`Symfony\\Component\\HttpFoundation\\Request::create` method
201-
creates a request based on a path info, a method and some parameters (the
202+
creates a request based on a URI, a method and some parameters (the
202203
query parameters or the request ones depending on the HTTP method); and of
203204
course, you can also override all other variables as well (by default, Symfony
204205
creates sensible defaults for all the PHP global variables).
@@ -210,19 +211,19 @@ Based on such a request, you can override the PHP global variables via
210211

211212
.. tip::
212213

213-
You can also duplicate an existing query via
214+
You can also duplicate an existing request via
214215
:method:`Symfony\\Component\\HttpFoundation\\Request::duplicate` or
215216
change a bunch of parameters with a single call to
216217
:method:`Symfony\\Component\\HttpFoundation\\Request::initialize`.
217218

218219
Accessing the Session
219220
~~~~~~~~~~~~~~~~~~~~~
220221

221-
If you have a session attached to the Request, you can access it via the
222+
If you have a session attached to the request, you can access it via the
222223
:method:`Symfony\\Component\\HttpFoundation\\Request::getSession` method;
223224
the
224225
:method:`Symfony\\Component\\HttpFoundation\\Request::hasPreviousSession`
225-
method tells you if the request contains a Session which was started in one of
226+
method tells you if the request contains a session which was started in one of
226227
the previous requests.
227228

228229
Accessing `Accept-*` Headers Data
@@ -238,13 +239,15 @@ by using the following methods:
238239
returns the list of accepted languages ordered by descending quality;
239240

240241
* :method:`Symfony\\Component\\HttpFoundation\\Request::getCharsets`:
241-
returns the list of accepted charsets ordered by descending quality;
242+
returns the list of accepted charsets ordered by descending quality.
242243

243244
Accessing other Data
244245
~~~~~~~~~~~~~~~~~~~~
245246

246-
The Request class has many other methods that you can use to access the
247-
request information. Have a look at the API for more information about them.
247+
The ``Request`` class has many other methods that you can use to access the
248+
request information. Have a look at
249+
:class:`the Request API<Symfony\\Component\\HttpFoundation\\Request>`
250+
for more information about them.
248251

249252
Response
250253
--------

0 commit comments

Comments
 (0)