private static function _getEmbeddedServiceName(tubepress_api_video_VideoGalleryPage $page)
 {
     $context = tubepress_impl_patterns_sl_ServiceLocator::getExecutionContext();
     $stored = $context->get(tubepress_api_const_options_names_Embedded::PLAYER_IMPL);
     $videoArray = $page->getVideos();
     /**
      * @var $randomVideo tubepress_api_video_Video
      */
     $randomVideo = $videoArray[array_rand($videoArray)];
     $provider = $randomVideo->getAttribute(tubepress_api_video_Video::ATTRIBUTE_PROVIDER_NAME);
     $longTailWithYouTube = $stored === 'longtail' && $provider === 'youtube';
     $embedPlusWithYouTube = $stored === 'embedplus' && $provider === 'youtube';
     if ($longTailWithYouTube || $embedPlusWithYouTube) {
         return $stored;
     }
     return $provider;
 }
 /**
  * Fetch a video gallery page.
  *
  * @param int $currentPage The requested page number of the gallery.
  *
  * @return tubepress_api_video_VideoGalleryPage The video gallery page for this page. May be empty, never null.
  */
 public final function fetchVideoGalleryPage($currentPage)
 {
     $this->_cacheLogger();
     $result = new tubepress_api_video_VideoGalleryPage();
     $debugEnabled = $this->_logger->isHandling(ehough_epilog_Logger::DEBUG);
     if ($debugEnabled) {
         $this->_logger->debug(sprintf('Current page number is %d', $currentPage));
     }
     $url = $this->buildGalleryUrl($currentPage);
     if ($debugEnabled) {
         $this->_logger->debug(sprintf('URL to fetch is <code>%s</code>', $url));
     }
     $rawFeed = $this->_fetchFeedAndPrepareForAnalysis($url);
     $reportedTotalResultCount = $this->getTotalResultCount($rawFeed);
     /**
      * If no results, we can shortcut things here.
      */
     if ($reportedTotalResultCount < 1) {
         $result->setTotalResultCount(0);
         $result->setVideos(array());
         return $result;
     }
     if ($debugEnabled) {
         $this->_logger->debug(sprintf('Reported total result count is %d video(s)', $reportedTotalResultCount));
     }
     /* convert the feed to videos */
     $videoArray = $this->_feedToVideoArray($rawFeed);
     if (count($videoArray) == 0) {
         $result->setTotalResultCount(0);
         $result->setVideos(array());
         return $result;
     }
     $result->setTotalResultCount($reportedTotalResultCount);
     $result->setVideos($videoArray);
     return $result;
 }