Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:findologic/libflexport
Browse files Browse the repository at this point in the history
  • Loading branch information
howard committed Feb 19, 2020
2 parents f36b533 + 395d0ea commit 087e062
Show file tree
Hide file tree
Showing 26 changed files with 499 additions and 303 deletions.
12 changes: 12 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
* text=auto

/.github export-ignore
/examples export-ignore
/tests export-ignore
.codeclimate.yml export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.travis.yml export-ignore
CONTRIBUTING.md export-ignore
phpcs.xml.dist export-ignore
phpunit.xml.dist export-ignore
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ php:
- 7.1
- 7.2
- 7.3
- 7.4snapshot
- 7.4

install:
- composer install
Expand All @@ -13,4 +13,4 @@ script:
- composer lint

after_success:
- bash <(curl -s https://codecov.io/bash)
- bash <(curl -s https://codecov.io/bash)
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,16 @@ $exporter = Exporter::create(Exporter::TYPE_XML);

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

$item->addName('Test');
$item->addUrl('http://example.org/test.html');
$item->addPrice(13.37);
// Alternative long form:
// $name = new Name();
// $name->setValue('Test');
// $item->setName($name);
// $url = new Url();
// $url->setValue('http://example.org/test.html');
// $item->setUrl($url);
// $price = new Price();
// $price->setValue(13.37);
// $item->setPrice($price);
Expand All @@ -91,7 +99,15 @@ $exporter = Exporter::create(Exporter::TYPE_CSV);
$item = $exporter->createItem('123');

$item->addPrice(13.37);
$item->addName('Test');
$item->addUrl('http://example.org/test.html');
// Alternative long form:
// $name = new Name();
// $name->setValue('Test');
// $item->setName($name);
// $url = new Url();
// $url->setValue('http://example.org/test.html');
// $item->setUrl($url);
// $price = new Price();
// $price->setValue(13.37);
// $item->setPrice($price);
Expand Down Expand Up @@ -126,4 +142,4 @@ releases.

## Contributors

See [contribution guide](CONTRIBUTING.md).
See [contribution guide](CONTRIBUTING.md).
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
"php": "^7.1",
"ext-dom": "*",
"ext-mbstring": "*",
"findologic/xml-export-schema": "^1.3"
"findologic/xml-export-schema": "^1.4"
},
"require-dev": {
"phpunit/phpunit": ">7.5",
"squizlabs/php_codesniffer": "^3.4"
"phpunit/phpunit": "^7.5",
"squizlabs/php_codesniffer": "^3.5"
},
"scripts": {
"lint": "phpcs",
"fix": "phpcbf",
"test": "phpunit -c phpunit.xml.dist"
"test": "phpunit"
},
"license": "MIT",
"authors": [
Expand All @@ -27,7 +27,7 @@
{
"name": "Markus Machatschek",
"email": "[email protected]",
"role": "maintainer"
"role": "developer"
},
{
"name": "Dominik Brader",
Expand Down
87 changes: 87 additions & 0 deletions examples/ExampleBaseItem.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?php

class ExampleBaseItem
{
const DEFAULT_USER_GROUP = '';
const SPECIFIC_USER_GROUP = 'LNrLF7BRVJ0toQ==';

/**
* @var int
*/
public $id;

/**
* @var array[]
*/
public $orderNumbers;

/**
* @var string[]
*/
public $names;

/**
* @var string[]
*/
public $summaries;

/**
* @var string[]
*/
public $descriptions;

/**
* @var int[]
*/
public $prices;

/**
* @var string[]
*/
public $urls ;

/**
* @var array[]
*/
public $keywords;

/**
* @var int[]
*/
public $bonuses;

/**
* @var int[]
*/
public $salesFrequencies;

/**
* @var string[]
*/
public $dateAddeds;

/**
* @var int[]
*/
public $sorts;

/**
* @var string[]
*/
public $userGroups;

/**
* @var array[]
*/
public $images;

/**
* @var array[]
*/
public $attributes;

/**
* @var array[]
*/
public $properties;
}
49 changes: 25 additions & 24 deletions examples/ItemContent.php → examples/ExampleContentItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,82 +2,83 @@

use FINDOLOGIC\Export\Data\Image;

class ItemContent
/*
* This class represents an example content.
* As this is just a static class, an own logic must be implemented
*/
class ExampleContentItem extends ExampleBaseItem
{
const defaultUserGroup = '';
const specificUserGroup = 'LNrLF7BRVJ0toQ==';

public $id = 'content_ypy44hn5rpk8nggba8vxmpx68d8v7ra';

public $orderNumbers = [
self::defaultUserGroup => [
self::DEFAULT_USER_GROUP => [
'pdf304xyz',
'9424585418519'
],
self::specificUserGroup => [
self::SPECIFIC_USER_GROUP => [
'pdf305xyz'
]
];

public $names = [
self::defaultUserGroup => 'Aliquam eget vehicula.'
self::DEFAULT_USER_GROUP => 'Aliquam eget vehicula.'
];

public $summaries = [
self::defaultUserGroup => 'Nullam blandit in ipsum ac feugiat. Vivamus varius, velit nec.'
self::DEFAULT_USER_GROUP => 'Nullam blandit in ipsum ac feugiat. Vivamus varius, velit nec.'
];

public $descriptions = [
self::defaultUserGroup =>
self::DEFAULT_USER_GROUP =>
'In tempus eleifend orci, eu suscipit dolor pellentesque ac. Morbi.'
];

public $prices = [
self::defaultUserGroup => 0
self::DEFAULT_USER_GROUP => 0
];

public $urls = [
self::defaultUserGroup => 'https://www.store.com/documents/pdf304xyz.pdf',
self::specificUserGroup => 'https://www.store.com/documents/pdf305xyz.pdf',
self::DEFAULT_USER_GROUP => 'https://www.store.com/documents/pdf304xyz.pdf',
self::SPECIFIC_USER_GROUP => 'https://www.store.com/documents/pdf305xyz.pdf',
];

public $keywords = [
self::defaultUserGroup => [
self::DEFAULT_USER_GROUP => [
'pdf304xyz',
'9424585418519'
],
self::specificUserGroup => [
self::SPECIFIC_USER_GROUP => [
'pdf305xyz'
]
];

public $bonuses = [
self::defaultUserGroup => 7
self::DEFAULT_USER_GROUP => 7
];

public $salesFrequencies = [
self::defaultUserGroup => 23
self::DEFAULT_USER_GROUP => 23
];

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

public $sorts = [
self::defaultUserGroup => 1
self::DEFAULT_USER_GROUP => 1
];

public $userGroups = [
self::specificUserGroup,
self::SPECIFIC_USER_GROUP,
'cHBw'
];

public $images = [
self::defaultUserGroup => [
self::DEFAULT_USER_GROUP => [
'https://www.store.com/images/pdf304xyz.png' => Image::TYPE_DEFAULT,
'https://www.store.com/images/thumbnails/pdf304xyz.png' => Image::TYPE_THUMBNAIL
],
self::specificUserGroup => [
self::SPECIFIC_USER_GROUP => [
'https://www.store.com/images/pdf305xyz.png' => Image::TYPE_DEFAULT,
'https://www.store.com/images/thumbnails/pdf305xyz.png' => Image::TYPE_THUMBNAIL
]
Expand All @@ -91,10 +92,10 @@ class ItemContent

public $properties = [
'file_type' => [
self::defaultUserGroup => 'pdf',
self::DEFAULT_USER_GROUP => 'pdf',
],
'number_of_comments' => [
self::defaultUserGroup => 9,
self::DEFAULT_USER_GROUP => 9,
]
];
}
}
Loading

0 comments on commit 087e062

Please sign in to comment.