Skip to content

Commit 87d3427

Browse files
committed
Update user guide
1 parent 9f03879 commit 87d3427

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

guide/index.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ The HTTP Client library is very simple and powerful which can be used as follows
3939
$request->setBasicAuth('johndoe', 'abc123'); // static
4040
$request->setJson(['name' => 'John Doe']); // static
4141
42-
$response = $client->run($request); // Framework\HTTP\Client\Response
42+
$response = $client->send($request); // Framework\HTTP\Client\Response
4343
4444
echo $response->getStatus();
4545
echo $response->getBody();
@@ -248,13 +248,13 @@ Let's see how to instantiate it:
248248
Synchronous Requests
249249
####################
250250

251-
A request can be made by passing a Request instance in the ``run`` method, which
251+
A request can be made by passing a Request instance in the ``send`` method, which
252252
will return a `Response`_ or throw an ``Framework\HTTP\Client\RequestException``
253253
if it fails:
254254

255255
.. code-block:: php
256256
257-
$response = $client->run($request); // Framework\HTTP\Client\Response
257+
$response = $client->send($request); // Framework\HTTP\Client\Response
258258
259259
If you call the Request's ``setGetInfo`` method, it will be possible to obtain
260260
information from Curl through the exception's ``getInfo`` method:
@@ -264,7 +264,7 @@ information from Curl through the exception's ``getInfo`` method:
264264
$request->setGetInfo();
265265
266266
try {
267-
$response = $client->run($request); // Framework\HTTP\Client\Response
267+
$response = $client->send($request); // Framework\HTTP\Client\Response
268268
} catch (Framework\HTTP\Client\RequestException $exception) {
269269
echo $exception->getMessage(); // string
270270
var_dump($exception->getInfo()); // array
@@ -273,10 +273,10 @@ information from Curl through the exception's ``getInfo`` method:
273273
Asynchronous Requests
274274
#####################
275275

276-
To perform asynchronous requests use the ``runMulti`` method, passing an array
276+
To perform asynchronous requests use the ``sendMulti`` method, passing an array
277277
with request identifiers as keys and Requests as values.
278278

279-
The ``runMulti`` method will return a
279+
The ``sendMulti`` method will return a
280280
`Generator <https://www.php.net/manual/en/language.generators.php>`_ with the
281281
request id in the key and a `Response`_, or `Response Error`_, instance as a value.
282282

@@ -295,7 +295,7 @@ Responses will be delivered as requests are finalized:
295295
2 => new Request('https://aplus-framework.tld'),
296296
];
297297
298-
foreach($client->runMulti($requests) as $id => $response) {
298+
foreach($client->sendMulti($requests) as $id => $response) {
299299
if ($response instanceof ResponseError) {
300300
echo "Request $id has error: ";
301301
echo $response->getError() . '.<br>';
@@ -305,8 +305,8 @@ Responses will be delivered as requests are finalized:
305305
echo '<pre>' . htmlentities((string) $response) . '</pre>';
306306
}
307307
308-
In the ``run`` method, the ``Framework\HTTP\Client\RequestException`` exception
309-
is thrown if the connection fails. On the other hand, the ``runMulti`` method
308+
In the ``send`` method, the ``Framework\HTTP\Client\RequestException`` exception
309+
is thrown if the connection fails. On the other hand, the ``sendMulti`` method
310310
does not throw exceptions so that requests are not interrupted.
311311

312312
To find out if a request failed, perform a check similar to the code example

0 commit comments

Comments
 (0)