1 | <?php |
||
64 | class Client |
||
65 | { |
||
66 | const NAME = 'SlinceShopifyClient'; |
||
67 | |||
68 | const VERSION = '2.1.0'; |
||
69 | |||
70 | /** |
||
71 | * @var HttpClient |
||
72 | */ |
||
73 | protected $httpClient; |
||
74 | |||
75 | /** |
||
76 | * @var Container |
||
77 | */ |
||
78 | protected $container; |
||
79 | |||
80 | /** |
||
81 | * @var CredentialInterface |
||
82 | */ |
||
83 | protected $credential; |
||
84 | |||
85 | /** |
||
86 | * The shop. |
||
87 | * |
||
88 | * @var string |
||
89 | */ |
||
90 | protected $shop; |
||
91 | |||
92 | /** |
||
93 | * Array of services classes. |
||
94 | * |
||
95 | * @var array |
||
96 | */ |
||
97 | public $serviceClass = [ |
||
98 | Manager\Article\ArticleManager::class, |
||
99 | Manager\Asset\AssetManager::class, |
||
100 | Manager\Blog\BlogManager::class, |
||
101 | Manager\CarrierService\CarrierServiceManager::class, |
||
102 | Manager\Collect\CollectManager::class, |
||
103 | Manager\Comment\CommentManager::class, |
||
104 | Manager\Country\CountryManager::class, |
||
105 | Manager\CustomCollection\CustomCollectionManager::class, |
||
106 | Manager\Customer\CustomerManager::class, |
||
107 | Manager\CustomerAddress\AddressManager::class, |
||
108 | Manager\CustomerSavedSearch\CustomerSavedSearchManager::class, |
||
109 | Manager\DiscountCode\DiscountCodeManager::class, |
||
110 | Manager\Fulfillment\FulfillmentManager::class, |
||
111 | Manager\FulfillmentService\FulfillmentServiceManager::class, |
||
112 | Manager\InventoryItem\InventoryItemManager::class, |
||
113 | Manager\InventoryLevel\InventoryLevelManager::class, |
||
114 | Manager\Location\LocationManager::class, |
||
115 | Manager\Order\OrderManager::class, |
||
116 | Manager\OrderRisk\RiskManager::class, |
||
117 | Manager\Page\PageManager::class, |
||
118 | Manager\Policy\PolicyManager::class, |
||
119 | Manager\PriceRule\PriceRuleManager::class, |
||
120 | Manager\Product\ProductManager::class, |
||
121 | Manager\ProductImage\ImageManager::class, |
||
122 | Manager\ProductVariant\VariantManager::class, |
||
123 | Manager\Province\ProvinceManager::class, |
||
124 | Manager\RecurringApplicationCharge\RecurringApplicationChargeManager::class, |
||
125 | Manager\Redirect\RedirectManager::class, |
||
126 | Manager\Refund\RefundManager::class, |
||
127 | Manager\ScriptTag\ScriptTagManager::class, |
||
128 | Manager\ShippingZone\ShippingZoneManager::class, |
||
129 | Manager\Shop\ShopManager::class, |
||
130 | Manager\Theme\ThemeManager::class, |
||
131 | Manager\Transaction\TransactionManager::class, |
||
132 | Manager\Webhook\WebhookManager::class, |
||
133 | ]; |
||
134 | |||
135 | protected $metaDirs = [ |
||
136 | 'Slince\Shopify' => __DIR__.'/../config/serializer' |
||
137 | ]; |
||
138 | |||
139 | /** |
||
140 | * Whether delay the next request. |
||
141 | * |
||
142 | * @var bool |
||
143 | */ |
||
144 | protected static $delayNextRequest = false; |
||
145 | |||
146 | /** |
||
147 | * @var string |
||
148 | */ |
||
149 | protected $metaCacheDir; |
||
150 | |||
151 | /** |
||
152 | * @var Hydrator |
||
153 | */ |
||
154 | protected $hydrator; |
||
155 | |||
156 | public function __construct(CredentialInterface $credential, $shop, array $options = []) |
||
165 | |||
166 | public function __call($name, $arguments) |
||
175 | |||
176 | /** |
||
177 | * Gets the credential. |
||
178 | * |
||
179 | * @return CredentialInterface |
||
180 | */ |
||
181 | public function getCredential() |
||
185 | |||
186 | /** |
||
187 | * sets the shop name for the client. |
||
188 | * |
||
189 | * @param string $shop |
||
190 | */ |
||
191 | public function setShop($shop) |
||
200 | |||
201 | /** |
||
202 | * Gets the shop. |
||
203 | * |
||
204 | * @return string |
||
205 | */ |
||
206 | public function getShop() |
||
210 | |||
211 | /** |
||
212 | * Sets the http client for the client. |
||
213 | * |
||
214 | * @param HttpClient $httpClient |
||
215 | */ |
||
216 | public function setHttpClient($httpClient) |
||
220 | |||
221 | /** |
||
222 | * Gets the http client. |
||
223 | * |
||
224 | * @return HttpClient |
||
225 | */ |
||
226 | public function getHttpClient() |
||
235 | |||
236 | /** |
||
237 | * Perform a GET request. |
||
238 | * |
||
239 | * @param string $resource |
||
240 | * @param array $query |
||
241 | * |
||
242 | * @return array |
||
243 | */ |
||
244 | public function get($resource, $query = []) |
||
250 | |||
251 | /** |
||
252 | * Perform a POST request. |
||
253 | * |
||
254 | * @param string $resource |
||
255 | * @param array $data |
||
256 | * @param array $query |
||
257 | * |
||
258 | * @return array |
||
259 | */ |
||
260 | public function post($resource, $data, $query = []) |
||
267 | |||
268 | /** |
||
269 | * Perform a PUT request. |
||
270 | * |
||
271 | * @param string $resource |
||
272 | * @param array $data |
||
273 | * @param array $query |
||
274 | * |
||
275 | * @return array |
||
276 | */ |
||
277 | public function put($resource, $data, $query = []) |
||
284 | |||
285 | /** |
||
286 | * Perform a DELETE request. |
||
287 | * |
||
288 | * @param string $resource |
||
289 | * @param array $query |
||
290 | */ |
||
291 | public function delete($resource, $query = []) |
||
297 | |||
298 | protected function doRequest($method, $resource, $options = []) |
||
310 | |||
311 | /** |
||
312 | * Builds an url by given resource name. |
||
313 | * |
||
314 | * @param string $resource |
||
315 | * |
||
316 | * @return string |
||
317 | */ |
||
318 | protected function buildUrl($resource) |
||
322 | |||
323 | /** |
||
324 | * Send a request. |
||
325 | * |
||
326 | * @param RequestInterface $request |
||
327 | * @param array $options |
||
328 | * |
||
329 | * @return ResponseInterface |
||
330 | * @throws GuzzleException |
||
331 | * @codeCoverageIgnore |
||
332 | */ |
||
333 | public function sendRequest(RequestInterface $request, array $options = []) |
||
351 | |||
352 | /** |
||
353 | * Applies the array of request options to the client. |
||
354 | * |
||
355 | * @param array $options |
||
356 | */ |
||
357 | protected function applyOptions(array $options) |
||
365 | |||
366 | /** |
||
367 | * Gets the hydrator instance. |
||
368 | * |
||
369 | * @return Hydrator |
||
370 | */ |
||
371 | public function getHydrator() |
||
378 | |||
379 | /** |
||
380 | * Add a custom meta dir. |
||
381 | * |
||
382 | * @param string $namespace |
||
383 | * @param string $path |
||
384 | * @throws RuntimeException |
||
385 | */ |
||
386 | public function addMetaDir($namespace, $path) |
||
393 | |||
394 | /** |
||
395 | * Add a custom service class. |
||
396 | * |
||
397 | * @param string $serviceClass |
||
398 | * @throws InvalidArgumentException |
||
399 | */ |
||
400 | public function addServiceClass($serviceClass) |
||
408 | |||
409 | /** |
||
410 | * Initialize base services. |
||
411 | */ |
||
412 | protected function initializeBaseServices() |
||
418 | } |
||
419 |
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: