@@ 161-174 (lines=14) @@ | ||
158 | ? json_decode(file_get_contents($cache_file), TRUE) |
|
159 | : []; |
|
160 | ||
161 | if ($cached_data === $api_data && file_exists($transformed_cache_file)) |
|
162 | { |
|
163 | return json_decode(file_get_contents($transformed_cache_file), TRUE); |
|
164 | } |
|
165 | else |
|
166 | { |
|
167 | file_put_contents($cache_file, json_encode($api_data)); |
|
168 | ||
169 | $zippered_data = $this->zipper_lists($api_data); |
|
170 | $transformer = new Transformer\MangaListTransformer(); |
|
171 | $transformed_data = $transformer->transform_collection($zippered_data); |
|
172 | file_put_contents($transformed_cache_file, json_encode($transformed_data)); |
|
173 | return $transformed_data; |
|
174 | } |
|
175 | } |
|
176 | ||
177 | /** |
@@ 245-256 (lines=12) @@ | ||
242 | : []; |
|
243 | $api_data = json_decode($response->getBody(), TRUE); |
|
244 | ||
245 | if ($api_data === $cached && file_exists($transformed_cache_file)) |
|
246 | { |
|
247 | return json_decode(file_get_contents($transformed_cache_file), TRUE); |
|
248 | } |
|
249 | else |
|
250 | { |
|
251 | file_put_contents($cache_file, json_encode($api_data)); |
|
252 | $transformer = new AnimeListTransformer(); |
|
253 | $transformed = $transformer->transform_collection($api_data); |
|
254 | file_put_contents($transformed_cache_file, json_encode($transformed)); |
|
255 | return $transformed; |
|
256 | } |
|
257 | } |
|
258 | ||
259 | /** |