diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..97e039a
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,21 @@
+{
+ "name": "psc/calc",
+ "type": "library",
+ "description": "Calc Lib",
+ "autoload": {
+ "psr-4": {
+ "PSC\\Library\\Calc\\": "src/"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "PSC\\Library\\Calc\\Tests\\": "tests/"
+ }
+ },
+ "require": {
+ "php": ">=5.4"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.7"
+ }
+}
\ No newline at end of file
diff --git a/composer.lock b/composer.lock
new file mode 100644
index 0000000..0c4ca7c
--- /dev/null
+++ b/composer.lock
@@ -0,0 +1,971 @@
+{
+ "_readme": [
+ "This file locks the dependencies of your project to a known state",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
+ "This file is @generated automatically"
+ ],
+ "hash": "b9da4001e3942b87f110cd4dfebcb541",
+ "packages": [],
+ "packages-dev": [
+ {
+ "name": "doctrine/instantiator",
+ "version": "1.0.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/instantiator.git",
+ "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
+ "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3,<8.0-DEV"
+ },
+ "require-dev": {
+ "athletic/athletic": "~0.1.8",
+ "ext-pdo": "*",
+ "ext-phar": "*",
+ "phpunit/phpunit": "~4.0",
+ "squizlabs/php_codesniffer": "~2.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Marco Pivetta",
+ "email": "ocramius@gmail.com",
+ "homepage": "http://ocramius.github.com/"
+ }
+ ],
+ "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
+ "homepage": "https://github.com/doctrine/instantiator",
+ "keywords": [
+ "constructor",
+ "instantiate"
+ ],
+ "time": "2015-06-14 21:17:01"
+ },
+ {
+ "name": "phpdocumentor/reflection-docblock",
+ "version": "2.0.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
+ "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8",
+ "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0"
+ },
+ "suggest": {
+ "dflydev/markdown": "~1.0",
+ "erusev/parsedown": "~1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "phpDocumentor": [
+ "src/"
+ ]
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Mike van Riel",
+ "email": "mike.vanriel@naenius.com"
+ }
+ ],
+ "time": "2015-02-03 12:10:50"
+ },
+ {
+ "name": "phpspec/prophecy",
+ "version": "v1.5.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpspec/prophecy.git",
+ "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7",
+ "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/instantiator": "^1.0.2",
+ "phpdocumentor/reflection-docblock": "~2.0",
+ "sebastian/comparator": "~1.1"
+ },
+ "require-dev": {
+ "phpspec/phpspec": "~2.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.4.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Prophecy\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Konstantin Kudryashov",
+ "email": "ever.zet@gmail.com",
+ "homepage": "http://everzet.com"
+ },
+ {
+ "name": "Marcello Duarte",
+ "email": "marcello.duarte@gmail.com"
+ }
+ ],
+ "description": "Highly opinionated mocking framework for PHP 5.3+",
+ "homepage": "https://github.com/phpspec/prophecy",
+ "keywords": [
+ "Double",
+ "Dummy",
+ "fake",
+ "mock",
+ "spy",
+ "stub"
+ ],
+ "time": "2015-08-13 10:07:40"
+ },
+ {
+ "name": "phpunit/php-code-coverage",
+ "version": "2.2.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
+ "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979",
+ "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "phpunit/php-file-iterator": "~1.3",
+ "phpunit/php-text-template": "~1.2",
+ "phpunit/php-token-stream": "~1.3",
+ "sebastian/environment": "^1.3.2",
+ "sebastian/version": "~1.0"
+ },
+ "require-dev": {
+ "ext-xdebug": ">=2.1.4",
+ "phpunit/phpunit": "~4"
+ },
+ "suggest": {
+ "ext-dom": "*",
+ "ext-xdebug": ">=2.2.1",
+ "ext-xmlwriter": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.2.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sb@sebastian-bergmann.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
+ "homepage": "https://github.com/sebastianbergmann/php-code-coverage",
+ "keywords": [
+ "coverage",
+ "testing",
+ "xunit"
+ ],
+ "time": "2015-10-06 15:47:00"
+ },
+ {
+ "name": "phpunit/php-file-iterator",
+ "version": "1.4.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-file-iterator.git",
+ "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0",
+ "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.4.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sb@sebastian-bergmann.de",
+ "role": "lead"
+ }
+ ],
+ "description": "FilterIterator implementation that filters files based on a list of suffixes.",
+ "homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
+ "keywords": [
+ "filesystem",
+ "iterator"
+ ],
+ "time": "2015-06-21 13:08:43"
+ },
+ {
+ "name": "phpunit/php-text-template",
+ "version": "1.2.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-text-template.git",
+ "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
+ "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Simple template engine.",
+ "homepage": "https://github.com/sebastianbergmann/php-text-template/",
+ "keywords": [
+ "template"
+ ],
+ "time": "2015-06-21 13:50:34"
+ },
+ {
+ "name": "phpunit/php-timer",
+ "version": "1.0.7",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-timer.git",
+ "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b",
+ "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sb@sebastian-bergmann.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Utility class for timing",
+ "homepage": "https://github.com/sebastianbergmann/php-timer/",
+ "keywords": [
+ "timer"
+ ],
+ "time": "2015-06-21 08:01:12"
+ },
+ {
+ "name": "phpunit/php-token-stream",
+ "version": "1.4.8",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-token-stream.git",
+ "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
+ "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
+ "shasum": ""
+ },
+ "require": {
+ "ext-tokenizer": "*",
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.2"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.4-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Wrapper around PHP's tokenizer extension.",
+ "homepage": "https://github.com/sebastianbergmann/php-token-stream/",
+ "keywords": [
+ "tokenizer"
+ ],
+ "time": "2015-09-15 10:49:45"
+ },
+ {
+ "name": "phpunit/phpunit",
+ "version": "4.8.21",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/phpunit.git",
+ "reference": "ea76b17bced0500a28098626b84eda12dbcf119c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ea76b17bced0500a28098626b84eda12dbcf119c",
+ "reference": "ea76b17bced0500a28098626b84eda12dbcf119c",
+ "shasum": ""
+ },
+ "require": {
+ "ext-dom": "*",
+ "ext-json": "*",
+ "ext-pcre": "*",
+ "ext-reflection": "*",
+ "ext-spl": "*",
+ "php": ">=5.3.3",
+ "phpspec/prophecy": "^1.3.1",
+ "phpunit/php-code-coverage": "~2.1",
+ "phpunit/php-file-iterator": "~1.4",
+ "phpunit/php-text-template": "~1.2",
+ "phpunit/php-timer": ">=1.0.6",
+ "phpunit/phpunit-mock-objects": "~2.3",
+ "sebastian/comparator": "~1.1",
+ "sebastian/diff": "~1.2",
+ "sebastian/environment": "~1.3",
+ "sebastian/exporter": "~1.2",
+ "sebastian/global-state": "~1.0",
+ "sebastian/version": "~1.0",
+ "symfony/yaml": "~2.1|~3.0"
+ },
+ "suggest": {
+ "phpunit/php-invoker": "~1.1"
+ },
+ "bin": [
+ "phpunit"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "4.8.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "The PHP Unit Testing framework.",
+ "homepage": "https://phpunit.de/",
+ "keywords": [
+ "phpunit",
+ "testing",
+ "xunit"
+ ],
+ "time": "2015-12-12 07:45:58"
+ },
+ {
+ "name": "phpunit/phpunit-mock-objects",
+ "version": "2.3.8",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
+ "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983",
+ "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/instantiator": "^1.0.2",
+ "php": ">=5.3.3",
+ "phpunit/php-text-template": "~1.2",
+ "sebastian/exporter": "~1.2"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "suggest": {
+ "ext-soap": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.3.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sb@sebastian-bergmann.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Mock Object library for PHPUnit",
+ "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
+ "keywords": [
+ "mock",
+ "xunit"
+ ],
+ "time": "2015-10-02 06:51:40"
+ },
+ {
+ "name": "sebastian/comparator",
+ "version": "1.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/comparator.git",
+ "reference": "937efb279bd37a375bcadf584dec0726f84dbf22"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22",
+ "reference": "937efb279bd37a375bcadf584dec0726f84dbf22",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "sebastian/diff": "~1.2",
+ "sebastian/exporter": "~1.2"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.2.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Volker Dusch",
+ "email": "github@wallbash.com"
+ },
+ {
+ "name": "Bernhard Schussek",
+ "email": "bschussek@2bepublished.at"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Provides the functionality to compare PHP values for equality",
+ "homepage": "http://www.github.com/sebastianbergmann/comparator",
+ "keywords": [
+ "comparator",
+ "compare",
+ "equality"
+ ],
+ "time": "2015-07-26 15:48:44"
+ },
+ {
+ "name": "sebastian/diff",
+ "version": "1.4.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/diff.git",
+ "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e",
+ "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.8"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.4-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Kore Nordmann",
+ "email": "mail@kore-nordmann.de"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Diff implementation",
+ "homepage": "https://github.com/sebastianbergmann/diff",
+ "keywords": [
+ "diff"
+ ],
+ "time": "2015-12-08 07:14:41"
+ },
+ {
+ "name": "sebastian/environment",
+ "version": "1.3.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/environment.git",
+ "reference": "6e7133793a8e5a5714a551a8324337374be209df"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6e7133793a8e5a5714a551a8324337374be209df",
+ "reference": "6e7133793a8e5a5714a551a8324337374be209df",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.3.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Provides functionality to handle HHVM/PHP environments",
+ "homepage": "http://www.github.com/sebastianbergmann/environment",
+ "keywords": [
+ "Xdebug",
+ "environment",
+ "hhvm"
+ ],
+ "time": "2015-12-02 08:37:27"
+ },
+ {
+ "name": "sebastian/exporter",
+ "version": "1.2.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/exporter.git",
+ "reference": "7ae5513327cb536431847bcc0c10edba2701064e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e",
+ "reference": "7ae5513327cb536431847bcc0c10edba2701064e",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "sebastian/recursion-context": "~1.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.2.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Volker Dusch",
+ "email": "github@wallbash.com"
+ },
+ {
+ "name": "Bernhard Schussek",
+ "email": "bschussek@2bepublished.at"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ },
+ {
+ "name": "Adam Harvey",
+ "email": "aharvey@php.net"
+ }
+ ],
+ "description": "Provides the functionality to export PHP variables for visualization",
+ "homepage": "http://www.github.com/sebastianbergmann/exporter",
+ "keywords": [
+ "export",
+ "exporter"
+ ],
+ "time": "2015-06-21 07:55:53"
+ },
+ {
+ "name": "sebastian/global-state",
+ "version": "1.1.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/global-state.git",
+ "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4",
+ "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.2"
+ },
+ "suggest": {
+ "ext-uopz": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Snapshotting of global state",
+ "homepage": "http://www.github.com/sebastianbergmann/global-state",
+ "keywords": [
+ "global state"
+ ],
+ "time": "2015-10-12 03:26:01"
+ },
+ {
+ "name": "sebastian/recursion-context",
+ "version": "1.0.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/recursion-context.git",
+ "reference": "913401df809e99e4f47b27cdd781f4a258d58791"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791",
+ "reference": "913401df809e99e4f47b27cdd781f4a258d58791",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ },
+ {
+ "name": "Adam Harvey",
+ "email": "aharvey@php.net"
+ }
+ ],
+ "description": "Provides functionality to recursively process PHP variables",
+ "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
+ "time": "2015-11-11 19:50:13"
+ },
+ {
+ "name": "sebastian/version",
+ "version": "1.0.6",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/version.git",
+ "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
+ "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
+ "shasum": ""
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library that helps with managing the version number of Git-hosted PHP projects",
+ "homepage": "https://github.com/sebastianbergmann/version",
+ "time": "2015-06-21 13:59:46"
+ },
+ {
+ "name": "symfony/yaml",
+ "version": "v3.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/yaml.git",
+ "reference": "3df409958a646dad2bc5046c3fb671ee24a1a691"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/3df409958a646dad2bc5046c3fb671ee24a1a691",
+ "reference": "3df409958a646dad2bc5046c3fb671ee24a1a691",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5.9"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Yaml\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Yaml Component",
+ "homepage": "https://symfony.com",
+ "time": "2015-12-26 13:39:53"
+ }
+ ],
+ "aliases": [],
+ "minimum-stability": "stable",
+ "stability-flags": [],
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": {
+ "php": ">=5.4"
+ },
+ "platform-dev": []
+}
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
new file mode 100644
index 0000000..4b4b1c3
--- /dev/null
+++ b/phpunit.xml.dist
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+ tests/
+
+
+
+
\ No newline at end of file
diff --git a/src/Article.php b/src/Article.php
new file mode 100644
index 0000000..b5b9b25
--- /dev/null
+++ b/src/Article.php
@@ -0,0 +1,73 @@
+options = new \ArrayIterator();
+ $this->setName($name);
+ }
+
+ public function addOption($option)
+ {
+ $this->options->append($option);
+ }
+
+ /**
+ * @param $params Array
+ */
+ public function setParams($params)
+ {
+ /** @var Option\Type\Base $option */
+ foreach($this->options as $option)
+ {
+ if(isset($params[$option->getId()])) {
+ $option->setRawValue($params[$option->getId()]);
+ $option->processValue();
+ }
+ }
+ }
+
+ /**
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * @param string $name
+ */
+ public function setName($name)
+ {
+ $this->name = $name;
+ }
+
+ public function getOptionById($id)
+ {
+ if($id === false) {
+ throw new \Exception('No id provided');
+ }
+
+ /** @var Option\Type\Base $options */
+ foreach($this->options as $options)
+ {
+ if($options->getId() == $id) {
+ return $options;
+ }
+ }
+
+ if($id === false) {
+ throw new \Exception('Option not found: ' . $id);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/Engine.php b/src/Engine.php
new file mode 100644
index 0000000..a3f89c4
--- /dev/null
+++ b/src/Engine.php
@@ -0,0 +1,75 @@
+articles = new \ArrayIterator();
+ $this->xml = simplexml_load_string($string);
+ $this->parse();
+ return true;
+ }
+
+ /**
+ * Parse Xml
+ */
+ protected function parse()
+ {
+ $parser = new Parser();
+
+ foreach ($this->xml as $article) {
+ $this->articles->append($parser->parse($article));
+
+ }
+ }
+
+ /**
+ * @return \ArrayIterator
+ */
+ public function getArticles()
+ {
+ return $this->articles;
+ }
+
+ /**
+ * @param bool $name
+ * @return Article
+ * @throws \Exception
+ */
+ public function getArticleByName($name = false)
+ {
+ if($name === false) {
+ throw new \Exception('No Name provided');
+ }
+
+ /** @var Article $article */
+ foreach($this->articles as $article)
+ {
+ if($article->getName() == $name) {
+ return $article;
+ }
+ }
+
+ if($name === false) {
+ throw new \Exception('Article not found: ' . $name);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/Option/Parser.php b/src/Option/Parser.php
new file mode 100644
index 0000000..cafda1b
--- /dev/null
+++ b/src/Option/Parser.php
@@ -0,0 +1,33 @@
+node = $node;
+
+ $obj = false;
+
+ switch(strtolower((string)$node['type'])) {
+ case 'input':
+ $obj = new Input();
+ break;
+ case 'select':
+ $obj = new Select();
+ break;
+ }
+
+ if($obj) {
+ $obj = $obj->parse($node);
+ }
+
+ return $obj;
+
+ }
+}
\ No newline at end of file
diff --git a/src/Option/Parser/Base.php b/src/Option/Parser/Base.php
new file mode 100644
index 0000000..20ca2a7
--- /dev/null
+++ b/src/Option/Parser/Base.php
@@ -0,0 +1,42 @@
+node = $node;
+ $this->element->setId((string)$node['id']);
+ $this->element->setName((string)$node['name']);
+
+ if(isset($node['default'])) {
+ $this->element->setDefault((string)$node['default']);
+ }
+ if(isset($node['require'])) {
+ $this->element->setRequire($this->getBoolean($node['require']));
+ }
+ if(isset($node['help'])) {
+ $this->element->setHelp((string)$node['help']);
+ }
+ }
+
+ private function getBoolean($value)
+ {
+ if((string)$value == 'true' || (string)$value == '1') {
+ return true;
+ }
+ return false;
+ }
+
+}
\ No newline at end of file
diff --git a/src/Option/Parser/Input.php b/src/Option/Parser/Input.php
new file mode 100644
index 0000000..9b6ed93
--- /dev/null
+++ b/src/Option/Parser/Input.php
@@ -0,0 +1,22 @@
+element = new \PSC\Library\Calc\Option\Type\Input();
+
+ parent::parse($node);
+
+ return $this->element;
+ }
+
+}
\ No newline at end of file
diff --git a/src/Option/Parser/Select.php b/src/Option/Parser/Select.php
new file mode 100644
index 0000000..edf5f3a
--- /dev/null
+++ b/src/Option/Parser/Select.php
@@ -0,0 +1,35 @@
+element = new \PSC\Library\Calc\Option\Type\Select();
+
+ parent::parse($node);
+
+ $optParser = new Opt();
+
+ foreach ($this->node->opt as $opt) {
+
+ $this->element->addOption($optParser->parse($opt));
+ }
+
+ return $this->element;
+ }
+
+}
\ No newline at end of file
diff --git a/src/Option/Parser/Select/Opt.php b/src/Option/Parser/Select/Opt.php
new file mode 100644
index 0000000..bc6cb31
--- /dev/null
+++ b/src/Option/Parser/Select/Opt.php
@@ -0,0 +1,24 @@
+element = new \PSC\Library\Calc\Option\Type\Select\Opt();
+
+ parent::parse($node);
+
+ return $this->element;
+ }
+
+}
\ No newline at end of file
diff --git a/src/Option/Type/Base.php b/src/Option/Type/Base.php
new file mode 100644
index 0000000..048fcc9
--- /dev/null
+++ b/src/Option/Type/Base.php
@@ -0,0 +1,170 @@
+name;
+ }
+
+ /**
+ * @param string $name
+ */
+ public function setName($name)
+ {
+ $this->name = $name;
+ }
+
+ /**
+ * @return string
+ */
+ public function getType()
+ {
+ return $this->type;
+ }
+
+ /**
+ * @param string $type
+ */
+ public function setType($type)
+ {
+ $this->type = $type;
+ }
+
+ /**
+ * @return string
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * @param string $id
+ */
+ public function setId($id)
+ {
+ $this->id = $id;
+ }
+
+ /**
+ * @return boolean
+ */
+ public function isRequire()
+ {
+ return $this->require;
+ }
+
+ /**
+ * @param boolean $require
+ */
+ public function setRequire($require)
+ {
+ $this->require = $require;
+ }
+
+ /**
+ * @return string
+ */
+ public function getDefault()
+ {
+ return $this->default;
+ }
+
+ /**
+ * @param string $default
+ */
+ public function setDefault($default)
+ {
+ $this->default = $default;
+ }
+
+ /**
+ * @return string
+ */
+ public function getHelp()
+ {
+ return $this->help;
+ }
+
+ /**
+ * @param string $help
+ */
+ public function setHelp($help)
+ {
+ $this->help = $help;
+ }
+
+ /**
+ * @return string
+ */
+ public function getRawValue()
+ {
+ return $this->rawValue;
+ }
+
+ /**
+ * @param string $rawValue
+ */
+ public function setRawValue($rawValue)
+ {
+ $this->rawValue = $rawValue;
+ }
+
+ /**
+ * Verarbeitet das Value
+ */
+ public function processValue()
+ {
+ $this->setValue($this->getRawValue());
+ }
+
+ /**
+ * @return string
+ */
+ public function getValue()
+ {
+ return $this->value;
+ }
+
+ /**
+ * @param string $value
+ */
+ public function setValue($value)
+ {
+ $this->value = $value;
+ }
+
+}
\ No newline at end of file
diff --git a/src/Option/Type/Input.php b/src/Option/Type/Input.php
new file mode 100644
index 0000000..e286b17
--- /dev/null
+++ b/src/Option/Type/Input.php
@@ -0,0 +1,9 @@
+options = new \ArrayIterator();
+ }
+
+ public function addOption($option)
+ {
+ $this->options->append($option);
+ }
+
+ /**
+ * Verarbeitet das Value
+ */
+ public function processValue()
+ {
+ /** @var Opt $opt */
+ foreach($this->options as $opt)
+ {
+ if($opt->getId() == $this->getRawValue()) {
+ $this->setValue($opt->getName());
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/Option/Type/Select/Opt.php b/src/Option/Type/Select/Opt.php
new file mode 100644
index 0000000..df02fb1
--- /dev/null
+++ b/src/Option/Type/Select/Opt.php
@@ -0,0 +1,10 @@
+article = new Article((string)$node->name);
+
+ foreach ($node->option as $option) {
+ $obj = $optionParser->parse($option);
+ if($obj) {
+ $this->article->addOption($obj);
+ }
+ }
+
+ return $this->article;
+ }
+
+}
\ No newline at end of file
diff --git a/tests/Article/CalendarXmlTest.php b/tests/Article/CalendarXmlTest.php
new file mode 100644
index 0000000..fd6594c
--- /dev/null
+++ b/tests/Article/CalendarXmlTest.php
@@ -0,0 +1,83 @@
+assertTrue($parser->loadString(file_get_contents(__DIR__ .'/../TestFiles/General/calendar.xml')));
+
+ $this->assertEquals(1, $parser->getArticles()->Count());
+ }
+
+ public function testGetArticleByName()
+ {
+ $parser = new Engine();
+ $parser->loadString(file_get_contents(__DIR__ .'/../TestFiles/General/calendar.xml'));
+
+ /** @var Article $article */
+ $article = $parser->getArticleByName('Kalender');
+ $this->assertInstanceOf('PSC\Library\Calc\Article', $article);
+ $this->assertEquals('Kalender', $article->getName());
+ }
+
+ public function testGetOptionById()
+ {
+ $parser = new Engine();
+ $parser->loadString(file_get_contents(__DIR__ .'/../TestFiles/General/calendar.xml'));
+ /** @var Article $article */
+ $article = $parser->getArticleByName('Kalender');
+
+ /** @var Select $option */
+ $option = $article->getOptionById('size');
+
+ $this->assertInstanceOf('PSC\Library\Calc\Option\Type\Select', $option);
+
+ }
+
+ public function testGetPrintableValuesFromSavedParamsWithCleaning()
+ {
+ $parser = new Engine();
+ $parser->loadString(file_get_contents(__DIR__ .'/../TestFiles/General/calendar.xml'));
+
+ /** @var Article $article */
+ $article = $parser->getArticleByName('Kalender');
+
+ $article->setParams(array(
+ "motive" => 0,
+ "motivepaid" => 0,
+ "auflage" => "1",
+ "size" => "a4h",
+ "papier" => "bdm250",
+ "seiten" => "13",
+ "schutzfolie" => "glanz",
+ "abschluss" => "mitkarton",
+ "produktion" => "std",
+ "hinweis" => "Produktionszeit + 3 Tage Versand",
+ "datenformat" => "pdf",
+ "musterdruck" => "keinmuster",
+ "info" => "Textfeld zur freien Eingabe",
+ "reload" => 0,
+ "kalk_artikel" => "Kalender",
+ ));
+
+ /** @var Select $option */
+ $option = $article->getOptionById('size');
+
+ $this->assertEquals('a4h', $option->getRawValue());
+ $this->assertEquals('DIN A4 Hochformat (297 x 210 mm)', $option->getValue());
+
+ $option = $article->getOptionById('seiten');
+
+ $this->assertEquals('13', $option->getRawValue());
+ $this->assertEquals('13 Seiten Monatskalender mit Deckblatt', $option->getValue());
+
+
+ }
+
+}
\ No newline at end of file
diff --git a/tests/Article/SimpleXmlTest.php b/tests/Article/SimpleXmlTest.php
new file mode 100644
index 0000000..f3150d5
--- /dev/null
+++ b/tests/Article/SimpleXmlTest.php
@@ -0,0 +1,34 @@
+assertTrue($parser->loadString(file_get_contents(__DIR__ .'/../TestFiles/General/simple.xml')));
+
+ $this->assertEquals(1, $parser->getArticles()->Count());
+ }
+
+ public function testIfArticleCountInXmlCorrectWith2Article()
+ {
+ $parser = new Engine();
+ $this->assertTrue($parser->loadString(file_get_contents(__DIR__ .'/../TestFiles/General/simple2articles.xml')));
+
+ $this->assertEquals(2, $parser->getArticles()->Count());
+ }
+
+ public function testGetArticleByName()
+ {
+ $parser = new Engine();
+ $parser->loadString(file_get_contents(__DIR__ .'/../TestFiles/General/simple2articles.xml'));
+
+ $article = $parser->getArticleByName('Blocks A5 25blatt geleimt');
+ $this->assertInstanceOf('PSC\Library\Calc\Article', $article);
+ $this->assertEquals('Blocks A5 25blatt geleimt', $article->getName());
+ }
+
+}
\ No newline at end of file
diff --git a/tests/General/LoadTest.php b/tests/General/LoadTest.php
new file mode 100644
index 0000000..f40043e
--- /dev/null
+++ b/tests/General/LoadTest.php
@@ -0,0 +1,14 @@
+assertTrue($parser->loadString(file_get_contents(__DIR__ .'/../TestFiles/General/simple.xml')));
+ }
+
+}
\ No newline at end of file
diff --git a/tests/Option/Type/InputTest.php b/tests/Option/Type/InputTest.php
new file mode 100644
index 0000000..6ce2e54
--- /dev/null
+++ b/tests/Option/Type/InputTest.php
@@ -0,0 +1,31 @@
+parse(simplexml_load_string(file_get_contents(__DIR__ .'/../../TestFiles/Option/input.xml')));
+
+ $this->assertInstanceOf('PSC\Library\Calc\Option\Type\Input', $obj);
+ }
+
+ public function testIfCorrectAttributes()
+ {
+ $parser = new Parser();
+ /** @var Input $obj */
+ $obj = $parser->parse(simplexml_load_string(file_get_contents(__DIR__ .'/../../TestFiles/Option/input.xml')));
+
+ $this->assertInstanceOf('PSC\Library\Calc\Option\Type\Input', $obj);
+ $this->assertTrue($obj->isRequire());
+ $this->assertEquals(5, $obj->getDefault());
+ $this->assertEquals('auflage', $obj->getId());
+ $this->assertEquals('Auflage', $obj->getName());
+ }
+
+}
\ No newline at end of file
diff --git a/tests/Option/Type/SelectTest.php b/tests/Option/Type/SelectTest.php
new file mode 100644
index 0000000..e8a3bc8
--- /dev/null
+++ b/tests/Option/Type/SelectTest.php
@@ -0,0 +1,31 @@
+parse(simplexml_load_string(file_get_contents(__DIR__ .'/../../TestFiles/Option/select.xml')));
+
+ $this->assertInstanceOf('PSC\Library\Calc\Option\Type\Select', $obj);
+ }
+
+ public function testIfCorrectAttributes()
+ {
+ $parser = new Parser();
+ /** @var Select $obj */
+ $obj = $parser->parse(simplexml_load_string(file_get_contents(__DIR__ .'/../../TestFiles/Option/select.xml')));
+
+ $this->assertInstanceOf('PSC\Library\Calc\Option\Type\Select', $obj);
+ $this->assertTrue($obj->isRequire());
+ $this->assertEquals('a4h', $obj->getDefault());
+ $this->assertEquals('size', $obj->getId());
+ $this->assertEquals('Wählen Sie eine Größe', $obj->getName());
+ }
+
+}
\ No newline at end of file
diff --git a/tests/TestFiles/General/calendar.xml b/tests/TestFiles/General/calendar.xml
new file mode 100644
index 0000000..da299a3
--- /dev/null
+++ b/tests/TestFiles/General/calendar.xml
@@ -0,0 +1,143 @@
+
+
+
+ Kalender
+ Kalender
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/TestFiles/General/simple.xml b/tests/TestFiles/General/simple.xml
new file mode 100755
index 0000000..df1fc05
--- /dev/null
+++ b/tests/TestFiles/General/simple.xml
@@ -0,0 +1,10 @@
+
+
+
+ Blocks A5 25blatt geleimt
+ kein
+
+
+
+
+
diff --git a/tests/TestFiles/General/simple2articles.xml b/tests/TestFiles/General/simple2articles.xml
new file mode 100755
index 0000000..17401e7
--- /dev/null
+++ b/tests/TestFiles/General/simple2articles.xml
@@ -0,0 +1,17 @@
+
+
+
+ Blocks A4 25blatt geleimt
+ kein
+
+
+
+
+
+ Blocks A5 25blatt geleimt
+ kein
+
+
+
+
+
diff --git a/tests/TestFiles/Option/input.xml b/tests/TestFiles/Option/input.xml
new file mode 100644
index 0000000..2aef555
--- /dev/null
+++ b/tests/TestFiles/Option/input.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/tests/TestFiles/Option/select.xml b/tests/TestFiles/Option/select.xml
new file mode 100644
index 0000000..6f24f02
--- /dev/null
+++ b/tests/TestFiles/Option/select.xml
@@ -0,0 +1,33 @@
+
+