Failed Conditions
Push — master ( 61e25c...ea0df0 )
by Adrien
05:58
created

UserInfos::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 13
ccs 9
cts 9
cp 1
rs 10
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Application\View\Helper;
6
7
use Application\Model\User;
8
use Laminas\View\Helper\AbstractHelper;
9
10
class UserInfos extends AbstractHelper
11
{
12 5
    public function __invoke(User $user): string
13
    {
14 5
        $url = $this->view->serverUrl . '/admin/user/' . $user->getId();
15
16 5
        $result = '<ul>';
17 5
        $result .= '<li>' . $this->view->escapeHtml($user->getName()) . '</li>';
0 ignored issues
show
Bug introduced by
The method escapeHtml() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

17
        $result .= '<li>' . $this->view->/** @scrutinizer ignore-call */ escapeHtml($user->getName()) . '</li>';

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
18 5
        if ($user->getEmail()) {
19 5
            $result .= '<li><a href="mailto:' . $user->getEmail() . '">' . $this->view->escapeHtml($user->getEmail()) . '</a></li>';
20
        }
21 5
        $result .= '<li><a href="' . $url . '">' . $this->view->escapeHtml($url) . '</a></li>';
22 5
        $result .= '</ul>';
23
24 5
        return $result;
25
    }
26
}
27