1 | <?php |
||
10 | class Request implements RequestInterface |
||
11 | { |
||
12 | /** |
||
13 | * @var HttpInterface |
||
14 | */ |
||
15 | protected $client; |
||
16 | |||
17 | /** |
||
18 | * @var null|string |
||
19 | */ |
||
20 | protected $token; |
||
21 | |||
22 | public function __construct(HttpInterface $http, $token = null) |
||
23 | { |
||
24 | $this->client = $http; |
||
25 | $this->token = $token; |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * @param string $uri |
||
30 | * @param array $params |
||
31 | * @return array|null |
||
32 | */ |
||
33 | public function get($uri, $params = []) |
||
34 | { |
||
35 | $headers = $this->createHeaders(); |
||
36 | |||
37 | return $this->client->get($uri, $params, $headers); |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @param string $uri |
||
42 | * @param array $params |
||
43 | * @return array |
||
44 | */ |
||
45 | public function post($uri, $params = []) |
||
51 | |||
52 | public function delete($uri) |
||
58 | |||
59 | /** |
||
60 | * @return array|null |
||
61 | */ |
||
62 | protected function createHeaders() |
||
70 | |||
71 | /** |
||
72 | * @param string $requestMethod |
||
73 | * @param string $uri |
||
74 | * @param array $params |
||
75 | * @return mixed |
||
76 | * @throws HeadHunterApiException |
||
77 | */ |
||
78 | public function makeRequestCall($requestMethod, $uri, $params = []) |
||
90 | } |