1 | <?php |
||
19 | abstract class Service implements ConfigurableInterface |
||
20 | { |
||
21 | use ConfigurableTrait; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $name; |
||
27 | |||
28 | /** |
||
29 | * @var TransportInterface |
||
30 | */ |
||
31 | protected $transport; |
||
32 | |||
33 | /** |
||
34 | * @var CredentialsInterface |
||
35 | */ |
||
36 | protected $credentials; |
||
37 | |||
38 | /** |
||
39 | * @var bool |
||
40 | */ |
||
41 | private $useOperatorUnits = true; |
||
42 | |||
43 | /** |
||
44 | * @param string $name |
||
45 | */ |
||
46 | 46 | public function setName($name) |
|
50 | |||
51 | /** |
||
52 | * @param TransportInterface $transport |
||
53 | */ |
||
54 | 46 | public function setTransport(TransportInterface $transport) |
|
58 | |||
59 | /** |
||
60 | * @param CredentialsInterface $credentials |
||
61 | */ |
||
62 | 46 | public function setCredentials(CredentialsInterface $credentials) |
|
66 | |||
67 | /** |
||
68 | * @param bool $useOperatorUnits |
||
69 | */ |
||
70 | public function setUseOperatorUnits($useOperatorUnits) |
||
74 | |||
75 | /** |
||
76 | * Do API request with needle headers |
||
77 | * |
||
78 | * @param array $params |
||
79 | * @param array $headers |
||
80 | * @return mixed |
||
81 | */ |
||
82 | public function request(array $params, $headers = []) |
||
106 | |||
107 | /** |
||
108 | * @param TransportResponse $response |
||
109 | * @throws ErrorResponseException |
||
110 | */ |
||
111 | protected static function handleErrorResponse(TransportResponse $response) |
||
126 | } |