/** * Rebuild the cache and return true on success, false otherwise * * @param ProviderInterface $dataProvider * @param ContentModel $contentElement * * @return bool */ public function rebuild(ProviderInterface $dataProvider, ContentModel $contentElement) { $factory = new Factory($dataProvider); if (($video = $factory->createVideo($contentElement->vimeo_videoId)) === null) { return false; } if (Config::get('vimeo_allImages') && $dataProvider->getVideoImages($contentElement->vimeo_videoId) === null) { return false; } if ($dataProvider->getVideoImage($contentElement->vimeo_videoId, Config::get('vimeo_imageIndex')) === null) { return false; } return true; }
/** * Rebuild the cache and return true on success, false otherwise * * @param ProviderInterface $dataProvider * @param ContentModel $contentElement * * @return bool */ public function rebuild(ProviderInterface $dataProvider, ContentModel $contentElement) { $factory = new Factory($dataProvider); $album = $factory->createAlbum($contentElement->vimeo_albumId, true, $contentElement->vimeo_sorting, $contentElement->vimeo_sortingDirection); if ($album === null) { return false; } /** @var Video $video */ foreach ($album->getVideos() as $video) { if (Config::get('vimeo_allImages') && $dataProvider->getVideoImages($video->getId()) === null) { return false; } if ($dataProvider->getVideoImage($video->getId(), Config::get('vimeo_imageIndex')) === null) { return false; } } return true; }
/** * Create the album * * @param int $albumId * @param bool $includeVideos * @param string $sorting * @param string $direction * * @return Album|null */ public function createAlbum($albumId, $includeVideos = false, $sorting = null, $direction = null) { if (($data = $this->dataProvider->getAlbum($albumId)) === null) { return null; } $videos = []; if ($includeVideos) { if (($videosData = $this->dataProvider->getAlbumVideos($albumId, $sorting, $direction)) === null) { return null; } foreach ($videosData as $videoData) { if (($video = $this->createVideo($this->dataProvider->extractVideoId($videoData), false)) !== null) { $videos[] = $video; } } } return new Album($albumId, $data, $videos); }