feat: shows popular movies
This commit is contained in:
@@ -94,12 +94,18 @@ class Tmdb
|
||||
$this->tvRepository = new TvRepository($this->client);
|
||||
}
|
||||
|
||||
public function popularMovies(int $page = 1)
|
||||
public function popularMovies(int $page = 1, ?int $limit = null)
|
||||
{
|
||||
$movies = $this->movieRepository->getPopular(['page' => $page]);
|
||||
|
||||
foreach ($movies as $movie) {
|
||||
$this->parseResult($movie);
|
||||
$movies = $movies->map(function ($movie) use ($movies) {
|
||||
return $this->parseResult($movies[$movie], "movie");
|
||||
});
|
||||
|
||||
$movies = array_values($movies->toArray());
|
||||
|
||||
if (null !== $limit) {
|
||||
$movies = array_slice($movies, 0, $limit);
|
||||
}
|
||||
|
||||
return $movies;
|
||||
|
||||
Reference in New Issue
Block a user