Comm::getGravatar()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 8
cts 8
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 1
crap 1
1
<?php
2
namespace Anax\Comments;
3
4
use \Anax\Database\ActiveRecordModel;
5
6
/**
7
 * A database driven model.
8
 */
9
class Comm extends ActiveRecordModel
10
{
11
    /**
12
     * @var string $tableName name of the database table.
13
     */
14
    protected $tableName = "Comm";
15
16
17
    /**
18
     * Columns in the table.
19
     *
20
     * @var integer $id primary key auto incremented.
21
     */
22
    public $id;
23
    public $userid;
24
    public $email;
25
    public $title;
26
    public $comment;
27
    public $parentid;
28
    public $created;
29
    public $updated;
30
31
32 2
    public function getGravatar($email)
33
    {
34 2
        $size = 20;
35 2
        $dim = 'mm';
36 2
        $rad = 'g';
37 2
        $url = 'https://www.gravatar.com/avatar/';
38 2
        $url .= md5(strtolower(trim($email)));
39 2
        $url .= "?s=$size&d=$dim&r=$rad";
40 2
        return $url;
41
    }
42
}
43