1 | <?php |
||
22 | final class SteamSpyService |
||
23 | { |
||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | const BASE_URI = 'https://steamspy.com/api.php'; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | const BUCKET = 'steamspy'; |
||
33 | |||
34 | /** |
||
35 | * @var TokenBucket |
||
36 | */ |
||
37 | private $bucket; |
||
38 | |||
39 | /** |
||
40 | * @var ClientInterface |
||
41 | */ |
||
42 | private $client; |
||
43 | |||
44 | /** |
||
45 | * Constructor. |
||
46 | * |
||
47 | * @param ClientInterface $client |
||
48 | * @param TokenBucket $bucket |
||
49 | */ |
||
50 | 5 | public function __construct(ClientInterface $client, TokenBucket $bucket) |
|
55 | |||
56 | /** |
||
57 | * Finds all games. |
||
58 | * |
||
59 | * @return array |
||
60 | */ |
||
61 | 3 | public function findAll(): array |
|
75 | |||
76 | /** |
||
77 | * Finds a game by its Steam AppId. |
||
78 | * |
||
79 | * @param int $appId |
||
80 | * |
||
81 | * @return array |
||
82 | */ |
||
83 | 2 | public function findByAppId(int $appId): array |
|
98 | |||
99 | 3 | private function parseResponse(ResponseInterface $response): array |
|
114 | } |
||
115 |