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