1 | <?php |
||
2 | /** |
||
3 | * Example file for shopping feed |
||
4 | */ |
||
5 | |||
6 | /** |
||
7 | * Composer autoload (only if you do not use it anywhere else) |
||
8 | * |
||
9 | * It is needed for namespace mapping |
||
10 | */ |
||
11 | require_once (dirname(__FILE__) . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'); |
||
12 | |||
13 | /** |
||
14 | * Simple initialize XML Writer and auto open the file |
||
15 | */ |
||
16 | $xmlWriter = new \PurePhpXmlWriter\PurePhpXmlWriter('feed.xml'); |
||
0 ignored issues
–
show
|
|||
17 | |||
18 | /** |
||
19 | * Open root element "items" (true = expecting children elements) |
||
20 | */ |
||
21 | $xmlWriter->openXMLElement('products', true); |
||
22 | |||
23 | /** |
||
24 | * Save simple product |
||
25 | */ |
||
26 | $xmlWriter->openXMLElement('product', true); // Open the parent element |
||
27 | |||
28 | $xmlWriter->saveElementWithValue('name', 'Breakfast white mug'); // Name |
||
29 | $xmlWriter->saveElementWithValue('description', 'Nice white mug used for breakfast'); // Description |
||
30 | $xmlWriter->saveElementWithValue('price', 5.00, 2); // Price with 2 decimals |
||
31 | $xmlWriter->saveElementWithValue('category', 'Mugs|Breakfast'); // Category |
||
32 | $xmlWriter->saveElementWithValue('quantity', 20); // Quantity available |
||
33 | |||
34 | $xmlWriter->closeXMLElement('product'); // Close the parent element |
||
35 | /** |
||
36 | * /Save simple product |
||
37 | */ |
||
38 | |||
39 | /** |
||
40 | * Save variable product where variants have individual prices |
||
41 | */ |
||
42 | $xmlWriter->openXMLElement('product', true); // Open the parent element |
||
43 | |||
44 | $xmlWriter->saveElementWithValue('name', 'Puma T-shirt'); // Name |
||
45 | $xmlWriter->saveElementWithValue('description', 'Puma t-shirt with some sizes'); // Description |
||
46 | $xmlWriter->saveElementWithValue('price', 10.00, 2); // Price with 2 decimals |
||
47 | $xmlWriter->saveElementWithValue('category', 'T-shirts|Nike'); // Category |
||
48 | $xmlWriter->saveElementWithValue('quantity', 10); // Quantity available |
||
49 | |||
50 | $xmlWriter->openXMLElement('sizes', true); // Open the parent element for sizes |
||
51 | |||
52 | // Small size |
||
53 | $xmlWriter->openXMLElement('size', true); // Open the parent element for size |
||
54 | $xmlWriter->saveElementWithValue('size_name', 'S'); // Size name |
||
55 | $xmlWriter->saveElementWithValue('size_price', 10.00); // Size price with 2 decimals |
||
56 | $xmlWriter->closeXMLElement('size', true); // Open the parent element for size |
||
57 | |||
58 | // Medium size |
||
59 | $xmlWriter->openXMLElement('size', true); // Open the parent element for size |
||
60 | $xmlWriter->saveElementWithValue('size_name', 'M'); // Size name |
||
61 | $xmlWriter->saveElementWithValue('size_price', 11.00); // Size price with 2 decimals |
||
62 | $xmlWriter->closeXMLElement('size', true); // Open the parent element for size |
||
63 | |||
64 | // Large |
||
65 | $xmlWriter->openXMLElement('size', true); // Open the parent element for size |
||
66 | $xmlWriter->saveElementWithValue('size_name', 'L'); // Size name |
||
67 | $xmlWriter->saveElementWithValue('size_price', 13.00); // Size price with 2 decimals |
||
68 | $xmlWriter->closeXMLElement('size', true); // Open the parent element for size |
||
69 | |||
70 | $xmlWriter->closeXMLElement('sizes', true); // Close the parent element for sizes |
||
71 | |||
72 | $xmlWriter->closeXMLElement('product'); // Close the parent element |
||
73 | /** |
||
74 | * /Save variable product |
||
75 | */ |
||
76 | |||
77 | /** |
||
78 | * Close root element "items" |
||
79 | */ |
||
80 | $xmlWriter->closeXMLElement('products'); |
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