1 | <?php |
||
12 | class TmdbSearchService |
||
13 | { |
||
14 | private $apiKey; |
||
15 | private $client; |
||
16 | private $logger; |
||
17 | private const ApiUrl = 'https://api.themoviedb.org/3'; |
||
18 | |||
19 | 7 | public function __construct(LoggerInterface $logger, ClientInterface $client) |
|
25 | |||
26 | /** |
||
27 | * @param string $query |
||
28 | * @param string $locale |
||
29 | * @param array $data |
||
30 | * @return array |
||
31 | * @throws TmdbMovieNotFoundException |
||
32 | * @throws TmdbRequestLimitException |
||
33 | */ |
||
34 | 1 | public function findMoviesByQuery(string $query, string $locale = 'en', $data = []): array |
|
48 | |||
49 | /** |
||
50 | * @param int $tmdb_id |
||
51 | * @param string $locale |
||
52 | * @return array |
||
53 | * @throws TmdbMovieNotFoundException |
||
54 | * @throws TmdbRequestLimitException |
||
55 | */ |
||
56 | 1 | public function findMovieById(int $tmdb_id, string $locale = 'en'): array |
|
67 | |||
68 | /** |
||
69 | * @param int $tmdb_id |
||
70 | * @return array |
||
71 | * @throws TmdbMovieNotFoundException |
||
72 | * @throws TmdbRequestLimitException |
||
73 | */ |
||
74 | public function findMovieTranslationsById(int $tmdb_id): array |
||
84 | |||
85 | 2 | private function request(string $url, string $method = 'GET', array $params = []): array |
|
120 | } |