Debian Codegraph @

vendor/react/http/src/Client/Client.php

raw
1 <?php
2
3 namespace React\Http\Client;
4
5 use React\EventLoop\LoopInterface;
6 use React\Socket\ConnectorInterface;
7 use React\Socket\Connector;
8
9 /**
10 * @internal
11 */
12 class Client
13 {
14 private $connector;
15
16 public function __construct(LoopInterface $loop, ConnectorInterface $connector = null)
17 {
18 if ($connector === null) {
19 $connector = new Connector($loop);
20 }
21
22 $this->connector = $connector;
23 }
24
25 public function request($method, $url, array $headers = array(), $protocolVersion = '1.0')
26 {
27 $requestData = new RequestData($method, $url, $headers, $protocolVersion);
28
29 return new Request($this->connector, $requestData);
30 }
31 }