/** * @param $id * @return Video */ public static function findVideoById($id) { $videoData = Request::getVideoById($id); $params = ['description' => $videoData->description, 'title' => $videoData->title, 'isHidden' => $videoData->is_hidden, 'categoryId' => $videoData->category->id, 'Rutuber' => $videoData]; $video = new Video(); $video->setAttributes($params); unset($videoData); return $video; }
/** * @param Video $video * @return bool|mixed * @throws AccountAuthorizedError */ public function uploadVideo(Video $video) { $result = false; if (!$this->isAuthorized()) { throw new AccountAuthorizedError('Account not authorized at Rutuber'); } if ($video->validate()) { $result = Request::uploadVideo($video->getAttrubutes(), $this->getToken(), $this->getSecure()); $video->setRutuber($result)->setUploaded(); } return $result; }