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

Image::getPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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