type == self::TYPE_HTML5){ $this->mediaRenderer = new MediaHtml5($this); } if ($this->type == self::TYPE_LOCALVIDEO){ $this->mediaRenderer = new MediaLocalVideo($this); } if ($this->type == self::TYPE_IMAGE){ $this->mediaRenderer = new MediaImage($this); } if ($this->type == self::TYPE_PDF){ $this->mediaRenderer = new MediaPdf($this); } if ($this->type == self::TYPE_YOUTUBE){ $this->mediaRenderer = new MediaYoutube($this); } } else{ throw new MediaException("Invalid media type for Media; mediatype '".$mediaType."'"); } } private function asText(){ return $this->mediaRenderer->asText(); } public function renderMedia(){ $this->mediaRenderer->render(); } public function getType(){ return $this->type; } public function getTitle(){ return $this->details; } public static function getCollectionName(){ return "media"; } public function setOwner(HasMediaInterface $model){ $this->owner = $model->getReference(); } public function getOwnerReference(){ return $this->owner; } public function getReference(){ return $this->id; } } ?>