public function generateUrl($type, $email, array $attr = [])
    {
        if (!empty($email)) {
            $this->setEmail($email);
        }

        if (isset($attr['size'])) {
            $this->setSize($attr['size']);
        }

        if (isset($attr['imgset'])) {
            $this->setImageSet($attr['imgset']);
        }

        if (isset($attr['rating'])) {
            $this->setRating($attr['rating']);
        }

        $uri = '?';
        $ignore = ['email', 'hash', 'secure'];
        foreach ($this->_options as $k => $v) {
            if (!in_array($k, $ignore)) {
                $uri .= $k.'='.$v.'&';
            }
        }
        $uri = rtrim($uri, '&');

        $base = (($this->_options['secure']) ? self::BASE_HTTPS : self::BASE_HTTP);

        switch (strtolower($type)) {
        case 'avatar':
            $url = $base.'avatar/';
            break;
        case 'profile':
            $url = $base;
            break;
        default:
            throw new \Exception('Invalid URL type given! Must be avatar or profile!');
        }

        return $url.$this->getHash();
    }
public function generateUrl($type, $email, array $attr = [])
    {
        if (!empty($email)) {
            $this->setEmail($email);
        }

        if (isset($attr['size'])) {
            $this->setSize($attr['size']);
        }

        if (isset($attr['imgset'])) {
            $this->setImageSet($attr['imgset']);
        }

        if (isset($attr['rating'])) {
            $this->setRating($attr['rating']);
        }

        $uri = '?';
        $ignore = ['email', 'hash', 'secure'];
        foreach ($this->_options as $k => $v) {
            if (!in_array($k, $ignore)) {
                $uri .= $k.'='.$v.'&';
            }
        }
        $uri = rtrim($uri, '&');

        $base = (($this->_options['secure']) ? self::BASE_HTTPS : self::BASE_HTTP);

        switch (strtolower($type)) {
        case 'avatar':
            $url = $base.'avatar/';
            break;
        case 'profile':
            $url = $base;
            break;
        default:
            throw new \Exception('Invalid URL type given! Must be avatar or profile!');
        }

        return $url.$this->getHash();
    }
public function generateUrl ( $ type , $ email , array $ attr = [ ] ) { if ( ! empty ( $ email ) ) { $ this -> setEmail ( $ email ) ; } if ( isset ( $ attr [ 'size' ] ) ) { $ this -> setSize ( $ attr [ 'size' ] ) ; } if ( isset ( $ attr [ 'imgset' ] ) ) { $ this -> setImageSet ( $ attr [ 'imgset' ] ) ; } if ( isset ( $ attr [ 'rating' ] ) ) { $ this -> setRating ( $ attr [ 'rating' ] ) ; } $ uri = '?' ; $ ignore = [ 'email' , 'hash' , 'secure' ] ; foreach ( $ this -> _options as $ k => $ v ) { if ( ! in_array ( $ k , $ ignore ) ) { $ uri .= $ k . '=' . $ v . '&' ; } } $ uri = rtrim ( $ uri , '&' ) ; $ base = ( ( $ this -> _options [ 'secure' ] ) ? self :: BASE_HTTPS : self :: BASE_HTTP ) ; switch ( strtolower ( $ type ) ) { case 'avatar' : $ url = $ base . 'avatar/' ; break ; case 'profile' : $ url = $ base ; break ; default : throw new \ Exception ( 'Invalid URL type given! Must be avatar or profile!' ) ; } return $ url . $ this -> getHash ( ) ; }
Generates the Gravatar URL.

@param string $type  - [avatar|profile] Get the requested user item
@param string $email - The user's email
@param array  $attr  - Extra attributes to set for the image request

@throws \Exception

@return string
Generates the Gravatar URL .