1 | <?php |
||
11 | class ClientWithCache |
||
12 | { |
||
13 | private const CACHE_DIR = '/tmp/battlerite'; |
||
14 | |||
15 | private const CACHE_PREFIX = 'battlerite-'; |
||
16 | |||
17 | private const CACHE_LIFETIME = 300; |
||
18 | |||
19 | /** |
||
20 | * @var Client |
||
21 | */ |
||
22 | private $client; |
||
23 | /** |
||
24 | * @var Cache |
||
25 | */ |
||
26 | private $cache; |
||
27 | |||
28 | 2 | public function __construct(Client $client, Cache $cache) |
|
33 | |||
34 | /** |
||
35 | * Create default API client setup with a filesystem caching layer |
||
36 | */ |
||
37 | public static function create(string $apiKey): self |
||
49 | |||
50 | /** |
||
51 | * Create default API client setup with a custom caching layer |
||
52 | */ |
||
53 | public static function createWithCache(string $apiKey, Cache $cache): self |
||
65 | |||
66 | 1 | public function getPlayer(string $playerId): DetailedPlayer |
|
76 | |||
77 | 1 | public function getMatch(string $matchId): DetailedMatch |
|
87 | } |
||
88 |