Passed
Push — master ( 1cde7b...7c9c8d )
by Aleksandr
08:27
created

Image   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
eloc 5
c 2
b 0
f 0
dl 0
loc 21
ccs 6
cts 6
cp 1
rs 10
1
<?php
2
3
4
namespace Zenwalker\CommerceML\Model;
5
6
/**
7
 * Class Image
8
 *
9
 * @package Zenwalker\CommerceML\Model
10
 * @property string path
11
 * @property string caption
12
 */
13
class Image extends Simple
14
{
15
16
    /**
17
     * @return string
18
     */
19 1
    public function getPath()
20
    {
21 1
        return trim((string)$this->xml);
22
    }
23
24
    /**
25
     * @return string
26
     */
27 1
    public function getCaption()
28
    {
29 1
        if ($xml = $this->xpath('//c:ЗначениеРеквизита[contains(c:Значение, :path)]', ['path' => "{$this->path}#"])) {
30 1
            return (string)current(\array_slice(explode('#', (string)$xml[0]->Значение), 1));
0 ignored issues
show
Bug introduced by
A parse error occurred: Syntax error, unexpected T_LNUMBER, expecting T_STRING or T_VARIABLE or '{' or '$' on line 30 at column 78
Loading history...
31
        }
32
33 1
        return '';
34
    }
35
}