Skip to content

Commit 087e062

Browse files
committed
Merge branch 'develop' of github.com:findologic/libflexport
2 parents f36b533 + 395d0ea commit 087e062

26 files changed

Lines changed: 499 additions & 303 deletions

.gitattributes

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
* text=auto
2+
3+
/.github export-ignore
4+
/examples export-ignore
5+
/tests export-ignore
6+
.codeclimate.yml export-ignore
7+
.gitattributes export-ignore
8+
.gitignore export-ignore
9+
.travis.yml export-ignore
10+
CONTRIBUTING.md export-ignore
11+
phpcs.xml.dist export-ignore
12+
phpunit.xml.dist export-ignore

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ php:
44
- 7.1
55
- 7.2
66
- 7.3
7-
- 7.4snapshot
7+
- 7.4
88

99
install:
1010
- composer install
@@ -13,4 +13,4 @@ script:
1313
- composer lint
1414

1515
after_success:
16-
- bash <(curl -s https://codecov.io/bash)
16+
- bash <(curl -s https://codecov.io/bash)

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,16 @@ $exporter = Exporter::create(Exporter::TYPE_XML);
7070

7171
$item = $exporter->createItem('123');
7272

73+
$item->addName('Test');
74+
$item->addUrl('http://example.org/test.html');
7375
$item->addPrice(13.37);
7476
// Alternative long form:
77+
// $name = new Name();
78+
// $name->setValue('Test');
79+
// $item->setName($name);
80+
// $url = new Url();
81+
// $url->setValue('http://example.org/test.html');
82+
// $item->setUrl($url);
7583
// $price = new Price();
7684
// $price->setValue(13.37);
7785
// $item->setPrice($price);
@@ -91,7 +99,15 @@ $exporter = Exporter::create(Exporter::TYPE_CSV);
9199
$item = $exporter->createItem('123');
92100

93101
$item->addPrice(13.37);
102+
$item->addName('Test');
103+
$item->addUrl('http://example.org/test.html');
94104
// Alternative long form:
105+
// $name = new Name();
106+
// $name->setValue('Test');
107+
// $item->setName($name);
108+
// $url = new Url();
109+
// $url->setValue('http://example.org/test.html');
110+
// $item->setUrl($url);
95111
// $price = new Price();
96112
// $price->setValue(13.37);
97113
// $item->setPrice($price);
@@ -126,4 +142,4 @@ releases.
126142

127143
## Contributors
128144

129-
See [contribution guide](CONTRIBUTING.md).
145+
See [contribution guide](CONTRIBUTING.md).

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
"php": "^7.1",
77
"ext-dom": "*",
88
"ext-mbstring": "*",
9-
"findologic/xml-export-schema": "^1.3"
9+
"findologic/xml-export-schema": "^1.4"
1010
},
1111
"require-dev": {
12-
"phpunit/phpunit": ">7.5",
13-
"squizlabs/php_codesniffer": "^3.4"
12+
"phpunit/phpunit": "^7.5",
13+
"squizlabs/php_codesniffer": "^3.5"
1414
},
1515
"scripts": {
1616
"lint": "phpcs",
1717
"fix": "phpcbf",
18-
"test": "phpunit -c phpunit.xml.dist"
18+
"test": "phpunit"
1919
},
2020
"license": "MIT",
2121
"authors": [
@@ -27,7 +27,7 @@
2727
{
2828
"name": "Markus Machatschek",
2929
"email": "mmachatschek@yahoo.com",
30-
"role": "maintainer"
30+
"role": "developer"
3131
},
3232
{
3333
"name": "Dominik Brader",

examples/ExampleBaseItem.php

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<?php
2+
3+
class ExampleBaseItem
4+
{
5+
const DEFAULT_USER_GROUP = '';
6+
const SPECIFIC_USER_GROUP = 'LNrLF7BRVJ0toQ==';
7+
8+
/**
9+
* @var int
10+
*/
11+
public $id;
12+
13+
/**
14+
* @var array[]
15+
*/
16+
public $orderNumbers;
17+
18+
/**
19+
* @var string[]
20+
*/
21+
public $names;
22+
23+
/**
24+
* @var string[]
25+
*/
26+
public $summaries;
27+
28+
/**
29+
* @var string[]
30+
*/
31+
public $descriptions;
32+
33+
/**
34+
* @var int[]
35+
*/
36+
public $prices;
37+
38+
/**
39+
* @var string[]
40+
*/
41+
public $urls ;
42+
43+
/**
44+
* @var array[]
45+
*/
46+
public $keywords;
47+
48+
/**
49+
* @var int[]
50+
*/
51+
public $bonuses;
52+
53+
/**
54+
* @var int[]
55+
*/
56+
public $salesFrequencies;
57+
58+
/**
59+
* @var string[]
60+
*/
61+
public $dateAddeds;
62+
63+
/**
64+
* @var int[]
65+
*/
66+
public $sorts;
67+
68+
/**
69+
* @var string[]
70+
*/
71+
public $userGroups;
72+
73+
/**
74+
* @var array[]
75+
*/
76+
public $images;
77+
78+
/**
79+
* @var array[]
80+
*/
81+
public $attributes;
82+
83+
/**
84+
* @var array[]
85+
*/
86+
public $properties;
87+
}
Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,82 +2,83 @@
22

33
use FINDOLOGIC\Export\Data\Image;
44

5-
class ItemContent
5+
/*
6+
* This class represents an example content.
7+
* As this is just a static class, an own logic must be implemented
8+
*/
9+
class ExampleContentItem extends ExampleBaseItem
610
{
7-
const defaultUserGroup = '';
8-
const specificUserGroup = 'LNrLF7BRVJ0toQ==';
9-
1011
public $id = 'content_ypy44hn5rpk8nggba8vxmpx68d8v7ra';
1112

1213
public $orderNumbers = [
13-
self::defaultUserGroup => [
14+
self::DEFAULT_USER_GROUP => [
1415
'pdf304xyz',
1516
'9424585418519'
1617
],
17-
self::specificUserGroup => [
18+
self::SPECIFIC_USER_GROUP => [
1819
'pdf305xyz'
1920
]
2021
];
2122

2223
public $names = [
23-
self::defaultUserGroup => 'Aliquam eget vehicula.'
24+
self::DEFAULT_USER_GROUP => 'Aliquam eget vehicula.'
2425
];
2526

2627
public $summaries = [
27-
self::defaultUserGroup => 'Nullam blandit in ipsum ac feugiat. Vivamus varius, velit nec.'
28+
self::DEFAULT_USER_GROUP => 'Nullam blandit in ipsum ac feugiat. Vivamus varius, velit nec.'
2829
];
2930

3031
public $descriptions = [
31-
self::defaultUserGroup =>
32+
self::DEFAULT_USER_GROUP =>
3233
'In tempus eleifend orci, eu suscipit dolor pellentesque ac. Morbi.'
3334
];
3435

3536
public $prices = [
36-
self::defaultUserGroup => 0
37+
self::DEFAULT_USER_GROUP => 0
3738
];
3839

3940
public $urls = [
40-
self::defaultUserGroup => 'https://www.store.com/documents/pdf304xyz.pdf',
41-
self::specificUserGroup => 'https://www.store.com/documents/pdf305xyz.pdf',
41+
self::DEFAULT_USER_GROUP => 'https://www.store.com/documents/pdf304xyz.pdf',
42+
self::SPECIFIC_USER_GROUP => 'https://www.store.com/documents/pdf305xyz.pdf',
4243
];
4344

4445
public $keywords = [
45-
self::defaultUserGroup => [
46+
self::DEFAULT_USER_GROUP => [
4647
'pdf304xyz',
4748
'9424585418519'
4849
],
49-
self::specificUserGroup => [
50+
self::SPECIFIC_USER_GROUP => [
5051
'pdf305xyz'
5152
]
5253
];
5354

5455
public $bonuses = [
55-
self::defaultUserGroup => 7
56+
self::DEFAULT_USER_GROUP => 7
5657
];
5758

5859
public $salesFrequencies = [
59-
self::defaultUserGroup => 23
60+
self::DEFAULT_USER_GROUP => 23
6061
];
6162

6263
public $dateAddeds = [
63-
self::defaultUserGroup => '2019-10-31T10:20:28+02:00'
64+
self::DEFAULT_USER_GROUP => '2019-10-31T10:20:28+02:00'
6465
];
6566

6667
public $sorts = [
67-
self::defaultUserGroup => 1
68+
self::DEFAULT_USER_GROUP => 1
6869
];
6970

7071
public $userGroups = [
71-
self::specificUserGroup,
72+
self::SPECIFIC_USER_GROUP,
7273
'cHBw'
7374
];
7475

7576
public $images = [
76-
self::defaultUserGroup => [
77+
self::DEFAULT_USER_GROUP => [
7778
'https://www.store.com/images/pdf304xyz.png' => Image::TYPE_DEFAULT,
7879
'https://www.store.com/images/thumbnails/pdf304xyz.png' => Image::TYPE_THUMBNAIL
7980
],
80-
self::specificUserGroup => [
81+
self::SPECIFIC_USER_GROUP => [
8182
'https://www.store.com/images/pdf305xyz.png' => Image::TYPE_DEFAULT,
8283
'https://www.store.com/images/thumbnails/pdf305xyz.png' => Image::TYPE_THUMBNAIL
8384
]
@@ -91,10 +92,10 @@ class ItemContent
9192

9293
public $properties = [
9394
'file_type' => [
94-
self::defaultUserGroup => 'pdf',
95+
self::DEFAULT_USER_GROUP => 'pdf',
9596
],
9697
'number_of_comments' => [
97-
self::defaultUserGroup => 9,
98+
self::DEFAULT_USER_GROUP => 9,
9899
]
99100
];
100-
}
101+
}

0 commit comments

Comments
 (0)