tboothman / imdbphp

PHP library for retrieving film and tv information from IMDb
253 stars 84 forks source link

Fix #111 - TitleSearch::search will stop searching after limit reached #169

Closed PoLaKoSz closed 5 years ago

PoLaKoSz commented 5 years ago

Inside the TitleSearch class the search method $maxResults parameter had no effect (#111).

public function search($searchTerms, $wantedTypes = null, $maxResults = null)

There is already an (open) PR (#162) but that is not efficient, because it will still loop through all search results and than just remove every unnecessary result to give back the desired number results.

This fix will stop the scraping after the results count reach the $maxResults value. The default behaviour is to not limit the results count so this PR does not introduce breaking change.