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

Image::init()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 8
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0
cc 3
nc 2
nop 0
crap 12
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
}