Пример #1
0
 /**
  * Create the video element
  *
  * @param int  $videoId
  * @param bool $includeAlbum
  *
  * @return Video|null
  */
 public function createVideo($videoId, $includeAlbum = true)
 {
     if (($videoData = $this->dataProvider->getVideo($videoId)) === null) {
         return null;
     }
     $video = new Video($videoId, $videoData);
     if ($includeAlbum) {
         if (($albumData = $this->dataProvider->getAlbumByVideo($videoId)) === null) {
             return null;
         }
         // Get the album data if video has an album
         if (count($albumData) > 0) {
             if (($album = $this->createAlbum($this->dataProvider->extractAlbumId($albumData))) === null) {
                 return null;
             }
             $video->setAlbum($album);
         }
     }
     return $video;
 }