OrderBillingAddress::__invoke()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 12
ccs 10
cts 10
cp 1
rs 9.9666
c 0
b 0
f 0
cc 2
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Application\View\Helper;
6
7
use Application\Model\Order;
8
use Laminas\View\Helper\AbstractHelper;
9
10
class OrderBillingAddress extends AbstractHelper
11
{
12 5
    public function __invoke(?Order $order): string
13
    {
14 5
        $result = '<ul>';
15 5
        $result .= '<li>' . $this->view->escapeHtml($order->getFirstName()) . '</li>';
0 ignored issues
show
Bug introduced by
The method getFirstName() 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

15
        $result .= '<li>' . $this->view->escapeHtml($order->/** @scrutinizer ignore-call */ getFirstName()) . '</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...
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

15
        $result .= '<li>' . $this->view->/** @scrutinizer ignore-call */ escapeHtml($order->getFirstName()) . '</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...
16 5
        $result .= '<li>' . $this->view->escapeHtml($order->getLastName()) . '</li>';
17 5
        $result .= '<li>' . $this->view->escapeHtml($order->getStreet()) . '</li>';
18 5
        $result .= '<li>' . $this->view->escapeHtml($order->getPostcode()) . '</li>';
19 5
        $result .= '<li>' . $this->view->escapeHtml($order->getLocality()) . '</li>';
20 5
        $result .= '<li>' . $this->view->escapeHtml($order->getCountry() ? $order->getCountry()->getName() : '') . '</li>';
21 5
        $result .= '</ul>';
22
23 5
        return $result;
24
    }
25
}
26