1 | <?php |
||
7 | class Client |
||
8 | { |
||
9 | /** |
||
10 | * @const int The timeout in seconds for requests. |
||
11 | */ |
||
12 | const DEFAULT_REQUEST_TIMEOUT = 20; |
||
13 | |||
14 | /** |
||
15 | * @var ClientInterface HTTP client handler. |
||
16 | */ |
||
17 | protected $clientHandler; |
||
18 | |||
19 | /** |
||
20 | * Instantiates a new Client object. |
||
21 | * |
||
22 | * @param ClientInterface|null $clientHandler |
||
23 | */ |
||
24 | 14 | public function __construct(ClientInterface $clientHandler = null) |
|
28 | |||
29 | /** |
||
30 | * Returns the HTTP client handler. |
||
31 | * |
||
32 | * @return ClientInterface |
||
33 | */ |
||
34 | 2 | public function getClientHandler() |
|
38 | |||
39 | /** |
||
40 | * Sets the HTTP client handler. |
||
41 | * |
||
42 | * @param ClientInterface $clientHandler |
||
43 | */ |
||
44 | 11 | public function setClientHandler(ClientInterface $clientHandler) |
|
48 | |||
49 | /** |
||
50 | * Sends the request to API and returns the response. |
||
51 | * |
||
52 | * @param Request $request |
||
53 | * |
||
54 | * @return \Postpay\Http\Response |
||
55 | * |
||
56 | * @throws \Postpay\Exceptions\PostpayException |
||
57 | */ |
||
58 | 9 | public function request(Request $request) |
|
70 | } |
||
71 |