transformation = $transformation; $this->publicId = $publicId; $this->type = $type; } /** * @return array */ protected function createTabs() { return [ $this->createCodeTab(), new TransformationTab( $this->transformation, $this->code, $this->publicId ) ]; } /** * @return string */ protected function getExample() { $publicId = $this->publicId; $transformation = $this->transformation; if (StringUtils::endsWith($publicId, '.mp4')) { return $this->createVideoTag(Video::upload($publicId), $transformation); } return $this->createImageTag(Image::upload($publicId), $transformation); } /** * @param Image $image * @param $transformation * @return string */ private function createImageTag($image, $transformation) { $url = $image->toUrl($transformation); $tag = (new ImageTag($image, null, $transformation)); return $this->getExampleHtml($url, $tag); } /** * @param Video $video * @param $transformation * @return string */ private function createVideoTag($video, $transformation) { $url = $video->toUrl($transformation); $tag = (new VideoTag($video->setTransformation($transformation)))->setAttribute('controls'); return $this->getExampleHtml($url, $tag); } }