1 | <?php |
||
9 | class Request |
||
10 | { |
||
11 | const API_CALL_LIMIT_HEADER = 'http_x_shopify_shop_api_call_limit'; |
||
12 | |||
13 | /** |
||
14 | * @var Client |
||
15 | */ |
||
16 | protected $httpClient; |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $responseKey; |
||
22 | |||
23 | /** |
||
24 | * @var int |
||
25 | */ |
||
26 | private $rateLimit; |
||
27 | |||
28 | /** |
||
29 | * @var int |
||
30 | */ |
||
31 | private $callsMade; |
||
32 | |||
33 | /** |
||
34 | * @var float |
||
35 | */ |
||
36 | private static $callCycle = 0.5; // avg. 2 calls a second |
||
37 | |||
38 | /** |
||
39 | * @var float |
||
40 | */ |
||
41 | private $rateLimitThreshold = 0.8; |
||
42 | |||
43 | /** |
||
44 | * @var int |
||
45 | */ |
||
46 | private $rateLimitReached = 0; |
||
47 | |||
48 | /** |
||
49 | * Request constructor. |
||
50 | * @param ClientInterface $client |
||
51 | */ |
||
52 | 5 | public function __construct(ClientInterface $client) |
|
56 | |||
57 | /** |
||
58 | * @param string $method |
||
59 | * @param string $endpoint |
||
60 | * @param array $parameters |
||
61 | * @return bool |
||
62 | * @throws ShopifyException |
||
63 | */ |
||
64 | 130 | public function request(string $method, string $endpoint, array $parameters = []) |
|
87 | |||
88 | /** |
||
89 | * @param string $responseKey |
||
90 | * @return Request |
||
91 | */ |
||
92 | 132 | public function setResponseKey($responseKey) |
|
96 | |||
97 | /** |
||
98 | * @param callable $function |
||
99 | * @return mixed |
||
100 | */ |
||
101 | 15 | public static function throttle(callable $function) |
|
115 | |||
116 | /** |
||
117 | * @return int |
||
118 | */ |
||
119 | 1 | public function getRateLimitReached(): int |
|
123 | |||
124 | 130 | private function handleRateLimit() |
|
133 | |||
134 | /** |
||
135 | * @param array $header |
||
136 | */ |
||
137 | 127 | private function setRateLimit(array $header) |
|
147 | |||
148 | /** |
||
149 | * @return bool |
||
150 | */ |
||
151 | 122 | public function isRateLimitReached(): bool |
|
155 | |||
156 | /** |
||
157 | * @return float|int |
||
158 | */ |
||
159 | 122 | public function getCallLimit() |
|
163 | } |
||
164 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..