/**
  * Get list of videos (controller that provides access to MediaQueryService::getVideoList method)
  * @requestParam string sort [recent/popular/trend]
  * @requestParam integer limit (maximum = 100)
  * @requestParam integer page
  * @requestParam string|array providers - Only videos hosted by these providers will be returned. Default: all providers.
  * @requestParam string|array category - Only videos tagged with these categories will be returned. Default: any categories.
  * @requestParam integer width - the width of the thumbnail to return
  * @requestParam integer height - the height of the thumbnail to return
  * @requestParam integer detail [0/1] - check for getting video detail
  * @responseParam array
  *   [array('title'=>value, 'provider'=>value, 'addedAt'=>value,'addedBy'=>value, 'duration'=>value, 'viewsTotal'=>value)]
  */
 public function getVideoList()
 {
     wfProfileIn(__METHOD__);
     $params = $this->getVideoListParams();
     // Key to cache the data under in memcache
     $cacheKey = $this->getVideoListCacheKey($params);
     $cacheOptions = ['cacheTTL' => \WikiaResponse::CACHE_STANDARD, 'negativeCacheTTL' => 0];
     // Retrieve the result and if not null, cache it
     $videoList = \WikiaDataAccess::cacheWithOptions($cacheKey, function () use($params) {
         $mediaService = new \MediaQueryService();
         $videoList = $mediaService->getVideoList($params['sort'], $params['filter'], $params['limit'], $params['page'], $params['providers'], $params['category']);
         // get video detail
         if (!empty($params['detail'])) {
             $videoOptions = ['thumbWidth' => $params['width'], 'thumbHeight' => $params['height']];
             $helper = new \VideoHandlerHelper();
             foreach ($videoList as &$videoInfo) {
                 $videoDetail = $helper->getVideoDetail($videoInfo, $videoOptions);
                 if (!empty($videoDetail)) {
                     $videoInfo = array_merge($videoInfo, $videoDetail);
                 }
             }
             unset($videoInfo);
         }
         return $videoList;
     }, $cacheOptions);
     $this->response->setVal('videos', $videoList);
     $this->response->setCacheValidity(\WikiaResponse::CACHE_STANDARD);
     wfProfileOut(__METHOD__);
 }