Passed
Push — master ( 191f59...1ee7f2 )
by Aleksandr
01:40
created

Image   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 33.33%

Importance

Changes 0
Metric Value
wmc 3
eloc 5
dl 0
loc 21
ccs 2
cts 6
cp 0.3333
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getCaption() 0 7 2
A getPath() 0 3 1
1
<?php
2
3
4
namespace Zenwalker\CommerceML\Model;
5
6
7
class Image extends Simple
8
{
9
10
    /**
11
     * @return string
12
     */
13 1
    public function getPath()
14
    {
15 1
        return (string)$this->xml;
16
    }
17
18
    /**
19
     * @return 1|array|null
0 ignored issues
show
Documentation Bug introduced by
The doc comment 1|array|null at position 0 could not be parsed: Unknown type name '1' at position 0 in 1|array|null.
Loading history...
20
     */
21
    public function getCaption()
22
    {
23
        if ($xml = $this->xpath("//c:ЗначениеРеквизита[contains(c:Значение, '{$this->path}#')]")) {
0 ignored issues
show
Bug Best Practice introduced by
The property path does not exist on Zenwalker\CommerceML\Model\Image. Since you implemented __get, consider adding a @property annotation.
Loading history...
24
            return \array_slice(explode('#', (string)$xml[0]->Значение), 1);
25
        }
26
27
        return null;
28
    }
29
}