/** * Create a new post from a given submission * * @param Submission $submission * * @return Post */ private function createPostFromSubmission(Submission $submission) { $title = $submission->getTitle(); $author = $submission->getAuthor(); $now = $this->clock->now(); $baseUrl = $submission->getBaseUrl(); $video = $this->resolver->resolve($submission->getBaseUrl()); $key = $video->getKey(); $webm = $video->getWebmUrl(); $mp4 = $video->getMp4Url(); $width = $video->getWidth(); $height = $video->getHeight(); $post = new Post($title, $key, $now, $baseUrl, $webm, $mp4, $width, $height, $author); return $post; }
/** * Create a new post from the form model * * @param AddModel $model * * @return Post */ public function create(AddModel $model) { $title = $model->title; $author = $model->author; $now = $this->clock->now(); $baseUrl = $this->transformUrl($model->url); $video = $this->resolver->resolve($model->url); $key = $video->getKey(); $webm = $video->getWebmUrl(); $mp4 = $video->getMp4Url(); $width = $video->getWidth(); $height = $video->getHeight(); $post = new Post($title, $key, $now, $baseUrl, $webm, $mp4, $width, $height, $author); return $post; }