/** * @param string $link * * @return $this * * @throws SitemapException */ public function setLink($link) { if (false === ValidatorTrait::validateLoc($link)) { throw new SitemapException('Value for setLink is not a valid URL'); } $this->link = "<link>{$link}</link>"; return $this; }
/** * @param string $url * * @throws SitemapException */ protected function validateLoc($url) { if (false === ValidatorTrait::validateLoc($url)) { throw new SitemapException(\sprintf('Provided url is not valid.')); } }