Skip to content

Commit

Permalink
- some cleanup
Browse files Browse the repository at this point in the history
- allowed composer.lock
- added dependency for php >=5.4.0
  • Loading branch information
OmeBlues committed Jan 6, 2016
1 parent eaf9afe commit b21e8e3
Show file tree
Hide file tree
Showing 6 changed files with 274 additions and 35 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
vendor
.idea
examples/test.php
composer.lock
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ BooXtreamClient is available in Packagist, just add it to your composer.json

Alternatively you can just download the package and run ```composer install``` to get the requirements.

The only requirement at the moment is [Guzzle](http://guzzle.readthedocs.org/en/latest/index.html).
The only requirements at the moment are PHP 5.4 and up and [Guzzle](http://guzzle.readthedocs.org/en/latest/index.html).

If you do not wish to use Composer you will need to fulfill the dependencies on your own.

Expand Down
35 changes: 18 additions & 17 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
{
"name": "icontact/booxtreamclient",
"description": "A simple example client for the BooXtream webservice",
"homepage": "https://github.com/BooXtream/php-BooXtreamClient/",
"require": {
"guzzlehttp/guzzle": "^6.1"
},
"license": "MIT",
"authors": [
{
"name": "Kevin de Harde",
"email": "[email protected]"
}
],
"autoload": {
"psr-4": {
"Icontact\\BooXtreamClient\\": "src/"
}
"name": "icontact/booxtreamclient",
"description": "A simple example client for the BooXtream webservice",
"homepage": "https://github.com/BooXtream/php-BooXtreamClient/",
"require": {
"php": ">=5.4.0",
"guzzlehttp/guzzle": "^6.1"
},
"license": "MIT",
"authors": [
{
"name": "Kevin de Harde",
"email": "[email protected]"
}
],
"autoload": {
"psr-4": {
"Icontact\\BooXtreamClient\\": "src/"
}
}
}
241 changes: 241 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion license.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2014, Icontact B.V.
Copyright (c) 2016, Icontact B.V.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
28 changes: 13 additions & 15 deletions src/BooXtreamClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
class BooXtreamClient implements BooXtreamClientInterface {
const BASE_URL = 'https://service.booxtream.com';

/*
* PHP 5.6 would allow us to define this array as a class constant, maybe later.
*/
private $types = ['xml', 'epub', 'mobi'];

private $Guzzle;
private $authentication;
private $type;
Expand All @@ -24,26 +29,19 @@ class BooXtreamClient implements BooXtreamClientInterface {
* @param array $authentication
* @param ClientInterface $Guzzle
*/
public function __construct( $type, Options $Options, array $authentication, ClientInterface $Guzzle ) {
switch ( $type ) {
case 'xml':
case 'epub':
case 'mobi':
$this->type = $type;
break;
default:
throw new \InvalidArgumentException( 'invalid type ' . $type );
public function __construct( $type, Options $Options, array $authentication, ClientInterface $Guzzle ) {
if(!in_array($type, $this->types)) {
throw new \InvalidArgumentException( 'invalid type ' . $type );
}

$this->Guzzle = $Guzzle;

$this->Options = $Options;
$this->type = $type;
$this->Guzzle = $Guzzle;
$this->Options = $Options;
$this->Options->parseOptions( $this->type === 'xml' );

$this->authentication = $authentication;

$this->files = [ ];
$this->storedfiles = [ ];
$this->files = [ ];
$this->storedfiles = [ ];
}

/**
Expand Down

0 comments on commit b21e8e3

Please sign in to comment.