/** * @param Url $urlDecorated * @param string $publicationName * @param string $publicationLanguage * @param \DateTime $publicationDate * @param string $title * * @throws Exception\GoogleNewsUrlException */ public function __construct(Url $urlDecorated, $publicationName, $publicationLanguage, \DateTime $publicationDate, $title) { parent::__construct($urlDecorated); $this->publicationName = $publicationName; if (strlen($publicationLanguage) > 5) { throw new Exception\GoogleNewsUrlException('Use a 2 oder 3 character long ISO 639 language code. Except for chinese use zh-cn or zh-tw. See https://support.google.com/webmasters/answer/74288?hl=en&ref_topic=10078'); } $this->publicationLanguage = $publicationLanguage; $this->publicationDate = $publicationDate; $this->title = $title; }
/** * Decorate url with a video * * @param Url $urlDecorated * @param type $thumnail_loc * @param type $title * @param type $description * @param array $parameters - the keys to use are the optional properties of this class, (e.g. 'player_loc' => 'http://acme.com/player.swf') * @throws Exception\GoogleVideoUrlException */ public function __construct(Url $urlDecorated, $thumnail_loc, $title, $description, array $parameters = array()) { foreach ($parameters as $key => $param) { $method = Utils::getSetMethod($this, $key); $this->{$method}($param); } $this->setThumbnailLoc($thumnail_loc); $this->setTitle($title); $this->setDescription($description); if (!$this->content_loc && !$this->player_loc) { throw new Exception\GoogleVideoUrlException('The parameter content_loc or player_loc is required'); } if (count($this->platforms) && !$this->platform_relationship) { throw new Exception\GoogleVideoUrlException('The parameter platform_relationship is required when platform is set'); } parent::__construct($urlDecorated); }