1 | <?php |
||
20 | abstract class Service implements ServiceInterface |
||
21 | { |
||
22 | use ConfigurableTrait; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $name; |
||
28 | |||
29 | /** |
||
30 | * @var TransportInterface |
||
31 | */ |
||
32 | protected $transport; |
||
33 | |||
34 | /** |
||
35 | * @var CredentialsInterface |
||
36 | */ |
||
37 | protected $credentials; |
||
38 | |||
39 | /** |
||
40 | * @var array |
||
41 | */ |
||
42 | protected $headers = [ |
||
43 | 'Accept-Language' => RequestInterface::LANGUAGE_RU, |
||
44 | 'Use-Operator-Units' => 'true' |
||
45 | ]; |
||
46 | |||
47 | |||
48 | /** |
||
49 | * @inheritdoc |
||
50 | */ |
||
51 | 1 | public function request(array $params, array $headers = []) |
|
70 | |||
71 | /** |
||
72 | * @param string $name |
||
73 | * @return $this |
||
74 | */ |
||
75 | 49 | public function setName($name) |
|
80 | |||
81 | /** |
||
82 | * @inheritdoc |
||
83 | */ |
||
84 | public function getName() |
||
88 | |||
89 | /** |
||
90 | * @inheritdoc |
||
91 | */ |
||
92 | public function getCredentials() |
||
96 | |||
97 | /** |
||
98 | * @inheritdoc |
||
99 | */ |
||
100 | public function getTransport() |
||
104 | |||
105 | /* Fluid setters */ |
||
106 | |||
107 | /** |
||
108 | * @param TransportInterface $transport |
||
109 | * @return $this |
||
110 | */ |
||
111 | 50 | public function setTransport($transport) |
|
116 | |||
117 | /** |
||
118 | * @param CredentialsInterface $credentials |
||
119 | * @return $this |
||
120 | */ |
||
121 | 50 | public function setCredentials($credentials) |
|
126 | |||
127 | /** |
||
128 | * @param array $headers |
||
129 | * @return $this |
||
130 | */ |
||
131 | public function setHeaders($headers) |
||
136 | |||
137 | /** |
||
138 | * @param $useOperatorUnits |
||
139 | * @return $this |
||
140 | */ |
||
141 | public function setUseOperatorUnits($useOperatorUnits) |
||
149 | |||
150 | /** |
||
151 | * @param $language |
||
152 | * @return $this |
||
153 | */ |
||
154 | public function setLanguage($language) |
||
159 | |||
160 | 1 | protected function handleResponse(ResponseInterface $response) |
|
188 | |||
189 | protected function handleReportsResponse(ResponseInterface $response) |
||
215 | } |
||
216 |