Phalcon\Avatar\Gravatar::setDefaultImage PHP Method

setDefaultImage() public method

Possible $image formats: - a string specifying a recognized gravatar "default" - a string containing a valid image URL - boolean false for the gravatar default
public setDefaultImage ( mixed $image ) : Gravatar
$image mixed The default image to use
return Gravatar
    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;
    }