Completed
Push — master ( cdee41...f70a2b )
by Gunvor
01:59
created

Comm   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 60%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 41
ccs 9
cts 15
cp 0.6
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getGravatar() 0 17 3
1
<?php
2
3
namespace Anax\Comments;
4
5
use \Anax\Database\ActiveRecordModel;
6
7
/**
8
 * A database driven model.
9
 */
10
class Comm extends ActiveRecordModel
11
{
12
    /**
13
     * @var string $tableName name of the database table.
14
     */
15
    protected $tableName = "Comm";
16
17
18
    /**
19
     * Columns in the table.
20
     *
21
     * @var integer $id primary key auto incremented.
22
     */
23
    public $id;
24
    public $userid;
25
    public $email;
26
    public $title;
27
    public $comment;
28
    public $parentid;
29
    public $created;
30
    public $updated;
31
32
33 1
    public function getGravatar($email, $img = false, $atts = array())
34
    {
35 1
        $size = 20;
36 1
        $dim = 'mm';
37 1
        $rad = 'g';
38 1
        $url = 'https://www.gravatar.com/avatar/';
39 1
        $url .= md5(strtolower(trim($email)));
40 1
        $url .= "?s=$size&d=$dim&r=$rad";
41 1
        if ($img) {
42
            $url = '<img src="' . $url . '"';
43
            foreach ($atts as $key => $val) {
44
                $url .= ' ' . $key . '="' . $val . '"';
45
            }
46
            $url .= ' />';
47
        }
48 1
        return $url;
49
    }
50
}
51