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
![]() |
|||
31 | } |
||
32 | |||
33 | 1 | return ''; |
|
34 | } |
||
35 | } |