public function setDefaultImage($image)
{
if (false === $image) {
$this->defaultImage = false;
return $this;
}
$default = strtolower(trim($image));
if (!isset($this->validDefaults[$default])) {
if (!filter_var($image, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED)) {
throw new InvalidArgumentException('The default image specified is not a recognized gravatar "default" and is not a valid URL');
} else {
$this->defaultImage = $image;
}
} else {
$this->defaultImage = $default;
}
return $this;
}