|
1
|
|
|
<?php namespace Zenwalker\CommerceML; |
|
2
|
|
|
|
|
3
|
|
|
use Zenwalker\CommerceML\Model\Catalog; |
|
|
|
|
|
|
4
|
|
|
use Zenwalker\CommerceML\Model\Classifier; |
|
|
|
|
|
|
5
|
|
|
use Zenwalker\CommerceML\Model\OfferPackage; |
|
|
|
|
|
|
6
|
|
|
use Zenwalker\CommerceML\Model\Order; |
|
|
|
|
|
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* Class CommerceML |
|
10
|
|
|
* |
|
11
|
|
|
* @package Zenwalker\CommerceML |
|
12
|
|
|
*/ |
|
13
|
|
|
class CommerceML |
|
14
|
|
|
{ |
|
15
|
|
|
public $classCatalog; |
|
16
|
|
|
public $classClassifier; |
|
17
|
|
|
public $classOfferPackage; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @var \SimpleXMLElement|false |
|
21
|
|
|
*/ |
|
22
|
|
|
public $importXml; |
|
23
|
|
|
/** |
|
24
|
|
|
* @var \SimpleXMLElement|false |
|
25
|
|
|
*/ |
|
26
|
|
|
public $offersXml; |
|
27
|
|
|
/** |
|
28
|
|
|
* @var \SimpleXMLElement|false |
|
29
|
|
|
*/ |
|
30
|
|
|
public $ordersXml; |
|
31
|
|
|
/** |
|
32
|
|
|
* @var Catalog |
|
33
|
|
|
*/ |
|
34
|
|
|
public $catalog; |
|
35
|
|
|
/** |
|
36
|
|
|
* @var Classifier |
|
37
|
|
|
*/ |
|
38
|
|
|
public $classifier; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @var OfferPackage |
|
42
|
|
|
*/ |
|
43
|
|
|
public $offerPackage; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @var Order |
|
47
|
|
|
*/ |
|
48
|
|
|
public $order; |
|
49
|
|
|
|
|
50
|
|
|
public $importXmlFilePath; |
|
51
|
|
|
|
|
52
|
|
|
public $offersXmlFilePath; |
|
53
|
|
|
|
|
54
|
|
|
public $ordersXmlFilePath; |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* Add XML files. |
|
58
|
|
|
* |
|
59
|
|
|
* @param string|bool $importXml |
|
60
|
|
|
* @param string|bool $offersXml |
|
61
|
|
|
* @param bool $ordersXml |
|
62
|
|
|
*/ |
|
63
|
27 |
|
public function addXmls($importXml = false, $offersXml = false, $ordersXml = false) |
|
64
|
|
|
{ |
|
65
|
27 |
|
$this->loadImportXml($importXml); |
|
66
|
27 |
|
$this->loadOffersXml($offersXml); |
|
67
|
27 |
|
$this->loadOrdersXml($ordersXml); |
|
68
|
27 |
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* @param $file |
|
72
|
|
|
*/ |
|
73
|
31 |
|
public function loadImportXml($file) |
|
74
|
|
|
{ |
|
75
|
31 |
|
$this->importXmlFilePath = $file; |
|
76
|
31 |
|
$this->importXml = $this->loadXml($file); |
|
77
|
31 |
|
$this->catalog = new Catalog($this); |
|
78
|
31 |
|
$this->classifier = new Classifier($this); |
|
79
|
31 |
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* @param $file |
|
83
|
|
|
*/ |
|
84
|
27 |
|
public function loadOffersXml($file) |
|
85
|
|
|
{ |
|
86
|
27 |
|
$this->offersXmlFilePath = $file; |
|
87
|
27 |
|
$this->offersXml = $this->loadXml($file); |
|
88
|
27 |
|
$this->offerPackage = new OfferPackage($this); |
|
89
|
27 |
|
$this->classifier = new Classifier($this); |
|
90
|
27 |
|
} |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* @param $file |
|
94
|
|
|
*/ |
|
95
|
29 |
|
public function loadOrdersXml($file) |
|
96
|
|
|
{ |
|
97
|
29 |
|
$this->ordersXmlFilePath = $file; |
|
98
|
29 |
|
$this->ordersXml = $this->loadXml($file); |
|
99
|
29 |
|
$this->order = new Order($this); |
|
100
|
29 |
|
} |
|
101
|
|
|
|
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* Load XML form file or string. |
|
105
|
|
|
* |
|
106
|
|
|
* @param string $xml |
|
107
|
|
|
* |
|
108
|
|
|
* @return \SimpleXMLElement|false |
|
109
|
|
|
*/ |
|
110
|
33 |
|
private function loadXml($xml) |
|
111
|
|
|
{ |
|
112
|
33 |
|
if (is_file($xml)) { |
|
113
|
29 |
|
return simplexml_load_string(file_get_contents($xml)); |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
4 |
|
return simplexml_load_string($xml); |
|
117
|
|
|
} |
|
118
|
|
|
} |
|
119
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths