Gravatar::url()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 5
nc 1
nop 2
1
<?php
2
3
namespace Vibe\Gravatar;
4
5
/**
6
 * Gravatar class to get gravatar from user emails.
7
 */
8
class Gravatar
9
{
10
    /**
11
    * get url
12
    * @param string $email - email to be used for gravatar
13
    * @param int $size - optional size of image
14
    * @return string $url - gravatar url
15
    */
16
    public function url($email, $size = 80)
17
    {
18
        $url = 'https://www.gravatar.com/avatar/';
19
        $url .= md5(strtolower(trim($email)));
20
        $url .= "?s=$size";
21
        return $url;
22
    }
23
}
24