public function search($searchTerms, $wantedTypes = null, $maxResults = null)
{
$results = array();
$page = $this->getPage($searchTerms);
// Parse & filter results
if (preg_match_all('!class="result_text"\\s*>\\s*<a href="/title/tt(?<imdbid>\\d{7})/[^>]*>(?<title>.*?)</a>\\s*(\\([^\\d]+\\)\\s*)?(\\((?<year>\\d{4})(.*?|)\\)|)(?<type>[^<]*)!ims', $page, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$type = $this->parseTitleType($match['type']);
if (is_array($wantedTypes) && !in_array($type, $wantedTypes)) {
continue;
}
$results[] = Title::fromSearchResult($match['imdbid'], $match['title'], $match['year'], $type, $this->config, $this->logger, $this->cache);
}
}
return $results;
}