1 | <?php |
||
10 | class Client |
||
11 | { |
||
12 | /** |
||
13 | * @var GuzzleClientInterface |
||
14 | */ |
||
15 | protected $httpClient; |
||
16 | |||
17 | /** |
||
18 | * This is the API username which you find/generate under Settings > API |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | private $username; |
||
23 | |||
24 | /** |
||
25 | * This is the API password which you find/generate under Settings > API |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | private $password; |
||
30 | |||
31 | /** |
||
32 | * This is the base url for the API |
||
33 | * |
||
34 | * @var string |
||
35 | */ |
||
36 | private $baseUrl = 'https://app.pakkelabels.dk/api/public/v3'; |
||
37 | |||
38 | /** |
||
39 | * @var array |
||
40 | */ |
||
41 | private $defaultOptions; |
||
42 | |||
43 | /** |
||
44 | * @var ResponseInterface |
||
45 | */ |
||
46 | private $lastResponse; |
||
47 | |||
48 | 15 | public function __construct($username, $password) |
|
54 | |||
55 | /** |
||
56 | * @param string $method |
||
57 | * @param string $uri |
||
58 | * @param array $options |
||
59 | * @return array |
||
60 | */ |
||
61 | 3 | public function doRequest($method, $uri, array $options = []) : array |
|
77 | |||
78 | /****************** |
||
79 | * Helper methods * |
||
80 | *****************/ |
||
81 | 9 | /** |
|
82 | * Returns the number of pages in the collection |
||
83 | 9 | * Returns 0 if the header isn't set |
|
84 | 6 | * |
|
85 | * @return int |
||
86 | 9 | */ |
|
87 | public function getPageCount() : int |
||
95 | 3 | ||
96 | 3 | /** |
|
97 | * Returns the total item count in the collection |
||
98 | * Returns 0 if the header isn't set |
||
99 | * |
||
100 | * @return int |
||
101 | */ |
||
102 | 6 | public function getItemCount() : int |
|
110 | |||
111 | 3 | /** |
|
112 | * @return GuzzleClientInterface |
||
113 | 3 | */ |
|
114 | 3 | public function getHttpClient() : GuzzleClientInterface |
|
121 | |||
122 | 6 | /** |
|
123 | * @param GuzzleClientInterface $httpClient |
||
124 | * @return Client |
||
125 | */ |
||
126 | public function setHttpClient(GuzzleClientInterface $httpClient) : self |
||
131 | 3 | ||
132 | 3 | /** |
|
133 | * @return string |
||
134 | */ |
||
135 | public function getUsername(): string |
||
139 | |||
140 | 3 | /** |
|
141 | * @param string $username |
||
142 | * @return Client |
||
143 | */ |
||
144 | public function setUsername(string $username) : self |
||
149 | 3 | ||
150 | 3 | /** |
|
151 | * @return string |
||
152 | */ |
||
153 | public function getPassword(): string |
||
157 | |||
158 | 6 | /** |
|
159 | * @param string $password |
||
160 | * @return Client |
||
161 | */ |
||
162 | public function setPassword(string $password) : self |
||
167 | 3 | ||
168 | 3 | /** |
|
169 | * @return string |
||
170 | */ |
||
171 | public function getBaseUrl() : string |
||
175 | |||
176 | /** |
||
177 | * @param string $baseUrl |
||
178 | * @return Client |
||
179 | */ |
||
180 | public function setBaseUrl(string $baseUrl) : self |
||
185 | |||
186 | /** |
||
187 | * @return array |
||
188 | */ |
||
189 | 3 | public function getDefaultOptions() : array |
|
193 | 3 | ||
194 | /** |
||
195 | * @param array $options |
||
196 | 3 | * @return Client |
|
197 | 3 | */ |
|
198 | public function setDefaultOptions(array $options) : self |
||
203 | 3 | ||
204 | /** |
||
205 | * @return ResponseInterface |
||
206 | 3 | */ |
|
207 | public function getLastResponse(): ResponseInterface |
||
211 | |||
212 | /** |
||
213 | * @param ResponseInterface $lastResponse |
||
214 | * @return Client |
||
215 | */ |
||
216 | public function setLastResponse(ResponseInterface $lastResponse) : self |
||
221 | |||
222 | protected function configureOptions(OptionsResolver $optionsResolver) |
||
240 | } |
||
241 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: