1 | <?php |
||
19 | class GuzzleRequestHandler implements RequestHandlerInterface |
||
20 | { |
||
21 | /** |
||
22 | * @var LoggerInterface |
||
23 | */ |
||
24 | protected $logger; |
||
25 | |||
26 | /** |
||
27 | * @var ClientInterface |
||
28 | */ |
||
29 | protected $httpClient; |
||
30 | |||
31 | /** |
||
32 | * GuzzleRequestHandler constructor. |
||
33 | * |
||
34 | * @param ClientInterface $client |
||
35 | * @param LoggerInterface $logger |
||
36 | */ |
||
37 | public function __construct(?ClientInterface $client = null, LoggerInterface $logger = null) |
||
51 | |||
52 | public function get(string $uri): ResponseInterface |
||
56 | |||
57 | /** |
||
58 | * This is the method that actually makes the call, which can be easily overwritten so that our unit tests can work |
||
59 | * |
||
60 | * @param string $uri |
||
61 | * @param array $formData |
||
62 | * |
||
63 | * @return TelegramRawData |
||
64 | */ |
||
65 | public function request(string $uri, array $formData = []): TelegramRawData |
||
84 | |||
85 | /** |
||
86 | * @param string $uri |
||
87 | * @param array $formData |
||
88 | * |
||
89 | * @return PromiseInterface |
||
90 | */ |
||
91 | public function requestAsync(string $uri, array $formData = []): PromiseInterface |
||
109 | } |