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