private function processSearchResponse(WikiaSearchResultSet $response, $svStart, $svSize, $trimTitle = false, $excludedVideos = array()) { $data = array(); $nextStartFrom = $svStart; foreach ($response as $result) { /* @var $result WikiaSearchResult */ $singleVideoData = array(); $singleVideoData['pageid'] = $result->getVar("pageId"); $singleVideoData['wid'] = $result->getCityId(); $singleVideoData['title'] = $result->getTitle(); if (isset($excludedVideos[$singleVideoData['title']])) { // don't suggest this video continue; } WikiaFileHelper::inflateArrayWithVideoData($singleVideoData, Title::newFromText($singleVideoData['title'], NS_FILE), $this->request->getVal('videoWidth', self::VIDEO_THUMB_DEFAULT_WIDTH), $this->request->getVal('videoHeight', self::VIDEO_THUMB_DEFAULT_HEIGHT), true); if ($trimTitle > 0) { $singleVideoData['title'] = mb_substr($singleVideoData['title'], 0, $trimTitle); } if (!empty($singleVideoData['thumbnail']) && count($data) < $svSize) { $data[] = $singleVideoData; } $nextStartFrom++; if (count($data) == $svSize) { break; } } return array('totalItemCount' => $response->getResultsFound(), 'nextStartFrom' => $nextStartFrom, 'items' => $data); }