Gravatar::init()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
nc 1
nop 0
dl 0
loc 3
c 0
b 0
f 0
cc 1
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Pamo\Gravatar;
4
5
/**
6
 * Gravatar
7
 * @SuppressWarnings(PHPMD.ShortVariable)
8
 */
9
class Gravatar
10
{
11
    /**
12
     * @var string $url for the Gravatar.
13
     */
14
    private $url;
15
16
17
18
    /**
19
     * Gravatar from email.
20
     *
21
     */
22 36
    public function init()
23
    {
24 36
        $this->url = 'https://www.gravatar.com/avatar/';
25 36
    }
26
27
28
29
    /**
30
     * Get user gravatar
31
     *
32
     * @return array
33
     */
34 28
    public function get($email)
35
    {
36 28
        $url = $this->url;
37
38 28
        $s = 80;
39 28
        $d = 'mp';
40 28
        $r = 'g';
41
        // $image = false;
42
        // $atts = array();
43
44 28
        $url .= md5(strtolower(trim($email)));
45 28
        $url .= "?s=$s&d=$d&r=$r";
46 28
        return $url;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $url returns the type string which is incompatible with the documented return type array.
Loading history...
47
    }
48
}
49