public function setImage($url, $title = null, $link = null)
{
if (!is_string($url) || empty($url)) {
throw new \InvalidArgumentException('url parameter must be a string and may not be empty or NULL.');
}
// RSS feeds have support for a title & link element.
if ($this->version != Feed::ATOM) {
if (!is_string($title) || empty($title)) {
throw new \InvalidArgumentException('title parameter must be a string and may not be empty or NULL.');
}
if (!is_string($link) || empty($link)) {
throw new \InvalidArgumentException('link parameter must be a string and may not be empty or NULL.');
}
$data = array('title' => $title, 'link' => $link, 'url' => $url);
$name = 'image';
} else {
$name = 'logo';
$data = $url;
}
// Special handling for RSS1 again (since RSS1 is a bit strange...)
if ($this->version == Feed::RSS1) {
$this->data['Image'] = $data;
return $this->setChannelElement($name, '', array('rdf:resource' => $url), false);
} else {
return $this->setChannelElement($name, $data);
}
}