1 | <?php |
||
14 | class TmdbSearchService |
||
15 | { |
||
16 | private $apiKey; |
||
17 | private $client; |
||
18 | private $logger; |
||
19 | private const ApiUrl = 'https://api.themoviedb.org/3'; |
||
20 | |||
21 | 9 | public function __construct(LoggerInterface $logger, ClientInterface $client) |
|
27 | |||
28 | /** |
||
29 | * @param string $query |
||
30 | * @param string $locale |
||
31 | * @param array $data |
||
32 | * |
||
33 | * @throws TmdbMovieNotFoundException |
||
34 | * @throws TmdbRequestLimitException |
||
35 | * |
||
36 | * @return array |
||
37 | */ |
||
38 | 1 | public function findMoviesByQuery(string $query, string $locale = 'en', $data = []): array |
|
52 | |||
53 | /** |
||
54 | * @param int $tmdb_id |
||
55 | * @param string $locale |
||
56 | * |
||
57 | * @throws TmdbMovieNotFoundException |
||
58 | * @throws TmdbRequestLimitException |
||
59 | * |
||
60 | * @return array |
||
61 | */ |
||
62 | 1 | public function findMovieById(int $tmdb_id, string $locale = 'en'): array |
|
73 | |||
74 | public function findActorsByMovieId(int $personId, string $locale = 'en'): array |
||
85 | |||
86 | public function findActorById(int $personId, string $locale = 'en'): array |
||
97 | |||
98 | public function findActorTranslationsById(int $personId, string $locale = 'en'): array |
||
109 | |||
110 | /** |
||
111 | * @param int $tmdb_id |
||
112 | * |
||
113 | * @throws TmdbMovieNotFoundException |
||
114 | * @throws TmdbRequestLimitException |
||
115 | * |
||
116 | * @return array |
||
117 | */ |
||
118 | public function findMovieTranslationsById(int $tmdb_id): array |
||
128 | |||
129 | /** |
||
130 | * @param int $tmdb_id |
||
131 | * @param int $page |
||
132 | * |
||
133 | * @throws TmdbMovieNotFoundException |
||
134 | * @throws TmdbRequestLimitException |
||
135 | * |
||
136 | * @return array |
||
137 | */ |
||
138 | public function findSimilarMoviesById(int $tmdb_id, int $page = 1): array |
||
149 | |||
150 | /** |
||
151 | * @param string $url |
||
152 | * @param string $method |
||
153 | * @param array $params |
||
154 | * |
||
155 | * @throws TmdbMovieNotFoundException |
||
156 | * @throws TmdbRequestLimitException |
||
157 | * |
||
158 | * @return array |
||
159 | */ |
||
160 | 2 | private function request(string $url, string $method = 'GET', array $params = []): array |
|
195 | } |
||
196 |