<commit_before># epages 6 REST client
This is the REST client to connect to an epages shop. You can use it as a developer for epages app. Register at the [epages developer page](https://developer.epages.com) for a free development account.

## Requirements
To use this package it needs at least **PHP 5.4**.
Download the PHP file archive (.phar) in **build** folder or in [relases area](https://github.com/dpauli/ep6client-php/releases), copy it to your project folder and use it like:
```php
require("libraries/ep6client-0.0.1.phar");
```

## Version information
This are the information which are provided with the epages 6 REST client since now.

| Feature | GET | PUT | POST | DELETE | PATCH | information |
| --- | :---: | :---: | :---: | :---: | :---: | --- |
| locales | **✔** | **-** | **-** | **-** | **?** |
| currencies | **✔** | **-** | **-** | **-** | **?** |
| legal | **✘** | **-** | **-** | **-** | **?** | won't do, it's not needed |
| legal/contact-information | **✔** | **✘** | **-** | **-** | **?** |
| legal/privacy-policy | **✔** | **✘** | **-** | **-** | **?** |
| legal/terms-and-condition | **✔** | **✘** | **-** | **-** | **?** |
| legal/rights-of-withdrawal | **✔** | **✘** | **-** | **-** | **?** |
| legal/shipping-information | **✔** | **✘** | **-** | **-** | **?** |
| products | **✔** | **-** | **-** | **-** | **?** |
| products/export | **✘** | **-** | **-** | **-** | **?** |
| categories | **✘** | **✘** | **-** | **-** | **?** |
| carts | **✘** | **✘** | **✘** | **✘** | **?** |
| search/product-suggest | **✘** | **-** | **-** | **-** | **?** |
| shpping-methods | **✘** | **-** | **-** | **-** | **?** |

## Code examples

For more small examples see the [examples folder](https://github.com/dpauli/ep6client-php/tree/master/examples).

### Example 1

This example get 100 products with a german localization and sort it with **name** attribute:

```php
require_once("libraries/ep6client-0.0.1.phar");

// set connection constants
$HOST		= "www.meinshop.de";
$SHOP		= "DemoShop";
$AUTHTOKEN	= "<PASSWORD>";
$ISSSL		= true;

// connect to shop
$shop = new ep6\Shop($HOST, $SHOP, $AUTHTOKEN, $ISSSL);

// use a product filter to search for products
$productFilter = new ep6\ProductFilter();
$productFilter->setLocale("de_DE");
$productFilter->setCurrency("EUR");
$productFilter->setSort("name");
$productFilter->setResultsPerPage(100);
$products = $productFilter->getProducts();

// print the products
foreach ($products as $product) {

	echo "<h2>" . htmlentities($product->getName("de_DE")) . "</h2>";
	echo "<p>";
	echo "<img style=\"float:left\" src=\"" . $product->getSmallImage()->getOriginURL() . "\"/>";
	echo "<strong>ProductID:</strong> " . $product->getID() . "<br/>";
	echo "<strong>Description:</strong> " . htmlentities($product->getDescription("de_DE")) . "<br/><br/>";
	echo "<strong>This product is ";
	if (!$product->isForSale()) {
		echo "NOT ";
	}
	echo "for sale and is ";
	if ($product->isSpecialOffer()) {
		echo "<u>a</u> ";
	}
	else {
		echo "not a ";
	}
	echo "special offer.</strong>";
	echo "</p><hr style=\"clear:both\"/>";
}
```

### Example 2

This example gets some shop information.

```php
require_once("libraries/ep6client-0.0.1.phar");

// set connection constants
$HOST		= "www.meinshop.de";
$SHOP		= "DemoShop";
$AUTHTOKEN	= "<PASSWORD>";
$ISSSL		= true;

// connect to shop
$shop = new ep6\Shop($HOST, $SHOP, $AUTHTOKEN, $ISSSL);

// prints the default currency and localization
echo ep6\Currencies::getDefault();
echo ep6\Locales::getDefault();

// prints the name of the contact information in default language and in german
$contactInformation = $shop->getContactInformation();
echo $contactInformation->getDefaultName();
echo $contactInformation->getName("de_DE");
```

## Utilities

### Logger
The library comes with a huge Logger. It is called ```ep6\Logger```.
To use this (instead of the ```echo``` command) write
```php
ep6\Logger::force("Print this!");
```
The force printer also can print arrays in a simple structure.

By default all notification messages are print. To change this use:
```php
ep6\Logger::setLogLevel("NOTIFICATION");	// shows all messages
ep6\Logger::setLogLevel("WARNING");			// shows warning and error messages
ep6\Logger::setLogLevel("ERROR");			// shows only error messages
ep6\Logger::setLogLevel("NONE");			// don't log anything
```
### InputValidator

To validate data and check the value of an object there is a InputValidator class:
```php
ep6\InputValidator::isHost("www.test.de");
ep6\InputValidator::isJSON("{}");
```
All InputValidator functions are found in the [doumentation](http://dbawdy.de/ep6client/doc/classes/ep6.InputValidator.html)

## Licence

The code is available under the terms of the MIT License.<commit_msg>Fix typo. #39<commit_after># epages 6 REST client
This is the REST client to connect to an epages shop. You can use it as a developer for epages app. Register at the [epages developer page](https://developer.epages.com) for a free development account.

## Requirements
To use this package it needs at least **PHP 5.4**.
Download the PHP file archive (.phar) in **build** folder or in [releases area](https://github.com/dpauli/ep6client-php/releases), copy it to your project folder and use it like:
```php
require("libraries/ep6client-0.0.1.phar");
```

## Version information
This are the information which are provided with the epages 6 REST client since now.

| Feature | GET | PUT | POST | DELETE | PATCH | information |
| --- | :---: | :---: | :---: | :---: | :---: | --- |
| locales | **✔** | **-** | **-** | **-** | **?** |
| currencies | **✔** | **-** | **-** | **-** | **?** |
| legal | **✘** | **-** | **-** | **-** | **?** | won't do, it's not needed |
| legal/contact-information | **✔** | **✘** | **-** | **-** | **?** |
| legal/privacy-policy | **✔** | **✘** | **-** | **-** | **?** |
| legal/terms-and-condition | **✔** | **✘** | **-** | **-** | **?** |
| legal/rights-of-withdrawal | **✔** | **✘** | **-** | **-** | **?** |
| legal/shipping-information | **✔** | **✘** | **-** | **-** | **?** |
| products | **✔** | **-** | **-** | **-** | **?** |
| products/export | **✘** | **-** | **-** | **-** | **?** |
| categories | **✘** | **✘** | **-** | **-** | **?** |
| carts | **✘** | **✘** | **✘** | **✘** | **?** |
| search/product-suggest | **✘** | **-** | **-** | **-** | **?** |
| shpping-methods | **✘** | **-** | **-** | **-** | **?** |

## Code examples

For more small examples see the [examples folder](https://github.com/dpauli/ep6client-php/tree/master/examples).

### Example 1

This example get 100 products with a german localization and sort it with **name** attribute:

```php
require_once("libraries/ep6client-0.0.1.phar");

// set connection constants
$HOST		= "www.meinshop.de";
$SHOP		= "DemoShop";
$AUTHTOKEN	= "<PASSWORD>";
$ISSSL		= true;

// connect to shop
$shop = new ep6\Shop($HOST, $SHOP, $AUTHTOKEN, $ISSSL);

// use a product filter to search for products
$productFilter = new ep6\ProductFilter();
$productFilter->setLocale("de_DE");
$productFilter->setCurrency("EUR");
$productFilter->setSort("name");
$productFilter->setResultsPerPage(100);
$products = $productFilter->getProducts();

// print the products
foreach ($products as $product) {

	echo "<h2>" . htmlentities($product->getName("de_DE")) . "</h2>";
	echo "<p>";
	echo "<img style=\"float:left\" src=\"" . $product->getSmallImage()->getOriginURL() . "\"/>";
	echo "<strong>ProductID:</strong> " . $product->getID() . "<br/>";
	echo "<strong>Description:</strong> " . htmlentities($product->getDescription("de_DE")) . "<br/><br/>";
	echo "<strong>This product is ";
	if (!$product->isForSale()) {
		echo "NOT ";
	}
	echo "for sale and is ";
	if ($product->isSpecialOffer()) {
		echo "<u>a</u> ";
	}
	else {
		echo "not a ";
	}
	echo "special offer.</strong>";
	echo "</p><hr style=\"clear:both\"/>";
}
```

### Example 2

This example gets some shop information.

```php
require_once("libraries/ep6client-0.0.1.phar");

// set connection constants
$HOST		= "www.meinshop.de";
$SHOP		= "DemoShop";
$AUTHTOKEN	= "<PASSWORD>";
$ISSSL		= true;

// connect to shop
$shop = new ep6\Shop($HOST, $SHOP, $AUTHTOKEN, $ISSSL);

// prints the default currency and localization
echo ep6\Currencies::getDefault();
echo ep6\Locales::getDefault();

// prints the name of the contact information in default language and in german
$contactInformation = $shop->getContactInformation();
echo $contactInformation->getDefaultName();
echo $contactInformation->getName("de_DE");
```

## Utilities

### Logger
The library comes with a huge Logger. It is called ```ep6\Logger```.
To use this (instead of the ```echo``` command) write
```php
ep6\Logger::force("Print this!");
```
The force printer also can print arrays in a simple structure.

By default all notification messages are print. To change this use:
```php
ep6\Logger::setLogLevel("NOTIFICATION");	// shows all messages
ep6\Logger::setLogLevel("WARNING");			// shows warning and error messages
ep6\Logger::setLogLevel("ERROR");			// shows only error messages
ep6\Logger::setLogLevel("NONE");			// don't log anything
```
### InputValidator

To validate data and check the value of an object there is a InputValidator class:
```php
ep6\InputValidator::isHost("www.test.de");
ep6\InputValidator::isJSON("{}");
```
All InputValidator functions are found in the [doumentation](http://dbawdy.de/ep6client/doc/classes/ep6.InputValidator.html)

## Licence

The code is available under the terms of the MIT License.
{'fraction_non_alphanumeric': 0.2350585011067777, 'fraction_numerical': 0.009275851164751766, 'mean_word_length': 4.112068965517241, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 71, 'https://': 6, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6752301', 'n_tokens_mistral': 3371, 'n_tokens_neox': 3265, 'n_words': 847}