1 | <?php |
||
12 | class Cached extends Client |
||
13 | { |
||
14 | /** |
||
15 | * @var Client |
||
16 | */ |
||
17 | public $client; |
||
18 | |||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | public $cacheDir; |
||
23 | |||
24 | /** |
||
25 | * @param Client $client |
||
26 | */ |
||
27 | public function __construct(Client $client) |
||
33 | |||
34 | /** |
||
35 | * {@inheritdoc} |
||
36 | */ |
||
37 | public function get($url, $headers = []) |
||
53 | |||
54 | /** |
||
55 | * {@inheritdoc} |
||
56 | */ |
||
57 | public function post($url, $headers = [], $body = '') |
||
61 | |||
62 | /** |
||
63 | * Generate and return a filepath that matches given vars |
||
64 | * |
||
65 | * @param array $vars |
||
66 | * @return string |
||
67 | */ |
||
68 | protected function getCachedFilepath(array $vars) |
||
83 | |||
84 | |||
85 | /** |
||
86 | * Generate a key for a given set of values |
||
87 | * |
||
88 | * @param string[] $vars |
||
89 | * @return string |
||
90 | */ |
||
91 | protected function getCacheKey(array $vars) |
||
95 | |||
96 | /** |
||
97 | * Return cached client configured with this client's options |
||
98 | * |
||
99 | * @return Client |
||
100 | */ |
||
101 | protected function getClient() |
||
108 | } |