28 lines
531 B
PHP
28 lines
531 B
PHP
<?php
|
|
|
|
namespace App\Classes;
|
|
|
|
class MovieFetcher extends PageFetcher
|
|
{
|
|
public function fetch(string $url): ?array
|
|
{
|
|
$cacheKey = 'movie_'.md5($url);
|
|
$cached = $this->cacheGet($cacheKey);
|
|
|
|
if ($cached) {
|
|
return $cached;
|
|
}
|
|
|
|
$movie = $this->fetchSingleFromApi('optimized_movies', $url);
|
|
|
|
if (! $movie) {
|
|
return null;
|
|
}
|
|
|
|
$movie['globals'] = $this->getGlobals();
|
|
|
|
$this->cacheSet($cacheKey, $movie);
|
|
|
|
return $movie;
|
|
}
|
|
}
|