Gravatar::gravatar()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 5
c 0
b 0
f 0
dl 0
loc 9
rs 10
ccs 5
cts 5
cp 1
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace mQueue\View\Helper;
4
5
use mQueue\Model\User;
6
use Zend_View_Helper_HtmlElement;
7
8
class Gravatar extends Zend_View_Helper_HtmlElement
9
{
10
    /**
11
     * Return a span with CSS class for a user on gravatar
12
     *
13
     * @param User $user
14
     * @param string $size small|medium|big
15
     *
16
     * @return string
17
     */
18 1
    public function gravatar(User $user, $size = 'small'): string
19
    {
20
        $attribs = [
21 1
            'class' => 'gravatar user_' . $user->id . ' ' . $size,
0 ignored issues
show
Bug Best Practice introduced by
The property id does not exist on mQueue\Model\User. Since you implemented __get, consider adding a @property annotation.
Loading history...
22 1
            'title' => $user->nickname,
0 ignored issues
show
Bug Best Practice introduced by
The property nickname does not exist on mQueue\Model\User. Since you implemented __get, consider adding a @property annotation.
Loading history...
23
        ];
24 1
        $result = '<span' . $this->_htmlAttribs($attribs) . '"></span>';
25
26 1
        return $result;
27
    }
28
}
29