/** * AbstractVideoAdapter constructor. * * @param string $url * @param string $pattern * @param EmbedRendererInterface $renderer */ public function __construct($url, $pattern, EmbedRendererInterface $renderer) { $match = array(); preg_match($pattern, $url, $match); $this->setVideoId($match[1]); return parent::__construct($url, $pattern, $renderer); }
/** * @param string $url * @param string $pattern * @param EmbedRendererInterface $renderer */ public function __construct($url, $pattern, EmbedRendererInterface $renderer) { $videoId = $this->getVideoIdByPattern($url, $pattern); $this->setVideoId($videoId); $videoData = $this->getVideoDataFromServiceApi(); $this->setThumbnails(array(self::THUMBNAIL_SMALL => $videoData[self::THUMBNAIL_SMALL], self::THUMBNAIL_MEDIUM => $videoData[self::THUMBNAIL_MEDIUM], self::THUMBNAIL_LARGE => $videoData[self::THUMBNAIL_LARGE])); $this->setTitle($videoData['title']); $this->setDescription($videoData['description']); return parent::__construct($url, $pattern, $renderer); }
/** * @param string $url * @param string $pattern * @param EmbedRendererInterface $renderer */ public function __construct($url, $pattern, EmbedRendererInterface $renderer) { preg_match($pattern, $url, $match); if (isset($match[2])) { $videoId = $match[2]; } if (empty($videoId)) { $videoId = $match[1]; } $this->setVideoId($videoId); return parent::__construct($url, $pattern, $renderer); }
/** * AbstractVideoAdapter constructor. * * @param string $url * @param string $pattern * @param EmbedRendererInterface $renderer */ public function __construct($url, $pattern, EmbedRendererInterface $renderer) { $videoId = strtok(basename($url), '_'); $this->setVideoId($videoId); return parent::__construct($url, $pattern, $renderer); }