1 | <?php |
||
13 | class RequestConfigurator |
||
14 | { |
||
15 | /** |
||
16 | * @var array |
||
17 | */ |
||
18 | protected $options = []; |
||
19 | |||
20 | /** |
||
21 | * @param string $app_code |
||
22 | * |
||
23 | * @return RequestConfigurator |
||
24 | */ |
||
25 | 1 | public function setAppCode($app_code) |
|
31 | |||
32 | /** |
||
33 | * @param string $app_client |
||
34 | * |
||
35 | * @return RequestConfigurator |
||
36 | */ |
||
37 | 2 | public function setAppClient($app_client) |
|
38 | { |
||
39 | 2 | $this->options[RequestOptions::QUERY]['client'] = $app_client; |
|
40 | |||
41 | 2 | return $this; |
|
42 | } |
||
43 | |||
44 | /** |
||
45 | * @param int $timeout |
||
46 | * |
||
47 | * @return RequestConfigurator |
||
48 | */ |
||
49 | 2 | public function setTimeout($timeout) |
|
50 | { |
||
51 | 2 | $this->options[RequestOptions::TIMEOUT] = $timeout; |
|
52 | |||
53 | 2 | return $this; |
|
54 | } |
||
55 | |||
56 | /** |
||
57 | * @param string $proxy |
||
58 | * |
||
59 | * @return RequestConfigurator |
||
60 | */ |
||
61 | 1 | public function setProxy($proxy) |
|
62 | { |
||
63 | 1 | $this->options[RequestOptions::PROXY] = $proxy; |
|
64 | |||
65 | 1 | return $this; |
|
66 | } |
||
67 | |||
68 | /** |
||
69 | * @param string $app_version |
||
70 | * |
||
71 | * @return RequestConfigurator |
||
72 | */ |
||
73 | 2 | public function setAppVersion($app_version) |
|
74 | { |
||
75 | 2 | $this->options[RequestOptions::QUERY]['clientver'] = $app_version; |
|
76 | |||
77 | 2 | return $this; |
|
78 | } |
||
79 | |||
80 | /** |
||
81 | * @param string $protocol_version |
||
82 | * |
||
83 | * @return RequestConfigurator |
||
84 | */ |
||
85 | 2 | public function setProtocolVersion($protocol_version) |
|
91 | |||
92 | /** |
||
93 | * @param string $request |
||
94 | * @param array $query |
||
95 | * |
||
96 | * @return RequestConfigurator |
||
97 | */ |
||
98 | 3 | public function withRequest($request, array $query = []) |
|
106 | |||
107 | /** |
||
108 | * @return array |
||
109 | */ |
||
110 | 9 | public function getOptions() |
|
114 | } |
||
115 |