From 08fd482dd936f261eb180314e32471b7dd7a4694 Mon Sep 17 00:00:00 2001 From: Meritoo Date: Tue, 19 Sep 2017 20:46:11 +0200 Subject: [PATCH] First, initial commit --- .gitignore | 129 + .php_cs.dist | 30 + LICENSE | 20 + README.md | 239 ++ build.xml | 46 + composer.json | 32 + composer.lock | 3581 +++++++++++++++++ phing/app.xml | 89 + phing/properties.dist | 125 + phing/tests.xml | 315 ++ phpunit.xml.dist | 35 + .../ApiClient/Base/Result/BaseItem.php | 52 + .../LimeSurvey/ApiClient/Client/Client.php | 137 + .../Configuration/ConnectionConfiguration.php | 220 + .../CreateSessionKeyFailedException.php | 36 + .../Exception/UnknownInstanceOfResultItem.php | 30 + .../Exception/UnknownMethodException.php | 29 + .../Manager/JsonRpcClientManager.php | 84 + .../ApiClient/Manager/SessionManager.php | 115 + .../ApiClient/Result/Item/Participant.php | 397 ++ .../Result/Item/ParticipantShort.php | 106 + .../ApiClient/Result/Item/Question.php | 153 + .../ApiClient/Result/Item/QuestionShort.php | 398 ++ .../ApiClient/Result/Item/Survey.php | 143 + .../Result/Processor/ResultProcessor.php | 118 + .../LimeSurvey/ApiClient/Result/Result.php | 122 + .../LimeSurvey/ApiClient/Type/MethodType.php | 113 + .../ApiClient/Type/SystemMethodType.php | 34 + .../ApiClient/Base/Result/BaseItemTest.php | 55 + .../Test/ApiClient/Client/ClientTest.php | 140 + .../ConnectionConfigurationTest.php | 146 + .../Manager/JsonRpcClientManagerTest.php | 99 + .../ApiClient/Manager/SessionManagerTest.php | 89 + .../Result/Item/ParticipantShortTest.php | 117 + .../ApiClient/Result/Item/ParticipantTest.php | 216 + .../Result/Item/QuestionShortTest.php | 223 + .../ApiClient/Result/Item/QuestionTest.php | 285 ++ .../Test/ApiClient/Result/Item/SurveyTest.php | 120 + .../Result/Processor/ResultProcessorTest.php | 86 + .../Test/ApiClient/Result/ResultTest.php | 182 + .../Test/ApiClient/Type/MethodTypeTest.php | 204 + .../ApiClient/Type/SystemMethodTypeTest.php | 66 + 42 files changed, 8956 insertions(+) create mode 100644 .gitignore create mode 100644 .php_cs.dist create mode 100644 LICENSE create mode 100644 README.md create mode 100644 build.xml create mode 100644 composer.json create mode 100644 composer.lock create mode 100644 phing/app.xml create mode 100644 phing/properties.dist create mode 100644 phing/tests.xml create mode 100644 phpunit.xml.dist create mode 100644 src/Meritoo/LimeSurvey/ApiClient/Base/Result/BaseItem.php create mode 100644 src/Meritoo/LimeSurvey/ApiClient/Client/Client.php create mode 100644 src/Meritoo/LimeSurvey/ApiClient/Configuration/ConnectionConfiguration.php create mode 100644 src/Meritoo/LimeSurvey/ApiClient/Exception/CreateSessionKeyFailedException.php create mode 100644 src/Meritoo/LimeSurvey/ApiClient/Exception/UnknownInstanceOfResultItem.php create mode 100644 src/Meritoo/LimeSurvey/ApiClient/Exception/UnknownMethodException.php create mode 100644 src/Meritoo/LimeSurvey/ApiClient/Manager/JsonRpcClientManager.php create mode 100644 src/Meritoo/LimeSurvey/ApiClient/Manager/SessionManager.php create mode 100644 src/Meritoo/LimeSurvey/ApiClient/Result/Item/Participant.php create mode 100644 src/Meritoo/LimeSurvey/ApiClient/Result/Item/ParticipantShort.php create mode 100644 src/Meritoo/LimeSurvey/ApiClient/Result/Item/Question.php create mode 100644 src/Meritoo/LimeSurvey/ApiClient/Result/Item/QuestionShort.php create mode 100644 src/Meritoo/LimeSurvey/ApiClient/Result/Item/Survey.php create mode 100644 src/Meritoo/LimeSurvey/ApiClient/Result/Processor/ResultProcessor.php create mode 100644 src/Meritoo/LimeSurvey/ApiClient/Result/Result.php create mode 100644 src/Meritoo/LimeSurvey/ApiClient/Type/MethodType.php create mode 100644 src/Meritoo/LimeSurvey/ApiClient/Type/SystemMethodType.php create mode 100644 tests/Meritoo/LimeSurvey/Test/ApiClient/Base/Result/BaseItemTest.php create mode 100644 tests/Meritoo/LimeSurvey/Test/ApiClient/Client/ClientTest.php create mode 100644 tests/Meritoo/LimeSurvey/Test/ApiClient/Configuration/ConnectionConfigurationTest.php create mode 100644 tests/Meritoo/LimeSurvey/Test/ApiClient/Manager/JsonRpcClientManagerTest.php create mode 100644 tests/Meritoo/LimeSurvey/Test/ApiClient/Manager/SessionManagerTest.php create mode 100644 tests/Meritoo/LimeSurvey/Test/ApiClient/Result/Item/ParticipantShortTest.php create mode 100644 tests/Meritoo/LimeSurvey/Test/ApiClient/Result/Item/ParticipantTest.php create mode 100644 tests/Meritoo/LimeSurvey/Test/ApiClient/Result/Item/QuestionShortTest.php create mode 100644 tests/Meritoo/LimeSurvey/Test/ApiClient/Result/Item/QuestionTest.php create mode 100644 tests/Meritoo/LimeSurvey/Test/ApiClient/Result/Item/SurveyTest.php create mode 100644 tests/Meritoo/LimeSurvey/Test/ApiClient/Result/Processor/ResultProcessorTest.php create mode 100644 tests/Meritoo/LimeSurvey/Test/ApiClient/Result/ResultTest.php create mode 100644 tests/Meritoo/LimeSurvey/Test/ApiClient/Type/MethodTypeTest.php create mode 100644 tests/Meritoo/LimeSurvey/Test/ApiClient/Type/SystemMethodTypeTest.php diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d6ca16b --- /dev/null +++ b/.gitignore @@ -0,0 +1,129 @@ +# ---------------------------------------------------------------------------------------------------------------------- +### Vendors +# ---------------------------------------------------------------------------------------------------------------------- +/vendor/ + +# ---------------------------------------------------------------------------------------------------------------------- +### Build +# ---------------------------------------------------------------------------------------------------------------------- +/build/ + +# ---------------------------------------------------------------------------------------------------------------------- +### Composer +# ---------------------------------------------------------------------------------------------------------------------- +/composer.phar + +# ---------------------------------------------------------------------------------------------------------------------- +### Phing +# ---------------------------------------------------------------------------------------------------------------------- +/phing/properties + +# ---------------------------------------------------------------------------------------------------------------------- +### PHPUnit +# ---------------------------------------------------------------------------------------------------------------------- +/phpunit.xml + +# ---------------------------------------------------------------------------------------------------------------------- +### PHP Coding Standards Fixer generated files +# ---------------------------------------------------------------------------------------------------------------------- +/.php_cs.cache + +# ---------------------------------------------------------------------------------------------------------------------- +### Generated databases +# ---------------------------------------------------------------------------------------------------------------------- +/data/tmp +*.sql +*.sqlite + +# ---------------------------------------------------------------------------------------------------------------------- +### Compiled source +# ---------------------------------------------------------------------------------------------------------------------- +*.com +*.class +*.dll +*.exe +*.o +*.so + +# ---------------------------------------------------------------------------------------------------------------------- +### Shell scripts +# ---------------------------------------------------------------------------------------------------------------------- +/*.sh + +# ---------------------------------------------------------------------------------------------------------------------- +### Linux template +# ---------------------------------------------------------------------------------------------------------------------- +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +# ---------------------------------------------------------------------------------------------------------------------- +### JetBrains +# ---------------------------------------------------------------------------------------------------------------------- +/.idea + +# ---------------------------------------------------------------------------------------------------------------------- +### Windows template +# ---------------------------------------------------------------------------------------------------------------------- +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# ---------------------------------------------------------------------------------------------------------------------- +### macOS template +# ---------------------------------------------------------------------------------------------------------------------- +# General +*.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk diff --git a/.php_cs.dist b/.php_cs.dist new file mode 100644 index 0000000..4e1c7bd --- /dev/null +++ b/.php_cs.dist @@ -0,0 +1,30 @@ +notPath('/DependencyInjection\/Configuration\.php/') + ->notPath('/autoload\.php/') + ->in([ + __DIR__ . '/src', + __DIR__ . '/tests', + ]); + +return PhpCsFixer\Config::create() + ->setRules([ + '@Symfony' => true, + 'phpdoc_summary' => false, + 'phpdoc_separation' => false, + 'phpdoc_align' => false, + 'cast_spaces' => false, + 'binary_operator_spaces' => [ + 'align_double_arrow' => true, + ], + 'concat_space' => [ + 'spacing' => 'one', + ], + ]) + ->setFinder($finder); diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2b59c1f --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +MIT License +Copyright (c) Meritoo.pl, http://www.meritoo.pl + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..27e4c8c --- /dev/null +++ b/README.md @@ -0,0 +1,239 @@ +# Meritoo LimeSurvey API Client +Client of the [LimeSurvey's API](https://manual.limesurvey.org/RemoteControl_2_API). + +## Installation + +Run [Composer](https://getcomposer.org) to install this package in your project: + + ```bash + $ composer require meritoo/limesurvey-api-client + ``` + +> How to install Composer: https://getcomposer.org/download + +## Usage + +1. First of all you have to prepare configuration of connection and create instance of a client: + + ```php + use Meritoo\LimeSurvey\ApiClient\Client\Client; + use Meritoo\LimeSurvey\ApiClient\Configuration\ConnectionConfiguration; + use Meritoo\LimeSurvey\ApiClient\Type\MethodType; + + /* + * Prepare configuration of connection and client of the API + */ + $configuration = new ConnectionConfiguration('http://test.com', 'test', 'test'); + $client = new Client($configuration); + ``` + +2. Next run the method which you would like: + + ```php + /* + * Run required method + */ + $result = $client->run(MethodType::LIST_SURVEYS); + ``` + +3. Finally grab data from result of called method: + + ```php + /* + * ...and grab data from the result + */ + $data = $result->getData(); + ``` + +Full code of this example: + +```php +use Meritoo\LimeSurvey\ApiClient\Client\Client; +use Meritoo\LimeSurvey\ApiClient\Configuration\ConnectionConfiguration; +use Meritoo\LimeSurvey\ApiClient\Type\MethodType; + +/* + * Prepare configuration of connection and client of the API + */ +$configuration = new ConnectionConfiguration('http://test.com', 'test', 'test'); +$client = new Client($configuration); + +/* + * Run required method and grab data from the result + */ +$result = $client->run(MethodType::LIST_SURVEYS); +$data = $result->getData(); +``` + +## Available methods + +All available methods provides `Meritoo\LimeSurvey\ApiClient\Type\MethodType` class as constants of the class. Examples: + +```php +// Add a response to the survey responses collection +MethodType::ADD_RESPONSE; + +// The IDs and properties of token/participants of a survey +MethodType::LIST_PARTICIPANTS; + +// List the surveys belonging to a user +MethodType::LIST_SURVEYS; +``` + +Name of the method, actually constant of the `MethodType` class, you should pass as 1st argument of `\Meritoo\LimeSurvey\ApiClient\Client\Client::run()` method. Example: + +```php +$client->run(MethodType::GET_PARTICIPANT_PROPERTIES); +``` + +## Debug mode + +In some cases more information may be required to fix bugs. The "debug" mode will help you do this. You can turn it on while preparing configuration of connection by passing `true` as 4th argument of constructor: + +```php +use Meritoo\LimeSurvey\ApiClient\Configuration\ConnectionConfiguration; +$configuration = new ConnectionConfiguration('http://test.com', 'test', 'test', true); +``` + +The "debug" mode can be turned on if the instance of configuration exists by using the `\Meritoo\LimeSurvey\ApiClient\Configuration\ConnectionConfiguration::setDebugMode()` method: + +```php +$configuration->setDebugMode(true); +``` + +If you want to verify if if the "debug" mode is turned on simply call the `\Meritoo\LimeSurvey\ApiClient\Configuration\ConnectionConfiguration::isDebugModeOn()` method: + +```php +$debugMode = $configuration->isDebugModeOn(); +``` + +## Getting data from result + +#### Verify if the result is empty + +First of all you have to call required method to get result - instance of `\Meritoo\LimeSurvey\ApiClient\Result\Result` class. The result allows you to get information if there is any data by calling the `\Meritoo\LimeSurvey\ApiClient\Result\Result::isEmpty()` method: + +```php +use Meritoo\LimeSurvey\ApiClient\Result\Result; +use Meritoo\LimeSurvey\ApiClient\Type\MethodType; + +$result = new Result(MethodType::LIST_SURVEYS, []); +$isEmpty = $result->isEmpty(); + +var_dump($isEmpty); // bool(true) +``` + +#### Prepared/processed vs raw data + +Result allows you to get data, the essence of calling API's method by calling the `\Meritoo\LimeSurvey\ApiClient\Result\Result::getData()` method. This method accepts 1 bool argument: +- `false` - (default) prepared/processed data provided will be returned +- `true` - raw data will be returned + +Prepared/processed data means instances of classes from `Meritoo\LimeSurvey\ApiClient\Result\Item\*` namespace. + +> Attention. +> 1. The above is true, if result provided by the API *is iterable*. Otherwise - instance of single item is returned. +> 2. Methods that provides iterable result: +> +> - MethodType::LIST_PARTICIPANTS +> - MethodType::LIST_QUESTIONS +> - MethodType::LIST_SURVEYS +> - MethodType::LIST_USERS +> +> They are defined in `Meritoo\LimeSurvey\ApiClient\Type\MethodType::isResultIterable()` method. + +#### Prepared/processed data + +All instances are returned as elements of collection (instance of `Meritoo\Common\Collection\Collection` class). Example: + +```php +class Meritoo\Common\Collection\Collection#565 (1) { + private $elements => + array(2) { + [0] => + class Meritoo\LimeSurvey\ApiClient\Result\Item\Survey#564 (5) { + private $id => + int(456) + private $title => + string(12) "Another Test" + private $expiresAt => + NULL + private $active => + bool(true) + } + [1] => + class Meritoo\LimeSurvey\ApiClient\Result\Item\Survey#564 (5) { + private $id => + int(456) + private $title => + string(12) "Another Test" + private $expiresAt => + NULL + private $active => + bool(true) + } + } +} +``` + +If result provided by the API *is not iterable*, as mentioned above, instance of single item is returned. Example: + +```php +class Meritoo\LimeSurvey\ApiClient\Result\Item\Participant#701 (17) { + private $id => + int(123) + private $participantId => + int(456) + private $mpId => + NULL + private $firstName => + string(5) "Lorem" + private $lastName => + string(5) "Ipsum" + (...) +} +``` + +#### Raw data + +An array with scalars or other arrays. Example: + +```php +array(2) { + [0] => + array(5) { + 'sid' => + string(3) "123" + 'surveyls_title' => + string(4) "Test" + 'startdate' => + NULL + 'expires' => + string(19) "2017-09-19 13:02:41" + 'active' => + string(1) "N" + } + [1] => + array(5) { + 'sid' => + string(3) "456" + 'surveyls_title' => + string(12) "Another Test" + 'startdate' => + string(19) "2017-09-19 13:02:41" + 'expires' => + NULL + 'active' => + string(1) "Y" + } +} +``` + +## Links + +- LimeSurvey: + https://www.limesurvey.org +- Composer: + https://getcomposer.org + +Enjoy! diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..928bc93 --- /dev/null +++ b/build.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..176a855 --- /dev/null +++ b/composer.json @@ -0,0 +1,32 @@ +{ + "name": "meritoo/limesurvey-api-client", + "description": "Client of LimeSurvey API", + "type": "library", + "license": "MIT", + "version": "0.0.1", + "authors": [ + { + "name": "Meritoo", + "email": "github@meritoo.pl" + } + ], + "require": { + "fguillot/json-rpc": "^1.2", + "meritoo/common-library": "~0.0.1" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.4.3", + "squizlabs/php_codesniffer": "^2.8", + "phpmd/phpmd": "^2.6", + "sebastian/phpcpd": "^3.0", + "pdepend/pdepend": "^2.5", + "phploc/phploc": "^4.0", + "friendsofphp/php-cs-fixer": "^2.5" + }, + "autoload": { + "psr-4": { + "Meritoo\\LimeSurvey\\": "src/Meritoo/LimeSurvey/", + "Meritoo\\LimeSurvey\\Test\\": "tests/Meritoo/LimeSurvey/Test/" + } + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..7e35df4 --- /dev/null +++ b/composer.lock @@ -0,0 +1,3581 @@ +{ + "_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" + ], + "content-hash": "8dd6b3c26ff164b50e36ec644a269e12", + "packages": [ + { + "name": "behat/transliterator", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/Behat/Transliterator.git", + "reference": "826ce7e9c2a6664c0d1f381cbb38b1fb80a7ee2c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Behat/Transliterator/zipball/826ce7e9c2a6664c0d1f381cbb38b1fb80a7ee2c", + "reference": "826ce7e9c2a6664c0d1f381cbb38b1fb80a7ee2c", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "chuyskywalker/rolling-curl": "^3.1", + "php-yaoi/php-yaoi": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "psr-0": { + "Behat\\Transliterator": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Artistic-1.0" + ], + "description": "String transliterator", + "keywords": [ + "i18n", + "slug", + "transliterator" + ], + "time": "2017-04-04T11:38:05+00:00" + }, + { + "name": "doctrine/annotations", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "54cacc9b81758b14e3ce750f205a393d52339e97" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/54cacc9b81758b14e3ce750f205a393d52339e97", + "reference": "54cacc9b81758b14e3ce750f205a393d52339e97", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "doctrine/cache": "1.*", + "phpunit/phpunit": "^5.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "time": "2017-02-24T16:22:25+00:00" + }, + { + "name": "doctrine/cache", + "version": "v1.6.2", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "eb152c5100571c7a45470ff2a35095ab3f3b900b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/eb152c5100571c7a45470ff2a35095ab3f3b900b", + "reference": "eb152c5100571c7a45470ff2a35095ab3f3b900b", + "shasum": "" + }, + "require": { + "php": "~5.5|~7.0" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "phpunit/phpunit": "~4.8|~5.0", + "predis/predis": "~1.0", + "satooshi/php-coveralls": "~0.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Caching library offering an object-oriented API for many cache backends", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "cache", + "caching" + ], + "time": "2017-07-22T12:49:21+00:00" + }, + { + "name": "doctrine/collections", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/collections.git", + "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/collections/zipball/1a4fb7e902202c33cce8c55989b945612943c2ba", + "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "doctrine/coding-standard": "~0.1@dev", + "phpunit/phpunit": "^5.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Collections\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Collections Abstraction library", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "array", + "collections", + "iterator" + ], + "time": "2017-01-03T10:49:41+00:00" + }, + { + "name": "doctrine/common", + "version": "v2.7.3", + "source": { + "type": "git", + "url": "https://github.com/doctrine/common.git", + "reference": "4acb8f89626baafede6ee5475bc5844096eba8a9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/common/zipball/4acb8f89626baafede6ee5475bc5844096eba8a9", + "reference": "4acb8f89626baafede6ee5475bc5844096eba8a9", + "shasum": "" + }, + "require": { + "doctrine/annotations": "1.*", + "doctrine/cache": "1.*", + "doctrine/collections": "1.*", + "doctrine/inflector": "1.*", + "doctrine/lexer": "1.*", + "php": "~5.6|~7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "lib/Doctrine/Common" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common Library for Doctrine projects", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "collections", + "eventmanager", + "persistence", + "spl" + ], + "time": "2017-07-22T08:35:12+00:00" + }, + { + "name": "doctrine/dbal", + "version": "v2.5.13", + "source": { + "type": "git", + "url": "https://github.com/doctrine/dbal.git", + "reference": "729340d8d1eec8f01bff708e12e449a3415af873" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/729340d8d1eec8f01bff708e12e449a3415af873", + "reference": "729340d8d1eec8f01bff708e12e449a3415af873", + "shasum": "" + }, + "require": { + "doctrine/common": ">=2.4,<2.8-dev", + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "4.*", + "symfony/console": "2.*||^3.0" + }, + "suggest": { + "symfony/console": "For helpful console commands such as SQL execution and import of files." + }, + "bin": [ + "bin/doctrine-dbal" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\DBAL\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Database Abstraction Layer", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "dbal", + "persistence", + "queryobject" + ], + "time": "2017-07-22T20:44:48+00:00" + }, + { + "name": "doctrine/inflector", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "90b2128806bfde671b6952ab8bea493942c1fdae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/90b2128806bfde671b6952ab8bea493942c1fdae", + "reference": "90b2128806bfde671b6952ab8bea493942c1fdae", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "4.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Inflector\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common String Manipulations with regard to casing and singular/plural rules.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "inflection", + "pluralize", + "singularize", + "string" + ], + "time": "2015-11-06T14:35:42+00:00" + }, + { + "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-14T21:17:01+00:00" + }, + { + "name": "doctrine/lexer", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Lexer\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "lexer", + "parser" + ], + "time": "2014-09-09T13:34:57+00:00" + }, + { + "name": "doctrine/orm", + "version": "v2.5.11", + "source": { + "type": "git", + "url": "https://github.com/doctrine/doctrine2.git", + "reference": "249b737094f1e7cba4f0a8d19acf5be6cf3ed504" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/249b737094f1e7cba4f0a8d19acf5be6cf3ed504", + "reference": "249b737094f1e7cba4f0a8d19acf5be6cf3ed504", + "shasum": "" + }, + "require": { + "doctrine/cache": "~1.4", + "doctrine/collections": "~1.2", + "doctrine/common": ">=2.5-dev,<2.9-dev", + "doctrine/dbal": ">=2.5-dev,<2.7-dev", + "doctrine/instantiator": "^1.0.1", + "ext-pdo": "*", + "php": ">=5.4", + "symfony/console": "~2.5|~3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0", + "symfony/yaml": "~2.3|~3.0" + }, + "suggest": { + "symfony/yaml": "If you want to use YAML Metadata Mapping Driver" + }, + "bin": [ + "bin/doctrine", + "bin/doctrine.php" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\ORM\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Object-Relational-Mapper for PHP", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "orm" + ], + "time": "2017-09-18T06:50:20+00:00" + }, + { + "name": "fguillot/json-rpc", + "version": "v1.2.4", + "source": { + "type": "git", + "url": "https://github.com/fguillot/JsonRPC.git", + "reference": "ea2720b13e986bbf23e832b135c84c91ead7259f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fguillot/JsonRPC/zipball/ea2720b13e986bbf23e832b135c84c91ead7259f", + "reference": "ea2720b13e986bbf23e832b135c84c91ead7259f", + "shasum": "" + }, + "require": { + "php": ">=5.3.4" + }, + "require-dev": { + "phpunit/phpunit": "4.8.*" + }, + "type": "library", + "autoload": { + "psr-0": { + "JsonRPC": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frédéric Guillot" + } + ], + "description": "Simple Json-RPC client/server library that just works", + "homepage": "https://github.com/fguillot/JsonRPC", + "time": "2017-01-12T21:31:30+00:00" + }, + { + "name": "gedmo/doctrine-extensions", + "version": "v2.4.30", + "source": { + "type": "git", + "url": "https://github.com/Atlantic18/DoctrineExtensions.git", + "reference": "5e2cc07beb0cd24345cbe02eb7afc3b23f9cd488" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Atlantic18/DoctrineExtensions/zipball/5e2cc07beb0cd24345cbe02eb7afc3b23f9cd488", + "reference": "5e2cc07beb0cd24345cbe02eb7afc3b23f9cd488", + "shasum": "" + }, + "require": { + "behat/transliterator": "~1.2", + "doctrine/common": "~2.4", + "php": ">=5.3.2" + }, + "require-dev": { + "doctrine/common": ">=2.5.0", + "doctrine/mongodb-odm": ">=1.0.2", + "doctrine/orm": ">=2.5.0", + "phpunit/phpunit": "*", + "symfony/yaml": "~2.6|~3.0" + }, + "suggest": { + "doctrine/mongodb-odm": "to use the extensions with the MongoDB ODM", + "doctrine/orm": "to use the extensions with the ORM" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4.x-dev" + } + }, + "autoload": { + "psr-0": { + "Gedmo\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "David Buchmann", + "email": "david@liip.ch" + }, + { + "name": "Gediminas Morkevicius", + "email": "gediminas.morkevicius@gmail.com" + }, + { + "name": "Gustavo Falco", + "email": "comfortablynumb84@gmail.com" + } + ], + "description": "Doctrine2 behavioral extensions", + "homepage": "http://gediminasm.org/", + "keywords": [ + "Blameable", + "behaviors", + "doctrine2", + "extensions", + "gedmo", + "loggable", + "nestedset", + "sluggable", + "sortable", + "timestampable", + "translatable", + "tree", + "uploadable" + ], + "time": "2017-07-02T09:46:37+00:00" + }, + { + "name": "meritoo/common-library", + "version": "0.0.7", + "source": { + "type": "git", + "url": "https://github.com/meritoo/common-library.git", + "reference": "94a464cb4ded35c53638a404657a15a114437815" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/meritoo/common-library/zipball/94a464cb4ded35c53638a404657a15a114437815", + "reference": "94a464cb4ded35c53638a404657a15a114437815", + "shasum": "" + }, + "require": { + "doctrine/orm": "^2.5", + "gedmo/doctrine-extensions": "^2.4", + "php": ">=5.6.0", + "symfony/http-foundation": "^3.3" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.1", + "pdepend/pdepend": "^2.5", + "phploc/phploc": "^3.0", + "phpmd/phpmd": "^2.6", + "phpunit/phpunit": "^4.8 || ^5.0", + "sebastian/phpcpd": "^3.0", + "squizlabs/php_codesniffer": "^2.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Meritoo\\Common\\": "src/Meritoo/Common/", + "Meritoo\\Common\\Test\\": "tests/Meritoo/Common/Test/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Meritoo.pl", + "email": "github@meritoo.pl", + "homepage": "http://www.meritoo.pl" + } + ], + "description": "Useful classes, methods, extensions etc.", + "time": "2017-09-19T16:09:13+00:00" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10T12:19:37+00:00" + }, + { + "name": "symfony/console", + "version": "v3.3.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "a1e1b01293a090cb9ae2ddd221a3251a4a7e4abf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/a1e1b01293a090cb9ae2ddd221a3251a4a7e4abf", + "reference": "a1e1b01293a090cb9ae2ddd221a3251a4a7e4abf", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/debug": "~2.8|~3.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.3", + "symfony/dependency-injection": "~3.3", + "symfony/event-dispatcher": "~2.8|~3.0", + "symfony/filesystem": "~2.8|~3.0", + "symfony/process": "~2.8|~3.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/filesystem": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "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 Console Component", + "homepage": "https://symfony.com", + "time": "2017-09-06T16:40:18+00:00" + }, + { + "name": "symfony/debug", + "version": "v3.3.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "8beb24eec70b345c313640962df933499373a944" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/8beb24eec70b345c313640962df933499373a944", + "reference": "8beb24eec70b345c313640962df933499373a944", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/http-kernel": "~2.8|~3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "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 Debug Component", + "homepage": "https://symfony.com", + "time": "2017-09-01T13:23:39+00:00" + }, + { + "name": "symfony/http-foundation", + "version": "v3.3.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "2cdc7de1921d1a1c805a13dc05e44a2cd58f5ad3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/2cdc7de1921d1a1c805a13dc05e44a2cd58f5ad3", + "reference": "2cdc7de1921d1a1c805a13dc05e44a2cd58f5ad3", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-mbstring": "~1.1" + }, + "require-dev": { + "symfony/expression-language": "~2.8|~3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpFoundation\\": "" + }, + "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 HttpFoundation Component", + "homepage": "https://symfony.com", + "time": "2017-09-06T17:07:39+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7c8fae0ac1d216eb54349e6a8baa57d515fe8803", + "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2017-06-14T15:44:48+00:00" + } + ], + "packages-dev": [ + { + "name": "composer/semver", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/c7cb9a2095a074d131b65a8a0cd294479d785573", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5 || ^5.0.5", + "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "time": "2016-08-30T16:08:34+00:00" + }, + { + "name": "friendsofphp/php-cs-fixer", + "version": "v2.6.0", + "source": { + "type": "git", + "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", + "reference": "5642a36a60c11cdd01488d192541a89bb44a4abf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/5642a36a60c11cdd01488d192541a89bb44a4abf", + "reference": "5642a36a60c11cdd01488d192541a89bb44a4abf", + "shasum": "" + }, + "require": { + "composer/semver": "^1.4", + "doctrine/annotations": "^1.2", + "ext-json": "*", + "ext-tokenizer": "*", + "gecko-packages/gecko-php-unit": "^2.0", + "php": "^5.6 || >=7.0 <7.2", + "sebastian/diff": "^1.4", + "symfony/console": "^3.2", + "symfony/event-dispatcher": "^3.0", + "symfony/filesystem": "^3.0", + "symfony/finder": "^3.0", + "symfony/options-resolver": "^3.0", + "symfony/polyfill-php70": "^1.0", + "symfony/polyfill-php72": "^1.4", + "symfony/process": "^3.0", + "symfony/stopwatch": "^3.0" + }, + "conflict": { + "hhvm": "*" + }, + "require-dev": { + "johnkary/phpunit-speedtrap": "^1.1", + "justinrainbow/json-schema": "^5.0", + "php-cs-fixer/accessible-object": "^1.0", + "phpunit/phpunit": "^4.8.35 || ^5.4.3", + "satooshi/php-coveralls": "^1.0", + "symfony/phpunit-bridge": "^3.2.2" + }, + "suggest": { + "ext-mbstring": "For handling non-UTF8 characters in cache signature.", + "symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible." + }, + "bin": [ + "php-cs-fixer" + ], + "type": "application", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-4": { + "PhpCsFixer\\": "src/" + }, + "classmap": [ + "tests/Test/Assert/AssertTokensTrait.php", + "tests/Test/AbstractFixerTestCase.php", + "tests/Test/AbstractIntegrationTestCase.php", + "tests/Test/IntegrationCase.php", + "tests/Test/IntegrationCaseFactory.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "A tool to automatically fix PHP code style", + "time": "2017-09-11T15:23:20+00:00" + }, + { + "name": "gecko-packages/gecko-php-unit", + "version": "v2.2", + "source": { + "type": "git", + "url": "https://github.com/GeckoPackages/GeckoPHPUnit.git", + "reference": "ab525fac9a9ffea219687f261b02008b18ebf2d1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GeckoPackages/GeckoPHPUnit/zipball/ab525fac9a9ffea219687f261b02008b18ebf2d1", + "reference": "ab525fac9a9ffea219687f261b02008b18ebf2d1", + "shasum": "" + }, + "require": { + "php": "^5.3.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.4.3" + }, + "suggest": { + "ext-dom": "When testing with xml.", + "ext-libxml": "When testing with xml.", + "phpunit/phpunit": "This is an extension for it so make sure you have it some way." + }, + "type": "library", + "autoload": { + "psr-4": { + "GeckoPackages\\PHPUnit\\": "src/PHPUnit" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Additional PHPUnit asserts and constraints.", + "homepage": "https://github.com/GeckoPackages", + "keywords": [ + "extension", + "filesystem", + "phpunit" + ], + "time": "2017-08-23T07:39:54+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.6.1", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8e6e04167378abf1ddb4d3522d8755c5fd90d102", + "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "doctrine/collections": "1.*", + "phpunit/phpunit": "~4.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "homepage": "https://github.com/myclabs/DeepCopy", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2017-04-12T18:52:22+00:00" + }, + { + "name": "paragonie/random_compat", + "version": "v2.0.10", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "634bae8e911eefa89c1abfbf1b66da679ac8f54d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/634bae8e911eefa89c1abfbf1b66da679ac8f54d", + "reference": "634bae8e911eefa89c1abfbf1b66da679ac8f54d", + "shasum": "" + }, + "require": { + "php": ">=5.2.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "type": "library", + "autoload": { + "files": [ + "lib/random.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "pseudorandom", + "random" + ], + "time": "2017-03-13T16:27:32+00:00" + }, + { + "name": "pdepend/pdepend", + "version": "2.5.0", + "source": { + "type": "git", + "url": "https://github.com/pdepend/pdepend.git", + "reference": "0c50874333149c0dad5a2877801aed148f2767ff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pdepend/pdepend/zipball/0c50874333149c0dad5a2877801aed148f2767ff", + "reference": "0c50874333149c0dad5a2877801aed148f2767ff", + "shasum": "" + }, + "require": { + "php": ">=5.3.7", + "symfony/config": "^2.3.0|^3", + "symfony/dependency-injection": "^2.3.0|^3", + "symfony/filesystem": "^2.3.0|^3" + }, + "require-dev": { + "phpunit/phpunit": "^4.4.0,<4.8", + "squizlabs/php_codesniffer": "^2.0.0" + }, + "bin": [ + "src/bin/pdepend" + ], + "type": "library", + "autoload": { + "psr-4": { + "PDepend\\": "src/main/php/PDepend" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Official version of pdepend to be handled with Composer", + "time": "2017-01-19T14:23:36+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2017-09-11T18:02:19+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "3.2.2", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/4aada1f93c72c35e22fb1383b47fee43b8f1d157", + "reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0@dev", + "phpdocumentor/type-resolver": "^0.3.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2017-08-08T06:39:58+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.3.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/fb3933512008d8162b3cdf9e18dba9309b7c3773", + "reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "time": "2017-06-03T08:32:36+00:00" + }, + { + "name": "phploc/phploc", + "version": "4.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phploc.git", + "reference": "7335bb2173c687759631fe4901db6897245f6e2b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phploc/zipball/7335bb2173c687759631fe4901db6897245f6e2b", + "reference": "7335bb2173c687759631fe4901db6897245f6e2b", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0", + "sebastian/finder-facade": "^1.1", + "sebastian/version": "^2.0", + "symfony/console": "^2.7|^3.0" + }, + "bin": [ + "phploc" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-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": "A tool for quickly measuring the size of a PHP project.", + "homepage": "https://github.com/sebastianbergmann/phploc", + "time": "2017-06-06T13:07:11+00:00" + }, + { + "name": "phpmd/phpmd", + "version": "2.6.0", + "source": { + "type": "git", + "url": "https://github.com/phpmd/phpmd.git", + "reference": "4e9924b2c157a3eb64395460fcf56b31badc8374" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpmd/phpmd/zipball/4e9924b2c157a3eb64395460fcf56b31badc8374", + "reference": "4e9924b2c157a3eb64395460fcf56b31badc8374", + "shasum": "" + }, + "require": { + "ext-xml": "*", + "pdepend/pdepend": "^2.5", + "php": ">=5.3.9" + }, + "require-dev": { + "phpunit/phpunit": "^4.0", + "squizlabs/php_codesniffer": "^2.0" + }, + "bin": [ + "src/bin/phpmd" + ], + "type": "project", + "autoload": { + "psr-0": { + "PHPMD\\": "src/main/php" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Manuel Pichler", + "email": "github@manuel-pichler.de", + "homepage": "https://github.com/manuelpichler", + "role": "Project Founder" + }, + { + "name": "Other contributors", + "homepage": "https://github.com/phpmd/phpmd/graphs/contributors", + "role": "Contributors" + }, + { + "name": "Marc Würth", + "email": "ravage@bluewin.ch", + "homepage": "https://github.com/ravage84", + "role": "Project Maintainer" + } + ], + "description": "PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD.", + "homepage": "http://phpmd.org/", + "keywords": [ + "mess detection", + "mess detector", + "pdepend", + "phpmd", + "pmd" + ], + "time": "2017-01-20T14:41:10+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "v1.7.2", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", + "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "sebastian/comparator": "^1.1|^2.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8 || ^5.6.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7.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": "2017-09-04T11:05:03+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "4.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d", + "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^5.6 || ^7.0", + "phpunit/php-file-iterator": "^1.3", + "phpunit/php-text-template": "^1.2", + "phpunit/php-token-stream": "^1.4.2 || ^2.0", + "sebastian/code-unit-reverse-lookup": "^1.0", + "sebastian/environment": "^1.3.2 || ^2.0", + "sebastian/version": "^1.0 || ^2.0" + }, + "require-dev": { + "ext-xdebug": "^2.1.4", + "phpunit/phpunit": "^5.7" + }, + "suggest": { + "ext-xdebug": "^2.5.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0.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": "2017-04-02T07:44:40+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "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": "2016-10-03T07:40:28+00:00" + }, + { + "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-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.9", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "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": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2017-02-26T11:10:40+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "1.4.11", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7", + "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7", + "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": "2017-02-27T10:12:30+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "5.7.21", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "3b91adfb64264ddec5a2dee9851f354aa66327db" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3b91adfb64264ddec5a2dee9851f354aa66327db", + "reference": "3b91adfb64264ddec5a2dee9851f354aa66327db", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "~1.3", + "php": "^5.6 || ^7.0", + "phpspec/prophecy": "^1.6.2", + "phpunit/php-code-coverage": "^4.0.4", + "phpunit/php-file-iterator": "~1.4", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": "^1.0.6", + "phpunit/phpunit-mock-objects": "^3.2", + "sebastian/comparator": "^1.2.4", + "sebastian/diff": "^1.4.3", + "sebastian/environment": "^1.3.4 || ^2.0", + "sebastian/exporter": "~2.0", + "sebastian/global-state": "^1.1", + "sebastian/object-enumerator": "~2.0", + "sebastian/resource-operations": "~1.0", + "sebastian/version": "~1.0.3|~2.0", + "symfony/yaml": "~2.1|~3.0" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "3.0.2" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-xdebug": "*", + "phpunit/php-invoker": "~1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.7.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": "2017-06-21T08:11:54+00:00" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "3.4.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "a23b761686d50a560cc56233b9ecf49597cc9118" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/a23b761686d50a560cc56233b9ecf49597cc9118", + "reference": "a23b761686d50a560cc56233b9ecf49597cc9118", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.6 || ^7.0", + "phpunit/php-text-template": "^1.2", + "sebastian/exporter": "^1.2 || ^2.0" + }, + "conflict": { + "phpunit/phpunit": "<5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.4" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.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": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2017-06-30T09:13:00+00:00" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "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": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2017-03-04T06:30:41+00:00" + }, + { + "name": "sebastian/comparator", + "version": "1.2.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2 || ~2.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" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "http://www.github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2017-01-29T09:50:25+00:00" + }, + { + "name": "sebastian/diff", + "version": "1.4.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "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": "2017-05-22T07:24:03+00:00" + }, + { + "name": "sebastian/environment", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.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": "2016-11-26T07:53:53+00:00" + }, + { + "name": "sebastian/exporter", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/recursion-context": "~2.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.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": "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": "2016-11-19T08:54:04+00:00" + }, + { + "name": "sebastian/finder-facade", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/finder-facade.git", + "reference": "2a6f7f57efc0aa2d23297d9fd9e2a03111a8c0b9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/finder-facade/zipball/2a6f7f57efc0aa2d23297d9fd9e2a03111a8c0b9", + "reference": "2a6f7f57efc0aa2d23297d9fd9e2a03111a8c0b9", + "shasum": "" + }, + "require": { + "symfony/finder": "~2.3|~3.0", + "theseer/fdomdocument": "~1.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": "FinderFacade is a convenience wrapper for Symfony's Finder component.", + "homepage": "https://github.com/sebastianbergmann/finder-facade", + "time": "2016-02-17T07:02:23+00:00" + }, + { + "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-12T03:26:01+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", + "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", + "shasum": "" + }, + "require": { + "php": ">=5.6", + "sebastian/recursion-context": "~2.0" + }, + "require-dev": { + "phpunit/phpunit": "~5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2017-02-18T15:18:39+00:00" + }, + { + "name": "sebastian/phpcpd", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpcpd.git", + "reference": "d7006078b75a34c9250831c3453a2e256a687615" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpcpd/zipball/d7006078b75a34c9250831c3453a2e256a687615", + "reference": "d7006078b75a34c9250831c3453a2e256a687615", + "shasum": "" + }, + "require": { + "php": "^5.6|^7.0", + "phpunit/php-timer": "^1.0.6", + "sebastian/finder-facade": "^1.1", + "sebastian/version": "^2.0", + "symfony/console": "^3.0" + }, + "bin": [ + "phpcpd" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-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": "Copy/Paste Detector (CPD) for PHP code.", + "homepage": "https://github.com/sebastianbergmann/phpcpd", + "time": "2017-02-05T07:48:01+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.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": "2016-11-19T07:33:16+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "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": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2015-07-28T20:34:47+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.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": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2016-10-03T07:35:21+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "2.9.1", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dcbed1074f8244661eecddfc2a675430d8d33f62", + "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "bin": [ + "scripts/phpcs", + "scripts/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "classmap": [ + "CodeSniffer.php", + "CodeSniffer/CLI.php", + "CodeSniffer/Exception.php", + "CodeSniffer/File.php", + "CodeSniffer/Fixer.php", + "CodeSniffer/Report.php", + "CodeSniffer/Reporting.php", + "CodeSniffer/Sniff.php", + "CodeSniffer/Tokens.php", + "CodeSniffer/Reports/", + "CodeSniffer/Tokenizers/", + "CodeSniffer/DocGenerators/", + "CodeSniffer/Standards/AbstractPatternSniff.php", + "CodeSniffer/Standards/AbstractScopeSniff.php", + "CodeSniffer/Standards/AbstractVariableSniff.php", + "CodeSniffer/Standards/IncorrectPatternException.php", + "CodeSniffer/Standards/Generic/Sniffs/", + "CodeSniffer/Standards/MySource/Sniffs/", + "CodeSniffer/Standards/PEAR/Sniffs/", + "CodeSniffer/Standards/PSR1/Sniffs/", + "CodeSniffer/Standards/PSR2/Sniffs/", + "CodeSniffer/Standards/Squiz/Sniffs/", + "CodeSniffer/Standards/Zend/Sniffs/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "http://www.squizlabs.com/php-codesniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2017-05-22T02:43:20+00:00" + }, + { + "name": "symfony/config", + "version": "v3.3.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/config.git", + "reference": "f9f19a39ee178f61bb2190f51ff7c517c2159315" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/config/zipball/f9f19a39ee178f61bb2190f51ff7c517c2159315", + "reference": "f9f19a39ee178f61bb2190f51ff7c517c2159315", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/filesystem": "~2.8|~3.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.3", + "symfony/finder": "<3.3" + }, + "require-dev": { + "symfony/dependency-injection": "~3.3", + "symfony/finder": "~3.3", + "symfony/yaml": "~3.0" + }, + "suggest": { + "symfony/yaml": "To use the yaml reference dumper" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Config\\": "" + }, + "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 Config Component", + "homepage": "https://symfony.com", + "time": "2017-09-04T16:28:07+00:00" + }, + { + "name": "symfony/dependency-injection", + "version": "v3.3.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/dependency-injection.git", + "reference": "e593f06dd90a81c7b70ac1c49862a061b0ec06d2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/e593f06dd90a81c7b70ac1c49862a061b0ec06d2", + "reference": "e593f06dd90a81c7b70ac1c49862a061b0ec06d2", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "psr/container": "^1.0" + }, + "conflict": { + "symfony/config": "<3.3.1", + "symfony/finder": "<3.3", + "symfony/yaml": "<3.3" + }, + "provide": { + "psr/container-implementation": "1.0" + }, + "require-dev": { + "symfony/config": "~3.3", + "symfony/expression-language": "~2.8|~3.0", + "symfony/yaml": "~3.3" + }, + "suggest": { + "symfony/config": "", + "symfony/expression-language": "For using expressions in service container configuration", + "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", + "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", + "symfony/yaml": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\DependencyInjection\\": "" + }, + "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 DependencyInjection Component", + "homepage": "https://symfony.com", + "time": "2017-09-05T20:39:38+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v3.3.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "54ca9520a00386f83bca145819ad3b619aaa2485" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/54ca9520a00386f83bca145819ad3b619aaa2485", + "reference": "54ca9520a00386f83bca145819ad3b619aaa2485", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "conflict": { + "symfony/dependency-injection": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0", + "symfony/dependency-injection": "~3.3", + "symfony/expression-language": "~2.8|~3.0", + "symfony/stopwatch": "~2.8|~3.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "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 EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2017-07-29T21:54:42+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v3.3.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "b32a0e5f928d0fa3d1dd03c78d020777e50c10cb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/b32a0e5f928d0fa3d1dd03c78d020777e50c10cb", + "reference": "b32a0e5f928d0fa3d1dd03c78d020777e50c10cb", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "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 Filesystem Component", + "homepage": "https://symfony.com", + "time": "2017-07-29T21:54:42+00:00" + }, + { + "name": "symfony/finder", + "version": "v3.3.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "b2260dbc80f3c4198f903215f91a1ac7fe9fe09e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/b2260dbc80f3c4198f903215f91a1ac7fe9fe09e", + "reference": "b2260dbc80f3c4198f903215f91a1ac7fe9fe09e", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "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 Finder Component", + "homepage": "https://symfony.com", + "time": "2017-07-29T21:54:42+00:00" + }, + { + "name": "symfony/options-resolver", + "version": "v3.3.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "ee4e22978fe885b54ee5da8c7964f0a5301abfb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/ee4e22978fe885b54ee5da8c7964f0a5301abfb6", + "reference": "ee4e22978fe885b54ee5da8c7964f0a5301abfb6", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "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 OptionsResolver Component", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "time": "2017-07-29T21:54:42+00:00" + }, + { + "name": "symfony/polyfill-php70", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php70.git", + "reference": "b6482e68974486984f59449ecea1fbbb22ff840f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/b6482e68974486984f59449ecea1fbbb22ff840f", + "reference": "b6482e68974486984f59449ecea1fbbb22ff840f", + "shasum": "" + }, + "require": { + "paragonie/random_compat": "~1.0|~2.0", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php70\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2017-06-14T15:44:48+00:00" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "8abc9097f5001d310f0edba727469c988acc6ea7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/8abc9097f5001d310f0edba727469c988acc6ea7", + "reference": "8abc9097f5001d310f0edba727469c988acc6ea7", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2017-07-11T13:25:55+00:00" + }, + { + "name": "symfony/process", + "version": "v3.3.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0", + "reference": "b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "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 Process Component", + "homepage": "https://symfony.com", + "time": "2017-07-29T21:54:42+00:00" + }, + { + "name": "symfony/stopwatch", + "version": "v3.3.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "9a5610a8d6a50985a7be485c0ba745c22607beeb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/9a5610a8d6a50985a7be485c0ba745c22607beeb", + "reference": "9a5610a8d6a50985a7be485c0ba745c22607beeb", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Stopwatch\\": "" + }, + "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 Stopwatch Component", + "homepage": "https://symfony.com", + "time": "2017-07-29T21:54:42+00:00" + }, + { + "name": "symfony/yaml", + "version": "v3.3.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "1d8c2a99c80862bdc3af94c1781bf70f86bccac0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/1d8c2a99c80862bdc3af94c1781bf70f86bccac0", + "reference": "1d8c2a99c80862bdc3af94c1781bf70f86bccac0", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "require-dev": { + "symfony/console": "~2.8|~3.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-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": "2017-07-29T21:54:42+00:00" + }, + { + "name": "theseer/fdomdocument", + "version": "1.6.6", + "source": { + "type": "git", + "url": "https://github.com/theseer/fDOMDocument.git", + "reference": "6e8203e40a32a9c770bcb62fe37e68b948da6dca" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/fDOMDocument/zipball/6e8203e40a32a9c770bcb62fe37e68b948da6dca", + "reference": "6e8203e40a32a9c770bcb62fe37e68b948da6dca", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "lib-libxml": "*", + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "lead" + } + ], + "description": "The classes contained within this repository extend the standard DOM to use exceptions at all occasions of errors instead of PHP warnings or notices. They also add various custom methods and shortcuts for convenience and to simplify the usage of DOM.", + "homepage": "https://github.com/theseer/fDOMDocument", + "time": "2017-06-30T11:53:12+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2016-11-23T20:04:58+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/phing/app.xml b/phing/app.xml new file mode 100644 index 0000000..2acceef --- /dev/null +++ b/phing/app.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/phing/properties.dist b/phing/properties.dist new file mode 100644 index 0000000..ae06943 --- /dev/null +++ b/phing/properties.dist @@ -0,0 +1,125 @@ +# -------------------------------------------------------------------------------- +# Information +# -------------------------------------------------------------------------------- + +# Property files contain key/value pairs +# key = value +# +# Property keys may contain alphanumeric chars and colons, but +# not special chars. This way you can create pseudo-namespaces +# +# You can refer to values of other properties by enclosing their keys in "${}". +# Example: dir.js = ${dir.web}/js +# +# Everything behind the equal sign is the value, you do +# not have to enclose strings: text=This is some text, Your OS is ${php.os} + +# -------------------------------------------------------------------------------- +# Common, e.g. default environment +# -------------------------------------------------------------------------------- + +# Default environment +# +env = dev + +# Install assets using symlinks +# +assets.installWithSymlink = true + +# Clear cache with the "warmup" option +# +cache.clearWithWarmup = true + +# -------------------------------------------------------------------------------- +# Composer +# -------------------------------------------------------------------------------- + +composer.download_command = php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));" + +# Path to composer executable or composer.phar file +# +composer.path = composer.phar +#composer.path = /usr/local/bin/composer + +# Path to php executable used by composer +# +composer.php = php + +# Self update of the composer +# +composer.self-update = false + +# Validate the composer.json file +# +composer.validate = false + +# -------------------------------------------------------------------------------- +# Directories +# -------------------------------------------------------------------------------- + +# System directories +# +dir.data = ${project.basedir}/data +dir.src = ${project.basedir}/src +dir.tests = ${project.basedir}/tests + +# -------------------------------------------------------------------------------- +# Build directories +# -------------------------------------------------------------------------------- + +dir.build = ${project.basedir}/build +dir.reports = ${dir.build}/logs +dir.reports.pdepend = ${dir.reports}/pdepend +dir.reports.coverage = ${dir.reports}/phpunit_coverage +# +# Disabled, because unnecessary right now +# phpdocumentor/phpdocumentor cannot be installed via Composer +# +# Krzysztof Niziol +# 2017-02-22 +# +#dir.docs = ${dir.build}/docs +#dir.docs.phpdoc2 = ${dir.docs}/phpdoc2 + +# -------------------------------------------------------------------------------- +# Data directories +# -------------------------------------------------------------------------------- + +dir.data.tests = ${dir.data}/tests +dir.data.temporary = ${dir.data}/tmp + +# -------------------------------------------------------------------------------- +# Testing +# -------------------------------------------------------------------------------- + +# Test database path +# +tests.database = ${dir.data.temporary}/database.sqlite + +# +# Disabled, because unnecessary right now +# PHPUnit is installed and loaded by Composer +# +# Krzysztof Niziol +# 2017-02-22 +# +# Run PHPUnit using exec task instead of phpunitTask +#phpunit.useExec = false + +# +# Disabled, because unnecessary right now +# We want generate code coverage always +# +# Krzysztof Niziol +# 2017-02-22 +# +# Collect coverage data during tests +#phpunit.withCoverage = true + +# Path of the PHPUnit (https://phpunit.de) +# +phpUnit.path = ./vendor/bin/phpunit + +# Path of the PHP Coding Standards Fixer (http://cs.sensiolabs.org) +# +phpCsFixer.path = ./vendor/bin/php-cs-fixer diff --git a/phing/tests.xml b/phing/tests.xml new file mode 100644 index 0000000..0ab44df --- /dev/null +++ b/phing/tests.xml @@ -0,0 +1,315 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..4c43916 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,35 @@ + + + + + + ./tests/ + + + + + + ./src/ + + + + + + performance + + + + + + + diff --git a/src/Meritoo/LimeSurvey/ApiClient/Base/Result/BaseItem.php b/src/Meritoo/LimeSurvey/ApiClient/Base/Result/BaseItem.php new file mode 100644 index 0000000..2389335 --- /dev/null +++ b/src/Meritoo/LimeSurvey/ApiClient/Base/Result/BaseItem.php @@ -0,0 +1,52 @@ + + * @copyright Meritoo.pl + */ +abstract class BaseItem +{ + /** + * Sets values in each property of the item + * + * @param array $data Data to set in properties of the item + * @return $this + */ + public function setValues($data) + { + /* + * Oops, no data + */ + if (empty($data)) { + return $this; + } + + /* + * Let's iterate through each property + */ + foreach ($data as $property => $value) { + $this->setValue($property, $value); + } + + return $this; + } + + /** + * Sets given value in given property + * + * @param string $property Name of property to set the value + * @param mixed $value Value to set in property + * @return mixed + */ + abstract public function setValue($property, $value); +} diff --git a/src/Meritoo/LimeSurvey/ApiClient/Client/Client.php b/src/Meritoo/LimeSurvey/ApiClient/Client/Client.php new file mode 100644 index 0000000..dcb97ad --- /dev/null +++ b/src/Meritoo/LimeSurvey/ApiClient/Client/Client.php @@ -0,0 +1,137 @@ + + * @copyright Meritoo.pl + */ +class Client +{ + /** + * Configuration used while connecting to LimeSurvey's API + * + * @var ConnectionConfiguration + */ + private $configuration; + + /** + * Manager of the JsonRPC client used while connecting to LimeSurvey's API + * + * @var JsonRpcClientManager + */ + private $rpcClientManager; + + /** + * Manager of session started while connecting to LimeSurvey's API + * + * @var SessionManager + */ + private $sessionManager; + + /** + * Class constructor + * + * @param ConnectionConfiguration $configuration Configuration used while connecting to LimeSurvey's API + * @param JsonRpcClientManager $rpcClientManager (optional) Manager of the JsonRPC client used while + * connecting to LimeSurvey's API + * @param SessionManager $sessionManager (optional) Manager of session started while connecting to + * LimeSurvey's API + */ + public function __construct( + ConnectionConfiguration $configuration, + JsonRpcClientManager $rpcClientManager = null, + SessionManager $sessionManager = null + ) { + $this->configuration = $configuration; + $this->rpcClientManager = $rpcClientManager; + $this->sessionManager = $sessionManager; + } + + /** + * Runs method with given name, arguments and returns result + * + * @param string $method Name of method to call. One of the MethodType class constants. + * @param array $arguments (optional) Arguments of the method to call + * @return Result + * + * @throws UnknownMethodException + * @throws UnknownInstanceOfResultItem + */ + public function run($method, $arguments = []) + { + /* + * Let's validate method + */ + $method = MethodType::getValidatedMethod($method); + + /* + * Prepare key of session + */ + $username = $this->configuration->getUsername(); + $password = $this->configuration->getPassword(); + + $sessionKey = $this + ->getSessionManager() + ->getSessionKey($username, $password); + + /* + * Use the session's key as of the method's arguments + */ + array_unshift($arguments, $sessionKey); + + /* + * Run the method, fetch raw data and finally prepare result + */ + $rawData = $this + ->getRpcClientManager() + ->runMethod($method, $arguments); + + return new Result($method, $rawData); + } + + /** + * Returns manager of the JsonRPC client used while connecting to LimeSurvey's API + * + * @return JsonRpcClientManager + */ + private function getRpcClientManager() + { + if (null === $this->rpcClientManager) { + $this->rpcClientManager = new JsonRpcClientManager($this->configuration); + } + + return $this->rpcClientManager; + } + + /** + * Returns manager of session started while connecting to LimeSurvey's API + * + * @return SessionManager + */ + private function getSessionManager() + { + if (null === $this->sessionManager) { + $rpcClientManager = $this->getRpcClientManager(); + $this->sessionManager = new SessionManager($rpcClientManager); + } + + return $this->sessionManager; + } +} diff --git a/src/Meritoo/LimeSurvey/ApiClient/Configuration/ConnectionConfiguration.php b/src/Meritoo/LimeSurvey/ApiClient/Configuration/ConnectionConfiguration.php new file mode 100644 index 0000000..0087f26 --- /dev/null +++ b/src/Meritoo/LimeSurvey/ApiClient/Configuration/ConnectionConfiguration.php @@ -0,0 +1,220 @@ + + * @copyright Meritoo.pl + */ +class ConnectionConfiguration +{ + /** + * Base url. + * Protocol & domain. + * + * Example: + * http://my-domain.com + * + * @var string + */ + private $baseUrl; + + /** + * Url of the LimeSurvey's remote control (without starting slash) + * + * @var string + */ + private $remoteControlUrl = 'admin/remotecontrol'; + + /** + * Name of user used to authenticate to LimeSurvey + * + * @var string + */ + private $username; + + /** + * Password used to authenticate to LimeSurvey + * + * @var string + */ + private $password; + + /** + * If is set to true, the "debug" mode is turned on. Otherwise - turned off. + * If turned on, more information is displayed. + * + * @var bool + */ + private $debugMode = false; + + /** + * Class constructor + * + * @param string $baseUrl Base url. Protocol & domain. + * @param string $username Name of user used to authenticate to LimeSurvey + * @param string $password Password used to authenticate to LimeSurvey + * @param bool $debugMode (optional) If is set to true, the "debug" mode is turned on. Otherwise - turned off. + */ + public function __construct($baseUrl, $username, $password, $debugMode = false) + { + $this + ->setBaseUrl($baseUrl) + ->setUsername($username) + ->setPassword($password) + ->setDebugMode($debugMode); + } + + /** + * Returns the base url, protocol & domain + * + * @return string + */ + public function getBaseUrl() + { + return $this->baseUrl; + } + + /** + * Sets the base url, protocol & domain + * + * @param string $baseUrl The base url, protocol & domain + * @return $this + * + * @throws InvalidUrlException + */ + public function setBaseUrl($baseUrl) + { + if (!Regex::isValidUrl($baseUrl)) { + throw new InvalidUrlException($baseUrl); + } + + if (Regex::endsWith($baseUrl, '/')) { + $baseUrl = substr($baseUrl, 0, strlen($baseUrl) - 1); + } + + $this->baseUrl = $baseUrl; + + return $this; + } + + /** + * Returns the url of the LimeSurvey's remote control + * + * @return string + */ + public function getRemoteControlUrl() + { + return $this->remoteControlUrl; + } + + /** + * Sets the url of the LimeSurvey's remote control + * + * @param string $remoteControlUrl Url of the LimeSurvey's remote control + * @return $this + */ + public function setRemoteControlUrl($remoteControlUrl) + { + $this->remoteControlUrl = $remoteControlUrl; + + return $this; + } + + /** + * Returns the name of user used to authenticate to LimeSurvey + * + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * Sets the name of user used to authenticate to LimeSurvey + * + * @param string $username The name of user used to authenticate to LimeSurvey + * @return $this + */ + public function setUsername($username) + { + $this->username = $username; + + return $this; + } + + /** + * Returns the password used to authenticate to LimeSurvey + * + * @return string + */ + public function getPassword() + { + return $this->password; + } + + /** + * Sets the password used to authenticate to LimeSurvey + * + * @param string $password The password used to authenticate to LimeSurvey + * @return $this + */ + public function setPassword($password) + { + $this->password = $password; + + return $this; + } + + /** + * Returns information if the "debug" mode is turned on + * + * @return bool + */ + public function isDebugModeOn() + { + return $this->debugMode; + } + + /** + * Sets information if the "debug" mode is turned on + * + * @param bool $debugMode (optional) If is set to true, the "debug" mode is turned on. Otherwise - turned off. + * @return $this + */ + public function setDebugMode($debugMode = false) + { + $this->debugMode = $debugMode; + + return $this; + } + + /* + * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + * Additional / extra methods (neither getters, nor setters) + * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + */ + + /** + * Returns full url of the LimeSurvey's API. + * It's a base url with part related to remote control. + * + * @return string + */ + public function getFullUrl() + { + return sprintf('%s/%s', $this->baseUrl, $this->remoteControlUrl); + } +} diff --git a/src/Meritoo/LimeSurvey/ApiClient/Exception/CreateSessionKeyFailedException.php b/src/Meritoo/LimeSurvey/ApiClient/Exception/CreateSessionKeyFailedException.php new file mode 100644 index 0000000..e326b72 --- /dev/null +++ b/src/Meritoo/LimeSurvey/ApiClient/Exception/CreateSessionKeyFailedException.php @@ -0,0 +1,36 @@ + + * @copyright Meritoo.pl + */ +class CreateSessionKeyFailedException extends Exception +{ + /** + * Class constructor + * + * @param string $reason (optional) Reason of failure, e.g. "Invalid user name or password" + */ + public function __construct($reason = '') + { + $message = 'Create of the session key has failed'; + + if (!empty($reason)) { + $message = sprintf('%s. Reason: \'%s\'.', $message, $reason); + } + + parent::__construct($message); + } +} diff --git a/src/Meritoo/LimeSurvey/ApiClient/Exception/UnknownInstanceOfResultItem.php b/src/Meritoo/LimeSurvey/ApiClient/Exception/UnknownInstanceOfResultItem.php new file mode 100644 index 0000000..550ab1f --- /dev/null +++ b/src/Meritoo/LimeSurvey/ApiClient/Exception/UnknownInstanceOfResultItem.php @@ -0,0 +1,30 @@ + + * @copyright Meritoo.pl + */ +class UnknownInstanceOfResultItem extends Exception +{ + /** + * Class constructor + * + * @param string $method Name of called method while talking to the LimeSurvey's API. One of the MethodType class + * constants. + */ + public function __construct($method) + { + $template = 'Instance of one item used by result the of \'%s\' LimeSurvey API\'s method is unknown. Proper' + . ' class is not mapped in %s::%s() method. Did you forget about this?'; + + $message = sprintf($template, $method, ResultProcessor::class, 'getItemInstance'); + parent::__construct($message); + } +} diff --git a/src/Meritoo/LimeSurvey/ApiClient/Exception/UnknownMethodException.php b/src/Meritoo/LimeSurvey/ApiClient/Exception/UnknownMethodException.php new file mode 100644 index 0000000..a207bd7 --- /dev/null +++ b/src/Meritoo/LimeSurvey/ApiClient/Exception/UnknownMethodException.php @@ -0,0 +1,29 @@ + + * @copyright Meritoo.pl + */ +class UnknownMethodException extends UnknownTypeException +{ + /** + * {@inheritdoc} + */ + public function __construct($unknownType) + { + parent::__construct($unknownType, new MethodType(), 'name of method used while talking to the LimeSurvey\'s API'); + } +} diff --git a/src/Meritoo/LimeSurvey/ApiClient/Manager/JsonRpcClientManager.php b/src/Meritoo/LimeSurvey/ApiClient/Manager/JsonRpcClientManager.php new file mode 100644 index 0000000..64047f3 --- /dev/null +++ b/src/Meritoo/LimeSurvey/ApiClient/Manager/JsonRpcClientManager.php @@ -0,0 +1,84 @@ + + * @copyright Meritoo.pl + */ +class JsonRpcClientManager +{ + /** + * Configuration used while connecting to LimeSurvey's API + * + * @var ConnectionConfiguration + */ + private $connectionConfiguration; + + /** + * The JsonRPC client used while connecting to LimeSurvey's API + * + * @var RpcClient + */ + private $rpcClient; + + /** + * Class constructor + * + * @param ConnectionConfiguration $configuration Configuration used while connecting to LimeSurvey's API + */ + public function __construct(ConnectionConfiguration $configuration) + { + $this->connectionConfiguration = $configuration; + } + + /** + * Runs given method with given arguments and returns raw data + * + * @param string $method Name of method to call. One of the MethodType class constants. + * @param array $arguments (optional) Arguments of the method to call + * @return mixed + * + * @throws UnknownMethodException + */ + public function runMethod($method, $arguments = []) + { + $method = MethodType::getValidatedMethod($method); + + return $this + ->getRpcClient() + ->execute($method, $arguments); + } + + /** + * Returns the JsonRPC client used while connecting to LimeSurvey's API + * + * @return RpcClient + */ + protected function getRpcClient() + { + if (null === $this->rpcClient) { + /* + * Let's prepare the JsonRPC Client + */ + $url = $this->connectionConfiguration->getFullUrl(); + $this->rpcClient = new RpcClient($url); + + /* + * The "debug" mode is turned on? + */ + if ($this->connectionConfiguration->isDebugModeOn()) { + $this->rpcClient->getHttpClient()->withDebug(); + } + } + + return $this->rpcClient; + } +} diff --git a/src/Meritoo/LimeSurvey/ApiClient/Manager/SessionManager.php b/src/Meritoo/LimeSurvey/ApiClient/Manager/SessionManager.php new file mode 100644 index 0000000..ff03b4b --- /dev/null +++ b/src/Meritoo/LimeSurvey/ApiClient/Manager/SessionManager.php @@ -0,0 +1,115 @@ + + * @copyright Meritoo.pl + */ +class SessionManager +{ + /** + * The session key. + * Used to authenticate user while connecting to LimeSurvey's API. + * + * @var string + */ + private $sessionKey; + + /** + * Manager of the JsonRPC client used while connecting to LimeSurvey's API + * + * @var JsonRpcClientManager + */ + private $rpcClientManager; + + /** + * Class constructor + * + * @param JsonRpcClientManager $rpcClientManager Manager of the JsonRPC client used while connecting to + * LimeSurvey's API + */ + public function __construct(JsonRpcClientManager $rpcClientManager) + { + $this->rpcClientManager = $rpcClientManager; + } + + /** + * Class destructor + */ + public function __destruct() + { + $this->releaseSessionKey(); + } + + /** + * Returns key/id of session used while connecting to LimeSurvey's API + * + * @param string $username Name of user used to authenticate to LimeSurvey + * @param string $password Password used to authenticate to LimeSurvey + * @return string + * + * @throws CreateSessionKeyFailedException + */ + public function getSessionKey($username, $password) + { + if (null === $this->sessionKey) { + $arguments = [ + $username, + $password, + ]; + + /* + * Let's fetch the key/id of session + */ + $this->sessionKey = $this + ->rpcClientManager + ->runMethod(SystemMethodType::GET_SESSION_KEY, $arguments); + + /* + * Oops, something is broken + */ + if (is_array($this->sessionKey)) { + $reason = ''; + + /* + * The "status" is provided? + * It's a reason of failure + */ + if (isset($this->sessionKey['status'])) { + $reason = $this->sessionKey['status']; + } + + throw new CreateSessionKeyFailedException($reason); + } + } + + return $this->sessionKey; + } + + /** + * Releases key/id of session and closes the RPC session + * + * @return $this + */ + public function releaseSessionKey() + { + $arguments = [ + $this->sessionKey, + ]; + + /* + * Let's release the key/id of session + */ + $this + ->rpcClientManager + ->runMethod(SystemMethodType::RELEASE_SESSION_KEY, $arguments); + + return $this; + } +} diff --git a/src/Meritoo/LimeSurvey/ApiClient/Result/Item/Participant.php b/src/Meritoo/LimeSurvey/ApiClient/Result/Item/Participant.php new file mode 100644 index 0000000..44e6e80 --- /dev/null +++ b/src/Meritoo/LimeSurvey/ApiClient/Result/Item/Participant.php @@ -0,0 +1,397 @@ + + * @copyright Meritoo.pl + */ +class Participant extends BaseItem +{ + /** + * ID of the participant + * + * @var int + */ + private $id; + + /** + * Another ID of the participant? + * Don't know where it is used. + * + * @var int + */ + private $participantId; + + /** + * MP ID + * + * @var int + */ + private $mpId; + + /** + * First name of the participant + * + * @var string + */ + private $firstName; + + /** + * Last name of the participant + * + * @var string + */ + private $lastName; + + /** + * E-mail of the participant + * + * @var string + */ + private $email; + + /** + * Status of the e-mail + * + * @var string + */ + private $emailStatus; + + /** + * Token of the participant + * + * @var string + */ + private $token; + + /** + * Language of the participant + * + * @var string + */ + private $language; + + /** + * Information if participant is blacklisted + * + * @var bool + */ + private $blacklisted; + + /** + * Information if token was sent to participant/user + * + * @var bool + */ + private $sent; + + /** + * Information if reminder about token was sent to participant/user + * + * @var bool + */ + private $reminderSent; + + /** + * Count of sent reminders to participant/user + * + * @var int + */ + private $reminderCount; + + /** + * Information if the participant has completed the survey + * + * @var bool + */ + private $completed; + + /** + * Count of left uses of the token + * + * @var int + */ + private $usesLeft; + + /** + * Information from which day the token is valid + * + * @var DateTime + */ + private $validFrom; + + /** + * Information until which day the token is valid + * + * @var DateTime + */ + private $validUntil; + + /** + * {@inheritdoc} + */ + public function setValue($property, $value) + { + switch ($property) { + case 'tid': + $this->id = (int)$value; + break; + + case 'participant_id': + $this->participantId = (int)$value; + break; + + case 'mpid': + $this->mpId = (int)$value; + break; + + case 'firstname': + $this->firstName = trim($value); + break; + + case 'lastname': + $this->lastName = trim($value); + break; + + case 'email': + $this->email = trim($value); + break; + + case 'emailstatus': + $this->emailStatus = trim($value); + break; + + case 'token': + $this->token = trim($value); + break; + + case 'language': + $this->language = trim($value); + break; + + case 'blacklisted': + $this->blacklisted = 'Y' === trim($value); + break; + + case 'sent': + $this->sent = 'Y' === trim($value); + break; + + case 'remindersent': + $this->reminderSent = 'Y' === trim($value); + break; + + case 'remindercount': + $this->reminderCount = (int)$value; + break; + + case 'completed': + $this->completed = 'Y' === trim($value); + break; + + case 'usesleft': + $this->usesLeft = (int)$value; + break; + + case 'validfrom': + if (null === $value) { + break; + } + + $this->validFrom = Date::getDateTime($value, false, 'Y-m-d H:i:s'); + break; + + case 'validuntil': + if (null === $value) { + break; + } + + $this->validUntil = Date::getDateTime($value, false, 'Y-m-d H:i:s'); + break; + } + } + + /** + * Returns ID of the participant + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Returns another ID of the participant? + * Don't know where it is used. + * + * @return int + */ + public function getParticipantId() + { + return $this->participantId; + } + + /** + * Returns MP ID + * + * @return int + */ + public function getMpId() + { + return $this->mpId; + } + + /** + * Returns first name of the participant + * + * @return string + */ + public function getFirstName() + { + return $this->firstName; + } + + /** + * Returns last name of the participant + * + * @return string + */ + public function getLastName() + { + return $this->lastName; + } + + /** + * Returns e-mail of the participant + * + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * Returns status of the e-mail + * + * @return string + */ + public function getEmailStatus() + { + return $this->emailStatus; + } + + /** + * Returns token of the participant + * + * @return string + */ + public function getToken() + { + return $this->token; + } + + /** + * Returns language of the participant + * + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * Returns information if participant is blacklisted + * + * @return bool + */ + public function isBlacklisted() + { + return $this->blacklisted; + } + + /** + * Returns information if token was sent to participant/user + * + * @return bool + */ + public function isSent() + { + return $this->sent; + } + + /** + * Returns information if reminder about token was sent to participant/user + * + * @return bool + */ + public function isReminderSent() + { + return $this->reminderSent; + } + + /** + * Returns count of sent reminders to participant/user + * + * @return int + */ + public function getReminderCount() + { + return $this->reminderCount; + } + + /** + * Returns information if the participant has completed the survey + * + * @return bool + */ + public function isCompleted() + { + return $this->completed; + } + + /** + * Returns count of left uses of the token + * + * @return int + */ + public function getUsesLeft() + { + return $this->usesLeft; + } + + /** + * Returns information from which day the token is valid + * + * @return DateTime + */ + public function getValidFrom() + { + return $this->validFrom; + } + + /** + * Returns information until which day the token is valid + * + * @return DateTime + */ + public function getValidUntil() + { + return $this->validUntil; + } +} diff --git a/src/Meritoo/LimeSurvey/ApiClient/Result/Item/ParticipantShort.php b/src/Meritoo/LimeSurvey/ApiClient/Result/Item/ParticipantShort.php new file mode 100644 index 0000000..e676877 --- /dev/null +++ b/src/Meritoo/LimeSurvey/ApiClient/Result/Item/ParticipantShort.php @@ -0,0 +1,106 @@ + + * @copyright Meritoo.pl + */ +class ParticipantShort extends BaseItem +{ + /** + * ID of the participant + * + * @var int + */ + private $id; + + /** + * First name of the participant + * + * @var string + */ + private $firstName; + + /** + * Last name of the participant + * + * @var string + */ + private $lastName; + + /** + * E-mail of the participant + * + * @var string + */ + private $email; + + /** + * {@inheritdoc} + */ + public function setValue($property, $value) + { + switch ($property) { + case 'tid': + $this->id = (int)$value; + break; + + case 'participant_info': + $this->firstName = trim($value['firstname']); + $this->lastName = trim($value['lastname']); + $this->email = trim($value['email']); + break; + } + } + + /** + * Returns ID of the participant + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Returns first name of the participant + * + * @return string + */ + public function getFirstName() + { + return $this->firstName; + } + + /** + * Returns last name of the participant + * + * @return string + */ + public function getLastName() + { + return $this->lastName; + } + + /** + * Returns e-mail of the participant + * + * @return string + */ + public function getEmail() + { + return $this->email; + } +} diff --git a/src/Meritoo/LimeSurvey/ApiClient/Result/Item/Question.php b/src/Meritoo/LimeSurvey/ApiClient/Result/Item/Question.php new file mode 100644 index 0000000..3270998 --- /dev/null +++ b/src/Meritoo/LimeSurvey/ApiClient/Result/Item/Question.php @@ -0,0 +1,153 @@ + + * @copyright Meritoo.pl + */ +class Question extends QuestionShort +{ + /** + * Available answers + * + * @var array + */ + private $availableAnswers; + + /** + * Sub-questions + * @var array + */ + private $subQuestions; + + /** + * Attributes + * + * @var array + */ + private $attributes; + + /** + * Attributes in languages + * + * @var array + */ + private $attributesLanguages; + + /** + * Answer's options + * + * @var array + */ + private $answerOptions; + + /** + * Default value + * + * @var string + */ + private $defaultValue; + + /** + * {@inheritdoc} + */ + public function setValue($property, $value) + { + parent::setValue($property, $value); + + switch ($property) { + case 'available_answers': + $this->availableAnswers = $value; + break; + + case 'subquestions': + $this->subQuestions = $value; + break; + + case 'attributes': + $this->attributes = $value; + break; + + case 'attributes_lang': + $this->attributesLanguages = $value; + break; + + case 'answeroptions': + $this->answerOptions = $value; + break; + + case 'defaultvalue': + $this->defaultValue = $value; + break; + } + } + + /** + * Returns available answers + * + * @return array + */ + public function getAvailableAnswers() + { + return $this->availableAnswers; + } + + /** + * Returns sub-questions + * + * @return array + */ + public function getSubQuestions() + { + return $this->subQuestions; + } + + /** + * Returns attributes + * + * @return array + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * Returns attributes in languages + * + * @return array + */ + public function getAttributesLanguages() + { + return $this->attributesLanguages; + } + + /** + * Returns answer's options + * + * @return array + */ + public function getAnswerOptions() + { + return $this->answerOptions; + } + + /** + * Returns default value + * + * @return string + */ + public function getDefaultValue() + { + return $this->defaultValue; + } +} diff --git a/src/Meritoo/LimeSurvey/ApiClient/Result/Item/QuestionShort.php b/src/Meritoo/LimeSurvey/ApiClient/Result/Item/QuestionShort.php new file mode 100644 index 0000000..1228964 --- /dev/null +++ b/src/Meritoo/LimeSurvey/ApiClient/Result/Item/QuestionShort.php @@ -0,0 +1,398 @@ + + * @copyright Meritoo.pl + */ +class QuestionShort extends BaseItem +{ + /** + * ID of the question + * + * @var int + */ + private $id; + + /** + * ID of the parent question + * + * @var int + */ + private $parentId; + + /** + * ID of the survey + * + * @var int + */ + private $surveyId; + + /** + * ID of the group of questions + * + * @var int + */ + private $groupId; + + /** + * ID of the scale + * (what does it mean?) + * + * @var int + */ + private $scaleId; + + /** + * Type of the question + * + * @var string + */ + private $type; + + /** + * Title of the question + * + * @var string + */ + private $title; + + /** + * Content of the question + * + * @var string + */ + private $content; + + /** + * Explanation of the question + * + * @var string + */ + private $contentHelp; + + /** + * Regular expression + * (what does it mean? used to validate answer?) + * + * @var string + */ + private $regularExpression; + + /** + * Information if type of question is other + * (what does it mean?) + * + * @var bool + */ + private $other; + + /** + * Information if the question mandatory + * + * @var bool + */ + private $mandatory; + + /** + * Position/Order of the question + * + * @var int + */ + private $position; + + /** + * Language of the question + * + * @var string + */ + private $language; + + /** + * Same as default + * (what does it mean?) + * + * @var int + */ + private $sameDefault; + + /** + * Relevant equation + * + * @var string + */ + private $relevance; + + /** + * Name of module + * (what does it mean?) + * + * @var string + */ + private $moduleName; + + /** + * {@inheritdoc} + */ + public function setValue($property, $value) + { + switch ($property) { + case 'qid': + $this->id = (int)$value; + break; + + case 'parent_qid': + $this->parentId = (int)$value; + break; + + case 'sid': + $this->surveyId = (int)$value; + break; + + case 'gid': + $this->groupId = (int)$value; + break; + + case 'scale_id': + $this->scaleId = (int)$value; + break; + + case 'type': + $this->type = trim($value); + break; + + case 'title': + $this->title = trim($value); + break; + + case 'question': + $this->content = trim($value); + break; + + case 'help': + $this->contentHelp = trim($value); + break; + + case 'preg': + if (null === $value) { + break; + } + + $this->regularExpression = trim($value); + break; + + case 'other': + $this->other = 'Y' === trim($value); + break; + + case 'mandatory': + $this->mandatory = 'Y' === trim($value); + break; + + case 'question_order': + $this->position = (int)$value; + break; + + case 'language': + $this->language = trim($value); + break; + + case 'same_default': + $this->sameDefault = (int)$value; + break; + + case 'relevance': + $this->relevance = trim($value); + break; + + case 'modulename': + if (null === $value) { + break; + } + + $this->moduleName = trim($value); + break; + } + } + + /** + * Returns ID of the question + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Returns ID of the parent question + * + * @return int + */ + public function getParentId() + { + return $this->parentId; + } + + /** + * Returns ID of the survey + * + * @return int + */ + public function getSurveyId() + { + return $this->surveyId; + } + + /** + * Returns ID of the group of questions + * + * @return int + */ + public function getGroupId() + { + return $this->groupId; + } + + /** + * Returns ID of the scale + * + * @return int + */ + public function getScaleId() + { + return $this->scaleId; + } + + /** + * Returns type of the question + * + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Returns title of the question + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Returns content of the question + * + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Returns explanation of the question + * + * @return string + */ + public function getContentHelp() + { + return $this->contentHelp; + } + + /** + * Returns regular expression + * + * @return string + */ + public function getRegularExpression() + { + return $this->regularExpression; + } + + /** + * Returns information if type of question is other + * + * @return bool + */ + public function isOther() + { + return $this->other; + } + + /** + * Returns information if the question mandatory + * + * @return bool + */ + public function isMandatory() + { + return $this->mandatory; + } + + /** + * Returns position/Order of the question + * + * @return int + */ + public function getPosition() + { + return $this->position; + } + + /** + * Returns language of the question + * + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * Returns information related to same as default + * + * @return int + */ + public function getSameDefault() + { + return $this->sameDefault; + } + + /** + * Returns relevant equation + * + * @return string + */ + public function getRelevance() + { + return $this->relevance; + } + + /** + * Returns name of module + * + * @return string + */ + public function getModuleName() + { + return $this->moduleName; + } +} diff --git a/src/Meritoo/LimeSurvey/ApiClient/Result/Item/Survey.php b/src/Meritoo/LimeSurvey/ApiClient/Result/Item/Survey.php new file mode 100644 index 0000000..1dc64e7 --- /dev/null +++ b/src/Meritoo/LimeSurvey/ApiClient/Result/Item/Survey.php @@ -0,0 +1,143 @@ + + * @copyright Meritoo.pl + */ +class Survey extends BaseItem +{ + /** + * ID of the survey + * + * @var int + */ + private $id; + + /** + * Title of the survey + * + * @var string + */ + private $title; + + /** + * Date when the survey starts + * + * @var DateTime + */ + private $startsAt; + + /** + * Date when the survey expires + * + * @var DateTime + */ + private $expiresAt; + + /** + * Information if the survey is active + * + * @var bool + */ + private $active = false; + + /** + * {@inheritdoc} + */ + public function setValue($property, $value) + { + switch ($property) { + case 'sid': + $this->id = (int)$value; + break; + + case 'surveyls_title': + $this->title = trim($value); + break; + + case 'startdate': + if (null === $value) { + break; + } + + $this->startsAt = Date::getDateTime($value, false, 'Y-m-d H:i:s'); + break; + + case 'expires': + if (null === $value) { + break; + } + + $this->expiresAt = Date::getDateTime($value, false, 'Y-m-d H:i:s'); + break; + + case 'active': + $this->active = 'Y' === trim($value); + break; + } + } + + /** + * Returns ID of the survey + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Returns title of the survey + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Returns date when the survey starts + * + * @return DateTime|null + */ + public function getStartsAt() + { + return $this->startsAt; + } + + /** + * Returns date when the survey expires + * + * @return DateTime|null + */ + public function getExpiresAt() + { + return $this->expiresAt; + } + + /** + * Returns information if the survey is active + * + * @return bool + */ + public function isActive() + { + return $this->active; + } +} diff --git a/src/Meritoo/LimeSurvey/ApiClient/Result/Processor/ResultProcessor.php b/src/Meritoo/LimeSurvey/ApiClient/Result/Processor/ResultProcessor.php new file mode 100644 index 0000000..2d13850 --- /dev/null +++ b/src/Meritoo/LimeSurvey/ApiClient/Result/Processor/ResultProcessor.php @@ -0,0 +1,118 @@ + + * @copyright Meritoo.pl + */ +class ResultProcessor +{ + /** + * Returns processed data based on the raw data returned by the LimeSurvey's API + * + * @param string $method Name of called method while talking to the LimeSurvey's API. One of the MethodType + * class constants. + * @param array $rawData Data returned by the LimeSurvey's API + * @return null|BaseItem|array + */ + public function process($method, array $rawData) + { + $method = MethodType::getValidatedMethod($method); + + /* + * No data? + * Nothing to do + */ + if (empty($rawData)) { + return null; + } + + /* + * Prepare instance of one item + */ + $item = $this->getItemInstance($method); + + /* + * The raw data is or, actually, should be iterable? + */ + if (MethodType::isResultIterable($method)) { + $items = []; + $emptyItem = clone $item; + + foreach ($rawData as $itemData) { + $items[] = $emptyItem->setValues($itemData); + } + + return $items; + } + + return $item->setValues($rawData); + } + + /** + * Returns instance of one item of the result + * + * @param string $method Name of called method while talking to the LimeSurvey's API. One of the MethodType + * class constants. + * @return BaseItem + * @throws UnknownInstanceOfResultItem + */ + private function getItemInstance($method) + { + $item = null; + $method = MethodType::getValidatedMethod($method); + + switch ($method) { + case MethodType::GET_PARTICIPANT_PROPERTIES: + $item = new Participant(); + break; + + case MethodType::GET_QUESTION_PROPERTIES: + $item = new Question(); + break; + + case MethodType::LIST_PARTICIPANTS: + $item = new ParticipantShort(); + break; + + case MethodType::LIST_QUESTIONS: + $item = new QuestionShort(); + break; + + case MethodType::LIST_SURVEYS: + $item = new Survey(); + break; + + /* + * todo: Use other types of methods and create proper classes (used to get instances of one item) + */ + } + + /* + * Instance of the item is unknown? + */ + if (null === $item) { + throw new UnknownInstanceOfResultItem($method); + } + + return $item; + } +} diff --git a/src/Meritoo/LimeSurvey/ApiClient/Result/Result.php b/src/Meritoo/LimeSurvey/ApiClient/Result/Result.php new file mode 100644 index 0000000..5ef346b --- /dev/null +++ b/src/Meritoo/LimeSurvey/ApiClient/Result/Result.php @@ -0,0 +1,122 @@ + + * @copyright Meritoo.pl + */ +class Result +{ + /** + * Name of called method while talking to the LimeSurvey's API. One of the MethodType class constants. + * + * @var string + */ + private $method; + + /** + * Raw data returned by the LimeSurvey's API + * + * @var array + */ + private $rawData; + + /** + * Processor of the raw data fetched while talking to the LimeSurvey's API + * + * @var ResultProcessor + */ + private $resultProcessor; + + /** + * Class constructor + * + * @param string $method Name of called method while talking to the LimeSurvey's API. One of the MethodType + * class constants. + * @param array $rawData Raw data returned by the LimeSurvey's API + */ + public function __construct($method, array $rawData) + { + $this->method = MethodType::getValidatedMethod($method); + $this->rawData = $rawData; + } + + /** + * Returns information if the result contains any data + * + * @return bool + */ + public function isEmpty() + { + return empty($this->rawData); + } + + /** + * Returns data returned by the LimeSurvey's API + * + * @param bool $raw (optional) If is set to true, raw data provided by the LimeSurvey's API will be returned. + * Otherwise - prepared/processed. + * @return array|Collection|BaseItem + */ + public function getData($raw = false) + { + if ($raw) { + return $this->rawData; + } + + return $this->getProcessedData($this->rawData); + } + + /** + * Returns processed data based on the raw data returned by the LimeSurvey's API + * + * @param array $rawData Raw data returned by the LimeSurvey's API + * @return Collection|BaseItem + */ + private function getProcessedData(array $rawData) + { + $processed = $this + ->getResultProcessor() + ->process($this->method, $rawData); + + if (null === $processed || is_array($processed)) { + $collection = new Collection(); + + if (is_array($processed)) { + $collection->addMultiple($processed); + } + + return $collection; + } + + return $processed; + } + + /** + * Returns processor of the raw data fetched while talking to the LimeSurvey's API + * + * @return ResultProcessor + */ + private function getResultProcessor() + { + if (null === $this->resultProcessor) { + $this->resultProcessor = new ResultProcessor(); + } + + return $this->resultProcessor; + } +} diff --git a/src/Meritoo/LimeSurvey/ApiClient/Type/MethodType.php b/src/Meritoo/LimeSurvey/ApiClient/Type/MethodType.php new file mode 100644 index 0000000..499222f --- /dev/null +++ b/src/Meritoo/LimeSurvey/ApiClient/Type/MethodType.php @@ -0,0 +1,113 @@ + + * @copyright Meritoo.pl + */ +class MethodType extends BaseType +{ + /** + * Add a response to the survey responses collection. + * Returns the id of the inserted survey response. + * + * @var string + */ + const ADD_RESPONSE = 'add_response'; + + /** + * Export statistics of a survey to a user + * + * @var string + */ + const EXPORT_STATISTICS = 'export_statistics'; + + /** + * Get settings of a token/participant of a survey + * + * @var string + */ + const GET_PARTICIPANT_PROPERTIES = 'get_participant_properties'; + + /** + * Get properties of a question in a survey + * + * @var string + */ + const GET_QUESTION_PROPERTIES = 'get_question_properties'; + + /** + * Return the IDs and properties of token/participants of a survey + * + * @var string + */ + const LIST_PARTICIPANTS = 'list_participants'; + + /** + * Return the ids and info of (sub-)questions of a survey/group + * + * @var string + */ + const LIST_QUESTIONS = 'list_questions'; + + /** + * List the surveys belonging to a user + * + * @var string + */ + const LIST_SURVEYS = 'list_surveys'; + + /** + * Get list the ids and info of users + * + * @var string + */ + const LIST_USERS = 'list_users'; + + /** + * Returns validated name of method to call or throws an exception (if method is incorrect) + * + * @param string $method Name of method to call. One of this class constants. + * @return string + * + * @throws UnknownMethodException + */ + public static function getValidatedMethod($method) + { + if ((new static())->isCorrectType($method)) { + return $method; + } + + throw new UnknownMethodException($method); + } + + /** + * Returns information if result provided by the API is iterable + * + * @param string $method Name of called method while talking to the LimeSurvey's API. One of this class constants. + * @return bool + */ + public static function isResultIterable($method) + { + $method = static::getValidatedMethod($method); + + return in_array($method, [ + static::LIST_PARTICIPANTS, + static::LIST_QUESTIONS, + static::LIST_SURVEYS, + static::LIST_USERS, + ]); + } +} diff --git a/src/Meritoo/LimeSurvey/ApiClient/Type/SystemMethodType.php b/src/Meritoo/LimeSurvey/ApiClient/Type/SystemMethodType.php new file mode 100644 index 0000000..9e1b2aa --- /dev/null +++ b/src/Meritoo/LimeSurvey/ApiClient/Type/SystemMethodType.php @@ -0,0 +1,34 @@ + + * @copyright Meritoo.pl + */ +class SystemMethodType extends BaseType +{ + /** + * Create and return a session key + * + * @var string + */ + const GET_SESSION_KEY = 'get_session_key'; + + /** + * Close the RPC session + * + * @var string + */ + const RELEASE_SESSION_KEY = 'release_session_key'; +} diff --git a/tests/Meritoo/LimeSurvey/Test/ApiClient/Base/Result/BaseItemTest.php b/tests/Meritoo/LimeSurvey/Test/ApiClient/Base/Result/BaseItemTest.php new file mode 100644 index 0000000..c3defff --- /dev/null +++ b/tests/Meritoo/LimeSurvey/Test/ApiClient/Base/Result/BaseItemTest.php @@ -0,0 +1,55 @@ + + * @copyright Meritoo.pl + */ +class BaseItemTest extends PHPUnit_Framework_TestCase +{ + public function testConstructorVisibilityAndArguments() + { + $reflection = new ReflectionClass(BaseItem::class); + $constructor = $reflection->getConstructor(); + + static::assertNull($constructor); + } + + public function testSetValues() + { + $mock = $this->getBaseItemMock(); + + static::assertInstanceOf(BaseItem::class, $mock->setValues([])); + static::assertInstanceOf(BaseItem::class, $mock->setValues(['lorem'])); + } + + /** + * Returns mock of the tested class + * + * @return BaseItem + */ + private function getBaseItemMock() + { + $mock = $this->getMockForAbstractClass(BaseItem::class); + + $mock + ->expects(static::any()) + ->method('setValue') + ->willReturn(null); + + return $mock; + } +} diff --git a/tests/Meritoo/LimeSurvey/Test/ApiClient/Client/ClientTest.php b/tests/Meritoo/LimeSurvey/Test/ApiClient/Client/ClientTest.php new file mode 100644 index 0000000..7cfb6d3 --- /dev/null +++ b/tests/Meritoo/LimeSurvey/Test/ApiClient/Client/ClientTest.php @@ -0,0 +1,140 @@ + + * @copyright Meritoo.pl + */ +class ClientTest extends BaseTestCase +{ + /** + * Configuration used while connecting to LimeSurvey's API + * + * @var ConnectionConfiguration + */ + private $configuration; + + /** + * @param string $incorrectMethod Incorrect name of method to call + * @dataProvider provideIncorrectMethod + */ + public function testRunWithIncorrectMethod($incorrectMethod) + { + $this->expectException(UnknownMethodException::class); + + $client = new Client($this->configuration); + $client->run($incorrectMethod); + } + + /** + * @param string $method Name of method to call + * @param array $arguments Arguments of the method to call + * @param bool $debugMode If is set to true, the "debug" mode is turned on. Otherwise - turned off. + * + * @dataProvider provideMethod + */ + public function testRun($method, $arguments, $debugMode) + { + $sessionManager = $this->createMock(SessionManager::class); + $rpcClientManager = $this->createMock(JsonRpcClientManager::class); + + $rpcClientManager + ->expects(static::any()) + ->method('runMethod') + ->willReturn([]); + + $this->configuration->setDebugMode($debugMode); + $client = new Client($this->configuration, $rpcClientManager, $sessionManager); + + static::assertInstanceOf(Result::class, $client->run($method, $arguments)); + } + + public function testGetRpcClientManagerVisibilityAndArguments() + { + $this->verifyMethodVisibilityAndArguments(Client::class, 'getRpcClientManager', OopVisibilityType::IS_PRIVATE); + } + + public function testGetSessionManagerVisibilityAndArguments() + { + $this->verifyMethodVisibilityAndArguments(Client::class, 'getRpcClientManager', OopVisibilityType::IS_PRIVATE); + } + + /** + * Provides incorrect name of method + * + * @return Generator + */ + public function provideIncorrectMethod() + { + yield[ + 'lorem', + ]; + + yield[ + 'ipsum', + ]; + + yield[ + '', + ]; + } + + /** + * Provides correct name of method + * + * @return Generator + */ + public function provideMethod() + { + yield[ + MethodType::GET_PARTICIPANT_PROPERTIES, + [], + true, + ]; + + yield[ + MethodType::LIST_SURVEYS, + [], + false, + ]; + + yield[ + MethodType::LIST_PARTICIPANTS, + [], + false, + ]; + + /* + * todo: Use/Verify other types of methods + */ + } + + /** + * {@inheritdoc} + */ + protected function setUp() + { + parent::setUp(); + $this->configuration = new ConnectionConfiguration('http://test.com', 'test', 'test'); + } +} diff --git a/tests/Meritoo/LimeSurvey/Test/ApiClient/Configuration/ConnectionConfigurationTest.php b/tests/Meritoo/LimeSurvey/Test/ApiClient/Configuration/ConnectionConfigurationTest.php new file mode 100644 index 0000000..92fb9f1 --- /dev/null +++ b/tests/Meritoo/LimeSurvey/Test/ApiClient/Configuration/ConnectionConfigurationTest.php @@ -0,0 +1,146 @@ + + * @copyright Meritoo.pl + */ +class ConnectionConfigurationTest extends BaseTestCase +{ + /** + * @param mixed $emptyBaseUrl Empty base url + * @dataProvider provideEmptyBaseUrl + */ + public function testConstructorWithEmptyBaseUrl($emptyBaseUrl) + { + $this->expectException(InvalidUrlException::class); + new ConnectionConfiguration($emptyBaseUrl, '', ''); + } + + /** + * @param string $invalidBaseUrl Invalid base url + * @dataProvider provideInvalidBaseUrl + */ + public function testConstructorWithInvalidBaseUrl($invalidBaseUrl) + { + $this->expectException(InvalidUrlException::class); + new ConnectionConfiguration($invalidBaseUrl, '', ''); + } + + public function testConstructor() + { + $configuration = new ConnectionConfiguration('http://test.com', 'test1', 'test2'); + + static::assertEquals('http://test.com', $configuration->getBaseUrl()); + static::assertEquals('test1', $configuration->getUsername()); + static::assertEquals('test2', $configuration->getPassword()); + static::assertFalse($configuration->isDebugModeOn()); + } + + public function testSetBaseUrl() + { + $configuration = new ConnectionConfiguration('http://test.com', 'test1', 'test2'); + + $configuration->setBaseUrl('http://lorem.ipsum'); + static::assertEquals('http://lorem.ipsum', $configuration->getBaseUrl()); + + $configuration->setBaseUrl('http://lorem.ipsum/'); + static::assertEquals('http://lorem.ipsum', $configuration->getBaseUrl()); + } + + public function testSetRemoteControlUrl() + { + $configuration = new ConnectionConfiguration('http://test.com', 'test1', 'test2'); + $configuration->setRemoteControlUrl('/lorem/ipsum'); + + static::assertEquals('/lorem/ipsum', $configuration->getRemoteControlUrl()); + } + + public function testSetUsername() + { + $configuration = new ConnectionConfiguration('http://test.com', 'test1', 'test2'); + $configuration->setUsername('lorem'); + + static::assertEquals('lorem', $configuration->getUsername()); + } + + public function testSetPassword() + { + $configuration = new ConnectionConfiguration('http://test.com', 'test1', 'test2'); + $configuration->setPassword('ipsum'); + + static::assertEquals('ipsum', $configuration->getPassword()); + } + + public function testSetDebugMode() + { + $configuration = new ConnectionConfiguration('http://test.com', 'test1', 'test2'); + + $configuration->setDebugMode(); + static::assertFalse($configuration->isDebugModeOn()); + + $configuration->setDebugMode(false); + static::assertFalse($configuration->isDebugModeOn()); + + $configuration->setDebugMode(true); + static::assertTrue($configuration->isDebugModeOn()); + } + + public function testGetFullUrl() + { + $configuration = new ConnectionConfiguration('http://test.com', 'test1', 'test2'); + $configuration->setRemoteControlUrl('lorem/ipsum'); + + static::assertEquals('http://test.com/lorem/ipsum', $configuration->getFullUrl()); + } + + /** + * Provides empty base url + * + * @return Generator + */ + public function provideEmptyBaseUrl() + { + yield[ + '', + ]; + + yield[ + null, + ]; + } + + /** + * Provides invalid base url + * + * @return Generator + */ + public function provideInvalidBaseUrl() + { + yield[ + 'lorem', + ]; + + yield[ + 'ipsum', + ]; + + yield[ + 'htp:/dolor.com', + ]; + } +} diff --git a/tests/Meritoo/LimeSurvey/Test/ApiClient/Manager/JsonRpcClientManagerTest.php b/tests/Meritoo/LimeSurvey/Test/ApiClient/Manager/JsonRpcClientManagerTest.php new file mode 100644 index 0000000..aadadb0 --- /dev/null +++ b/tests/Meritoo/LimeSurvey/Test/ApiClient/Manager/JsonRpcClientManagerTest.php @@ -0,0 +1,99 @@ + + * @copyright Meritoo.pl + */ +class JsonRpcClientManagerTest extends BaseTestCase +{ + /** + * Configuration used while connecting to LimeSurvey's API + * + * @var ConnectionConfiguration + */ + private $configuration; + + public function testConstructorVisibilityAndArguments() + { + $this->verifyConstructorVisibilityAndArguments(JsonRpcClientManager::class, OopVisibilityType::IS_PUBLIC, 1, 1); + } + + public function testRunMethod() + { + $rpcClient = $this->createMock(RpcClient::class); + + $manager = $this + ->getMockBuilder(JsonRpcClientManager::class) + ->setConstructorArgs([ + $this->configuration, + ]) + ->setMethods([ + 'getRpcClient', + ]) + ->getMock(); + + $rpcClient + ->expects(static::any()) + ->method('execute') + ->willReturn([]); + + $manager + ->expects(static::any()) + ->method('getRpcClient') + ->willReturn($rpcClient); + + /* @var JsonRpcClientManager $manager */ + static::assertEquals([], $manager->runMethod(MethodType::LIST_SURVEYS)); + } + + public function testRunMethodWithMockedRpcClient() + { + $rpcClient = $this->createMock(RpcClient::class); + $manager = $this->createPartialMock(JsonRpcClientManager::class, ['getRpcClient']); + + $rpcClient + ->expects(static::any()) + ->method('execute') + ->willReturn(SurveyTest::getSurveysRawData()); + + $manager + ->expects(static::any()) + ->method('getRpcClient') + ->willReturn($rpcClient); + + /* @var JsonRpcClientManager $manager */ + static::assertEquals(SurveyTest::getSurveysRawData(), $manager->runMethod(MethodType::LIST_SURVEYS)); + } + + public function testGetRpcClientVisibilityAndArguments() + { + $this->verifyMethodVisibilityAndArguments(JsonRpcClientManager::class, 'getRpcClient', OopVisibilityType::IS_PROTECTED); + } + + /** + * {@inheritdoc} + */ + protected function setUp() + { + parent::setUp(); + $this->configuration = new ConnectionConfiguration('http://test.com', 'test', 'test'); + } +} diff --git a/tests/Meritoo/LimeSurvey/Test/ApiClient/Manager/SessionManagerTest.php b/tests/Meritoo/LimeSurvey/Test/ApiClient/Manager/SessionManagerTest.php new file mode 100644 index 0000000..c407934 --- /dev/null +++ b/tests/Meritoo/LimeSurvey/Test/ApiClient/Manager/SessionManagerTest.php @@ -0,0 +1,89 @@ + + * @copyright Meritoo.pl + */ +class SessionManagerTest extends BaseTestCase +{ + public function testConstructorVisibilityAndArguments() + { + $this->verifyConstructorVisibilityAndArguments(SessionManager::class, OopVisibilityType::IS_PUBLIC, 1, 1); + } + + public function testGetSessionKeyWhenFailedWithoutReason() + { + $this->expectException(CreateSessionKeyFailedException::class); + $this->expectExceptionMessage('Create of the session key has failed'); + + $clientManager = $this->createMock(JsonRpcClientManager::class); + + $clientManager + ->expects(static::any()) + ->method('runMethod') + ->willReturn([]); + + (new SessionManager($clientManager))->getSessionKey('lorem', 'ipsum'); + } + + public function testGetSessionKeyWhenFailedWithReason() + { + $reason = 'Invalid credentials'; + + $this->expectException(CreateSessionKeyFailedException::class); + $this->expectExceptionMessage(sprintf('Create of the session key has failed. Reason: \'%s\'.', $reason)); + + $clientManager = $this->createMock(JsonRpcClientManager::class); + + $clientManager + ->expects(static::any()) + ->method('runMethod') + ->willReturn([ + 'status' => $reason, + ]); + + (new SessionManager($clientManager))->getSessionKey('lorem', 'ipsum'); + } + + public function testGetSessionKey() + { + $clientManager = $this->createMock(JsonRpcClientManager::class); + + $clientManager + ->expects(static::any()) + ->method('runMethod') + ->willReturn('12345'); + + $sessionManager = new SessionManager($clientManager); + static::assertEquals('12345', $sessionManager->getSessionKey('lorem', 'ipsum')); + } + + public function testReleaseSessionKey() + { + $clientManager = $this->createMock(JsonRpcClientManager::class); + + $clientManager + ->expects(static::any()) + ->method('runMethod') + ->willReturn([]); + + $sessionManager = new SessionManager($clientManager); + static::assertInstanceOf(SessionManager::class, $sessionManager->releaseSessionKey()); + } +} diff --git a/tests/Meritoo/LimeSurvey/Test/ApiClient/Result/Item/ParticipantShortTest.php b/tests/Meritoo/LimeSurvey/Test/ApiClient/Result/Item/ParticipantShortTest.php new file mode 100644 index 0000000..ee3f044 --- /dev/null +++ b/tests/Meritoo/LimeSurvey/Test/ApiClient/Result/Item/ParticipantShortTest.php @@ -0,0 +1,117 @@ + + * @copyright Meritoo.pl + */ +class ParticipantShortTest extends PHPUnit_Framework_TestCase +{ + /** + * Raw data of participants + * + * @var array + */ + private $rawData; + + /** + * 1st instance of the participant created using the raw data + * + * @var ParticipantShort + */ + private $participant1stInstance; + + /** + * 2nd instance of the participant created using the raw data + * + * @var ParticipantShort + */ + private $participant2ndInstance; + + public function testCreateOfTheParticipant() + { + $processor = new ResultProcessor(); + $processed = $processor->process(MethodType::LIST_PARTICIPANTS, $this->rawData); + + static::assertCount(2, $processed); + } + + public function testGetId() + { + static::assertEquals(123, $this->participant1stInstance->getId()); + static::assertEquals(456, $this->participant2ndInstance->getId()); + } + + public function testGetFirstName() + { + static::assertEquals('Lorem', $this->participant1stInstance->getFirstName()); + static::assertEquals('Dolor', $this->participant2ndInstance->getFirstName()); + } + + public function testGetLastName() + { + static::assertEquals('Ipsum', $this->participant1stInstance->getLastName()); + static::assertEquals('Sit', $this->participant2ndInstance->getLastName()); + } + + public function testGetEmail() + { + static::assertEquals('lorem@ipsum.com', $this->participant1stInstance->getEmail()); + static::assertEquals('dolor@sit.com', $this->participant2ndInstance->getEmail()); + } + + /** + * Returns raw data of participants + * + * @return array + */ + public static function getParticipantsRawData() + { + return [ + [ + 'tid' => '123', + 'token' => uniqid(), + 'participant_info' => [ + 'firstname' => 'Lorem', + 'lastname' => 'Ipsum', + 'email' => 'lorem@ipsum.com', + ], + ], + [ + 'tid' => '456', + 'token' => uniqid(), + 'participant_info' => [ + 'firstname' => 'Dolor', + 'lastname' => 'Sit', + 'email' => 'dolor@sit.com', + ], + ], + ]; + } + + /** + * {@inheritdoc} + */ + protected function setUp() + { + parent::setUp(); + $this->rawData = static::getParticipantsRawData(); + + $this->participant1stInstance = (new ParticipantShort())->setValues($this->rawData[0]); + $this->participant2ndInstance = (new ParticipantShort())->setValues($this->rawData[1]); + } +} diff --git a/tests/Meritoo/LimeSurvey/Test/ApiClient/Result/Item/ParticipantTest.php b/tests/Meritoo/LimeSurvey/Test/ApiClient/Result/Item/ParticipantTest.php new file mode 100644 index 0000000..e604ac0 --- /dev/null +++ b/tests/Meritoo/LimeSurvey/Test/ApiClient/Result/Item/ParticipantTest.php @@ -0,0 +1,216 @@ + + * @copyright Meritoo.pl + */ +class ParticipantTest extends PHPUnit_Framework_TestCase +{ + /** + * Raw data of participants + * + * @var array + */ + private $rawData; + + /** + * 1st instance of the participant created using the raw data + * + * @var Participant + */ + private $participant1stInstance; + + /** + * 2nd instance of the participant created using the raw data + * + * @var Participant + */ + private $participant2ndInstance; + + public function testCreateOfTheParticipant() + { + $processor = new ResultProcessor(); + $processed = $processor->process(MethodType::GET_PARTICIPANT_PROPERTIES, $this->rawData[0]); + + static::assertInstanceOf(Participant::class, $processed); + } + + public function testGetId() + { + static::assertEquals(123, $this->participant1stInstance->getId()); + static::assertEquals(456, $this->participant2ndInstance->getId()); + } + + public function testGetParticipantId() + { + static::assertEquals(0, $this->participant1stInstance->getParticipantId()); + static::assertEquals(789, $this->participant2ndInstance->getParticipantId()); + } + + public function testGetMpId() + { + static::assertEquals(0, $this->participant1stInstance->getMpId()); + static::assertEquals(1, $this->participant2ndInstance->getMpId()); + } + + public function testGetFirstName() + { + static::assertEquals('Lorem', $this->participant1stInstance->getFirstName()); + static::assertEquals('Dolor', $this->participant2ndInstance->getFirstName()); + } + + public function testGetLastName() + { + static::assertEquals('Ipsum', $this->participant1stInstance->getLastName()); + static::assertEquals('Sit', $this->participant2ndInstance->getLastName()); + } + + public function testGetEmail() + { + static::assertEquals('lorem@ipsum.com', $this->participant1stInstance->getEmail()); + static::assertEquals('dolor@sit.com', $this->participant2ndInstance->getEmail()); + } + + public function testGetEmailStatus() + { + static::assertEquals('OK', $this->participant1stInstance->getEmailStatus()); + static::assertEquals('OK', $this->participant2ndInstance->getEmailStatus()); + } + + public function testGetToken() + { + static::assertEquals($this->rawData[0]['token'], $this->participant1stInstance->getToken()); + static::assertEquals($this->rawData[1]['token'], $this->participant2ndInstance->getToken()); + } + + public function testGetLanguage() + { + static::assertEquals('pl', $this->participant1stInstance->getLanguage()); + static::assertEquals('en', $this->participant2ndInstance->getLanguage()); + } + + public function testIsBlacklisted() + { + static::assertFalse($this->participant1stInstance->isBlacklisted()); + static::assertTrue($this->participant2ndInstance->isBlacklisted()); + } + + public function testIsSent() + { + static::assertTrue($this->participant1stInstance->isSent()); + static::assertTrue($this->participant2ndInstance->isSent()); + } + + public function testIsReminderSent() + { + static::assertFalse($this->participant1stInstance->isReminderSent()); + static::assertFalse($this->participant2ndInstance->isReminderSent()); + } + + public function testGetReminderCount() + { + static::assertEquals(0, $this->participant1stInstance->getReminderCount()); + static::assertEquals(1, $this->participant2ndInstance->getReminderCount()); + } + + public function testIsCompleted() + { + static::assertFalse($this->participant1stInstance->isCompleted()); + static::assertTrue($this->participant2ndInstance->isCompleted()); + } + + public function testGetUsesLeft() + { + static::assertEquals(10, $this->participant1stInstance->getUsesLeft()); + static::assertEquals(5, $this->participant2ndInstance->getUsesLeft()); + } + + public function testGetValidFrom() + { + static::assertNull($this->participant1stInstance->getValidFrom()); + static::assertEquals(new DateTime($this->rawData[1]['validfrom']), $this->participant2ndInstance->getValidFrom()); + } + + public function testGetValidUntil() + { + static::assertEquals(new DateTime($this->rawData[0]['validuntil']), $this->participant1stInstance->getValidUntil()); + static::assertNull($this->participant2ndInstance->getValidUntil()); + } + + /** + * Returns raw data of participants + * + * @return array + */ + public static function getParticipantsRawData() + { + return [ + [ + 'tid' => '123', + 'participant_id' => null, + 'mpid' => null, + 'firstname' => 'Lorem', + 'lastname' => 'Ipsum', + 'email' => 'lorem@ipsum.com', + 'emailstatus' => 'OK', + 'token' => uniqid(), + 'language' => 'pl', + 'blacklisted' => 'N', + 'sent' => 'Y', + 'remindersent' => 'N', + 'remindercount' => 0, + 'completed' => 'N', + 'usesleft' => 10, + 'validfrom' => null, + 'validuntil' => (new DateTime())->format('Y-m-d H:i:s'), + ], + [ + 'tid' => '456', + 'participant_id' => '789', + 'mpid' => '001', + 'firstname' => 'Dolor', + 'lastname' => 'Sit', + 'email' => 'dolor@sit.com', + 'emailstatus' => 'OK', + 'token' => uniqid(), + 'language' => 'en', + 'blacklisted' => 'Y', + 'sent' => 'Y', + 'remindersent' => 'N', + 'remindercount' => 1, + 'completed' => 'Y', + 'usesleft' => 5, + 'validfrom' => (new DateTime())->format('Y-m-d H:i:s'), + 'validuntil' => null, + ], + ]; + } + + /** + * {@inheritdoc} + */ + protected function setUp() + { + parent::setUp(); + $this->rawData = static::getParticipantsRawData(); + + $this->participant1stInstance = (new Participant())->setValues($this->rawData[0]); + $this->participant2ndInstance = (new Participant())->setValues($this->rawData[1]); + } +} diff --git a/tests/Meritoo/LimeSurvey/Test/ApiClient/Result/Item/QuestionShortTest.php b/tests/Meritoo/LimeSurvey/Test/ApiClient/Result/Item/QuestionShortTest.php new file mode 100644 index 0000000..73c50d9 --- /dev/null +++ b/tests/Meritoo/LimeSurvey/Test/ApiClient/Result/Item/QuestionShortTest.php @@ -0,0 +1,223 @@ + + * @copyright Meritoo.pl + */ +class QuestionShortTest extends BaseTestCase +{ + /** + * Raw data of questions + * + * @var array + */ + private $rawData; + + /** + * 1st instance of the question created using the raw data + * + * @var QuestionShort + */ + private $question1stInstance; + + /** + * 2nd instance of the question created using the raw data + * + * @var QuestionShort + */ + private $question2ndInstance; + + public function testCreateOfTheQuestionShort() + { + $processor = new ResultProcessor(); + $processed = $processor->process(MethodType::LIST_QUESTIONS, $this->rawData); + + static::assertCount(2, $processed); + } + + public function testGetId() + { + static::assertEquals(123, $this->question1stInstance->getId()); + static::assertEquals(456, $this->question2ndInstance->getId()); + } + + public function testGetParentId() + { + static::assertEquals(0, $this->question1stInstance->getParentId()); + static::assertEquals(789, $this->question2ndInstance->getParentId()); + } + + public function testGetSurveyId() + { + static::assertEquals(0, $this->question1stInstance->getSurveyId()); + static::assertEquals(1020, $this->question2ndInstance->getSurveyId()); + } + + public function testGetGroupId() + { + static::assertEquals(0, $this->question1stInstance->getGroupId()); + static::assertEquals(3040, $this->question2ndInstance->getGroupId()); + } + + public function testGetScaleId() + { + static::assertEquals(0, $this->question1stInstance->getScaleId()); + static::assertEquals(5060, $this->question2ndInstance->getScaleId()); + } + + public function testGetType() + { + static::assertEquals('T', $this->question1stInstance->getType()); + static::assertEquals('N', $this->question2ndInstance->getType()); + } + + public function testGetTitle() + { + static::assertEquals('Test', $this->question1stInstance->getTitle()); + static::assertEquals('Another Test', $this->question2ndInstance->getTitle()); + } + + public function testGetContent() + { + static::assertEquals('Donec ullamcorper nulla non metus auctor fringilla?', $this->question1stInstance->getContent()); + static::assertEquals('Maecenas sed diam eget risus varius blandit sit amet non magna?', $this->question2ndInstance->getContent()); + } + + public function testGetContentHelp() + { + static::assertEquals('Maecenas sed diam eget risus varius blandit sit amet non magna.', $this->question1stInstance->getContentHelp()); + static::assertEquals('Donec id elit non mi porta gravida at eget metus.', $this->question2ndInstance->getContentHelp()); + } + + public function testGetRegularExpression() + { + static::assertNull($this->question1stInstance->getRegularExpression()); + static::assertEquals('\d+', $this->question2ndInstance->getRegularExpression()); + } + + public function testIsOther() + { + static::assertFalse($this->question1stInstance->isOther()); + static::assertFalse($this->question2ndInstance->isOther()); + } + + public function testIsMandatory() + { + static::assertTrue($this->question1stInstance->isMandatory()); + static::assertTrue($this->question2ndInstance->isMandatory()); + } + + public function testGetPosition() + { + static::assertEquals(1, $this->question1stInstance->getPosition()); + static::assertEquals(2, $this->question2ndInstance->getPosition()); + } + + public function testGetLanguage() + { + static::assertEquals('pl', $this->question1stInstance->getLanguage()); + static::assertEquals('pl', $this->question2ndInstance->getLanguage()); + } + + public function testGetSameDefault() + { + static::assertEquals(0, $this->question1stInstance->getSameDefault()); + static::assertEquals(0, $this->question2ndInstance->getSameDefault()); + } + + public function testGetRelevance() + { + static::assertEquals('', $this->question1stInstance->getRelevance()); + static::assertEquals('1', $this->question2ndInstance->getRelevance()); + } + + public function testGetModuleName() + { + static::assertNull($this->question1stInstance->getModuleName()); + static::assertEquals('HR', $this->question2ndInstance->getModuleName()); + } + + /** + * Returns raw data of questions + * + * @return array + */ + public static function getQuestionsRawData() + { + return [ + [ + 'id' => [ + 'qid' => '123', + 'language' => 'pl', + ], + 'qid' => '123', + 'parent_qid' => null, + 'sid' => null, + 'gid' => null, + 'scale_id' => null, + 'type' => 'T', + 'title' => 'Test', + 'question' => 'Donec ullamcorper nulla non metus auctor fringilla?', + 'help' => 'Maecenas sed diam eget risus varius blandit sit amet non magna.', + 'preg' => null, + 'other' => 'N', + 'mandatory' => 'Y', + 'question_order' => '1', + 'language' => 'pl', + 'same_default' => '0', + 'relevance' => null, + 'modulename' => null, + ], + [ + 'id' => [ + 'qid' => '456', + 'language' => 'pl', + ], + 'qid' => '456', + 'parent_qid' => '789', + 'sid' => '1020', + 'gid' => '3040', + 'scale_id' => '5060', + 'type' => 'N', + 'title' => 'Another Test', + 'question' => 'Maecenas sed diam eget risus varius blandit sit amet non magna?', + 'help' => 'Donec id elit non mi porta gravida at eget metus.', + 'preg' => '\d+', + 'other' => 'N', + 'mandatory' => 'Y', + 'question_order' => '2', + 'language' => 'pl', + 'same_default' => '0', + 'relevance' => '1', + 'modulename' => 'HR', + ], + ]; + } + + /** + * {@inheritdoc} + */ + protected function setUp() + { + parent::setUp(); + $this->rawData = static::getQuestionsRawData(); + + $this->question1stInstance = (new QuestionShort())->setValues($this->rawData[0]); + $this->question2ndInstance = (new QuestionShort())->setValues($this->rawData[1]); + } +} diff --git a/tests/Meritoo/LimeSurvey/Test/ApiClient/Result/Item/QuestionTest.php b/tests/Meritoo/LimeSurvey/Test/ApiClient/Result/Item/QuestionTest.php new file mode 100644 index 0000000..4485331 --- /dev/null +++ b/tests/Meritoo/LimeSurvey/Test/ApiClient/Result/Item/QuestionTest.php @@ -0,0 +1,285 @@ + + * @copyright Meritoo.pl + */ +class QuestionTest extends PHPUnit_Framework_TestCase +{ + /** + * Raw data of questions + * + * @var array + */ + private $rawData; + + /** + * 1st instance of the question created using the raw data + * + * @var Question + */ + private $question1stInstance; + + /** + * 2nd instance of the question created using the raw data + * + * @var Question + */ + private $question2ndInstance; + + public function testCreateOfTheQuestionShort() + { + $processor = new ResultProcessor(); + $processed = $processor->process(MethodType::GET_QUESTION_PROPERTIES, $this->rawData); + + static::assertInstanceOf(Question::class, $processed); + } + + public function testGetId() + { + static::assertEquals(123, $this->question1stInstance->getId()); + static::assertEquals(456, $this->question2ndInstance->getId()); + } + + public function testGetParentId() + { + static::assertEquals(0, $this->question1stInstance->getParentId()); + static::assertEquals(789, $this->question2ndInstance->getParentId()); + } + + public function testGetSurveyId() + { + static::assertEquals(0, $this->question1stInstance->getSurveyId()); + static::assertEquals(1020, $this->question2ndInstance->getSurveyId()); + } + + public function testGetGroupId() + { + static::assertEquals(0, $this->question1stInstance->getGroupId()); + static::assertEquals(3040, $this->question2ndInstance->getGroupId()); + } + + public function testGetScaleId() + { + static::assertEquals(0, $this->question1stInstance->getScaleId()); + static::assertEquals(5060, $this->question2ndInstance->getScaleId()); + } + + public function testGetType() + { + static::assertEquals('T', $this->question1stInstance->getType()); + static::assertEquals('M', $this->question2ndInstance->getType()); + } + + public function testGetTitle() + { + static::assertEquals('Test', $this->question1stInstance->getTitle()); + static::assertEquals('Another Test', $this->question2ndInstance->getTitle()); + } + + public function testGetContent() + { + static::assertEquals('Donec ullamcorper nulla non metus auctor fringilla?', $this->question1stInstance->getContent()); + static::assertEquals('Maecenas sed diam eget risus varius blandit sit amet non magna?', $this->question2ndInstance->getContent()); + } + + public function testGetContentHelp() + { + static::assertEquals('Maecenas sed diam eget risus varius blandit sit amet non magna.', $this->question1stInstance->getContentHelp()); + static::assertEquals('Donec id elit non mi porta gravida at eget metus.', $this->question2ndInstance->getContentHelp()); + } + + public function testGetRegularExpression() + { + static::assertNull($this->question1stInstance->getRegularExpression()); + static::assertEquals('\d+', $this->question2ndInstance->getRegularExpression()); + } + + public function testIsOther() + { + static::assertFalse($this->question1stInstance->isOther()); + static::assertFalse($this->question2ndInstance->isOther()); + } + + public function testIsMandatory() + { + static::assertTrue($this->question1stInstance->isMandatory()); + static::assertTrue($this->question2ndInstance->isMandatory()); + } + + public function testGetPosition() + { + static::assertEquals(1, $this->question1stInstance->getPosition()); + static::assertEquals(2, $this->question2ndInstance->getPosition()); + } + + public function testGetLanguage() + { + static::assertEquals('pl', $this->question1stInstance->getLanguage()); + static::assertEquals('pl', $this->question2ndInstance->getLanguage()); + } + + public function testGetSameDefault() + { + static::assertEquals(0, $this->question1stInstance->getSameDefault()); + static::assertEquals(0, $this->question2ndInstance->getSameDefault()); + } + + public function testGetRelevance() + { + static::assertEquals('', $this->question1stInstance->getRelevance()); + static::assertEquals('1', $this->question2ndInstance->getRelevance()); + } + + public function testGetModuleName() + { + static::assertNull($this->question1stInstance->getModuleName()); + static::assertEquals('HR', $this->question2ndInstance->getModuleName()); + } + + public function testGetAvailableAnswers() + { + static::assertEquals('No available answers', $this->question1stInstance->getAvailableAnswers()); + static::assertEquals($this->rawData[1]['available_answers'], $this->question2ndInstance->getAvailableAnswers()); + } + + public function testGetSubQuestions() + { + static::assertEquals('No available subquestions', $this->question1stInstance->getSubQuestions()); + static::assertEquals($this->rawData[1]['subquestions'], $this->question2ndInstance->getSubQuestions()); + } + + public function testGetAttributes() + { + static::assertEquals('No available attributes', $this->question1stInstance->getAttributes()); + static::assertEquals('No available attributes', $this->question2ndInstance->getAttributes()); + } + + public function testGetAttributesLanguages() + { + static::assertEquals('No available attributes', $this->question1stInstance->getAttributesLanguages()); + static::assertEquals('No available attributes', $this->question2ndInstance->getAttributesLanguages()); + } + + public function testGetAnswerOptions() + { + static::assertEquals('No available answer options', $this->question1stInstance->getAnswerOptions()); + static::assertEquals('No available answer options', $this->question2ndInstance->getAnswerOptions()); + } + + public function testGetDefaultValue() + { + static::assertNull($this->question1stInstance->getDefaultValue()); + static::assertNull($this->question2ndInstance->getDefaultValue()); + } + + /** + * Returns raw data of questions + * + * @return array + */ + public static function getQuestionsRawData() + { + return [ + [ + 'id' => [ + 'qid' => '123', + 'language' => 'pl', + ], + 'qid' => '123', + 'parent_qid' => null, + 'sid' => null, + 'gid' => null, + 'scale_id' => null, + 'type' => 'T', + 'title' => 'Test', + 'question' => 'Donec ullamcorper nulla non metus auctor fringilla?', + 'help' => 'Maecenas sed diam eget risus varius blandit sit amet non magna.', + 'preg' => null, + 'other' => 'N', + 'mandatory' => 'Y', + 'question_order' => '1', + 'language' => 'pl', + 'same_default' => '0', + 'relevance' => null, + 'modulename' => null, + 'available_answers' => 'No available answers', + 'subquestions' => 'No available subquestions', + 'attributes' => 'No available attributes', + 'attributes_lang' => 'No available attributes', + 'answeroptions' => 'No available answer options', + 'defaultvalue' => null, + ], + [ + 'id' => [ + 'qid' => '456', + 'language' => 'pl', + ], + 'qid' => '456', + 'parent_qid' => '789', + 'sid' => '1020', + 'gid' => '3040', + 'scale_id' => '5060', + 'type' => 'M', + 'title' => 'Another Test', + 'question' => 'Maecenas sed diam eget risus varius blandit sit amet non magna?', + 'help' => 'Donec id elit non mi porta gravida at eget metus.', + 'preg' => '\d+', + 'other' => 'N', + 'mandatory' => 'Y', + 'question_order' => '2', + 'language' => 'pl', + 'same_default' => '0', + 'relevance' => '1', + 'modulename' => 'HR', + 'available_answers' => [ + 'SQ001' => 'Sed posuere consectetur est at lobortis?', + 'SQ002' => 'Cum sociis natoque penatibus et magnis?', + ], + 'subquestions' => [ + 1 => [ + 'title' => 'SQ001', + 'question' => 'Cum sociis natoque penatibus et magnis?', + 'scale_id' => '0', + ], + 2 => [ + 'title' => 'SQ002', + 'question' => 'Sed posuere consectetur est at lobortis?', + 'scale_id' => '0', + ], + ], + 'attributes' => 'No available attributes', + 'attributes_lang' => 'No available attributes', + 'answeroptions' => 'No available answer options', + 'defaultvalue' => null, + ], + ]; + } + + /** + * {@inheritdoc} + */ + protected function setUp() + { + parent::setUp(); + $this->rawData = static::getQuestionsRawData(); + + $this->question1stInstance = (new Question())->setValues($this->rawData[0]); + $this->question2ndInstance = (new Question())->setValues($this->rawData[1]); + } +} diff --git a/tests/Meritoo/LimeSurvey/Test/ApiClient/Result/Item/SurveyTest.php b/tests/Meritoo/LimeSurvey/Test/ApiClient/Result/Item/SurveyTest.php new file mode 100644 index 0000000..aa14ce3 --- /dev/null +++ b/tests/Meritoo/LimeSurvey/Test/ApiClient/Result/Item/SurveyTest.php @@ -0,0 +1,120 @@ + + * @copyright Meritoo.pl + */ +class SurveyTest extends PHPUnit_Framework_TestCase +{ + /** + * Raw data of surveys + * + * @var array + */ + private $rawData; + + /** + * 1st instance of the survey created using the raw data + * + * @var Survey + */ + private $survey1stInstance; + + /** + * 2nd instance of the survey created using the raw data + * + * @var Survey + */ + private $survey2ndInstance; + + public function testCreateOfTheSurvey() + { + $processor = new ResultProcessor(); + $processed = $processor->process(MethodType::LIST_SURVEYS, $this->rawData); + + static::assertCount(2, $processed); + } + + public function testGetId() + { + static::assertEquals(123, $this->survey1stInstance->getId()); + static::assertEquals(456, $this->survey2ndInstance->getId()); + } + + public function testGetTitle() + { + static::assertEquals('Test', $this->survey1stInstance->getTitle()); + static::assertEquals('Another Test', $this->survey2ndInstance->getTitle()); + } + + public function testGetStartsAt() + { + static::assertNull($this->survey1stInstance->getStartsAt()); + static::assertEquals(new DateTime($this->rawData[1]['startdate']), $this->survey2ndInstance->getStartsAt()); + } + + public function testGetExpiresAt() + { + static::assertEquals(new DateTime($this->rawData[0]['expires']), $this->survey1stInstance->getExpiresAt()); + static::assertNull($this->survey2ndInstance->getExpiresAt()); + } + + public function testIsActive() + { + static::assertFalse($this->survey1stInstance->isActive()); + static::assertTrue($this->survey2ndInstance->isActive()); + } + + /** + * Returns raw data of surveys + * + * @return array + */ + public static function getSurveysRawData() + { + return [ + [ + 'sid' => '123', + 'surveyls_title' => 'Test', + 'startdate' => null, + 'expires' => (new DateTime())->format('Y-m-d H:i:s'), + 'active' => 'N', + ], + [ + 'sid' => '456', + 'surveyls_title' => 'Another Test', + 'startdate' => (new DateTime())->format('Y-m-d H:i:s'), + 'expires' => null, + 'active' => 'Y', + ], + ]; + } + + /** + * {@inheritdoc} + */ + protected function setUp() + { + parent::setUp(); + $this->rawData = static::getSurveysRawData(); + + $this->survey1stInstance = (new Survey())->setValues($this->rawData[0]); + $this->survey2ndInstance = (new Survey())->setValues($this->rawData[1]); + } +} diff --git a/tests/Meritoo/LimeSurvey/Test/ApiClient/Result/Processor/ResultProcessorTest.php b/tests/Meritoo/LimeSurvey/Test/ApiClient/Result/Processor/ResultProcessorTest.php new file mode 100644 index 0000000..2612d76 --- /dev/null +++ b/tests/Meritoo/LimeSurvey/Test/ApiClient/Result/Processor/ResultProcessorTest.php @@ -0,0 +1,86 @@ + + * @copyright Meritoo.pl + */ +class ResultProcessorTest extends BaseTestCase +{ + public function testConstructorVisibilityAndArguments() + { + $reflection = new ReflectionClass(ResultProcessor::class); + $constructor = $reflection->getConstructor(); + + static::assertNull($constructor); + } + + public function testProcessWithEmptyRawData() + { + $rawData = []; + $processor = new ResultProcessor(); + + static::assertNull($processor->process(MethodType::LIST_SURVEYS, $rawData)); + } + + public function testProcessWithIterableData() + { + $processor = new ResultProcessor(); + $processed = $processor->process(MethodType::LIST_SURVEYS, SurveyTest::getSurveysRawData()); + + static::assertNotEmpty($processed); + static::assertTrue(is_array($processed)); + static::assertCount(2, $processed); + } + + public function testProcessWithNotIterableData() + { + $rawData = [ + 'lorem' => 'ipsum', + 'dolor' => 'sit', + ]; + + $processor = new ResultProcessor(); + $processed = $processor->process(MethodType::GET_PARTICIPANT_PROPERTIES, $rawData); + + static::assertNotEmpty($processed); + static::assertFalse(is_array($processed)); + static::assertInstanceOf(BaseItem::class, $processed); + } + + public function testGetItemInstanceVisibilityAndArguments() + { + $this->verifyMethodVisibilityAndArguments(ResultProcessor::class, 'getItemInstance', OopVisibilityType::IS_PRIVATE, 1, 1); + } + + public function testRunWithUnknownResultClass() + { + $this->expectException(UnknownInstanceOfResultItem::class); + + $rawData = [ + 'lorem' => 'ipsum', + 'dolor' => 'sit', + ]; + + $processor = new ResultProcessor(); + $processor->process(MethodType::LIST_USERS, $rawData); + } +} diff --git a/tests/Meritoo/LimeSurvey/Test/ApiClient/Result/ResultTest.php b/tests/Meritoo/LimeSurvey/Test/ApiClient/Result/ResultTest.php new file mode 100644 index 0000000..2b337e4 --- /dev/null +++ b/tests/Meritoo/LimeSurvey/Test/ApiClient/Result/ResultTest.php @@ -0,0 +1,182 @@ + + * @copyright Meritoo.pl + */ +class ResultTest extends BaseTestCase +{ + /** + * Empty data returned by the LimeSurvey's API + * + * @var array + */ + private $emptyData; + + /** + * Iterable, not empty data returned by the LimeSurvey's API + * + * @var array + */ + private $iterableData; + + /** + * Not iterable, not empty data returned by the LimeSurvey's API + * + * @var array + */ + private $notIterableData; + + /** + * Mock of the tested class. + * With empty data returned by the LimeSurvey's API. + * + * @var PHPUnit_Framework_MockObject_MockObject + */ + private $emptyDataMock; + + /** + * Mock of the tested class. + * With iterable, not empty data. + * + * @var PHPUnit_Framework_MockObject_MockObject + */ + private $iterableDataMock; + + /** + * Mock of the tested class. + * With not iterable, not empty data. + * + * @var PHPUnit_Framework_MockObject_MockObject + */ + private $notIterableDataMock; + + public function testConstructorVisibilityAndArguments() + { + $this->verifyConstructorVisibilityAndArguments(Result::class, OopVisibilityType::IS_PUBLIC, 2, 2); + } + + public function testIsEmpty() + { + static::assertTrue($this->emptyDataMock->isEmpty()); + static::assertFalse($this->iterableDataMock->isEmpty()); + } + + public function testGetDataUsingProcessedData() + { + $emptyData = $this->emptyDataMock->getData(); + $iterableData = $this->iterableDataMock->getData(); + $notIterableData = $this->notIterableDataMock->getData(); + + static::assertEmpty($emptyData); + static::assertNotEmpty($iterableData); + static::assertNotEmpty($notIterableData); + + static::assertCount(count($this->emptyData), $emptyData); + static::assertCount(count($this->iterableData), $iterableData); + static::assertInstanceOf(BaseItem::class, $notIterableData); + } + + public function testGetDataUsingRawData() + { + $emptyData = $this->emptyDataMock->getData(true); + $iterableData = $this->iterableDataMock->getData(true); + + static::assertEmpty($emptyData); + static::assertNotEmpty($iterableData); + + static::assertCount(count($this->emptyData), $emptyData); + static::assertCount(count($this->iterableData), $iterableData); + + static::assertEquals($this->emptyData, $emptyData); + static::assertEquals($this->iterableData, $iterableData); + } + + public function testGetProcessedDataVisibilityAndArguments() + { + $this->verifyMethodVisibilityAndArguments(Result::class, 'getProcessedData', OopVisibilityType::IS_PRIVATE, 1, 1); + } + + public function testGetResultProcessorVisibilityAndArguments() + { + $this->verifyMethodVisibilityAndArguments(Result::class, 'getResultProcessor', OopVisibilityType::IS_PRIVATE); + } + + /** + * {@inheritdoc{ + */ + protected function setUp() + { + parent::setUp(); + $this->emptyData = []; + + $this->notIterableData = [ + 'result' => base64_encode('lorem-ipsum'), + ]; + + $this->iterableData = [ + [ + 'sid' => '123', + 'surveyls_title' => 'Test', + 'startdate' => null, + 'expires' => null, + 'active' => 'N', + ], + [ + 'sid' => '456', + 'surveyls_title' => 'Another Test', + 'startdate' => (new DateTime())->format('Y-m-d H:i:s'), + 'expires' => null, + 'active' => 'Y', + ], + ]; + + $emptyDataArguments = [ + MethodType::LIST_SURVEYS, + $this->emptyData, + ]; + + $iterableDataArguments = [ + MethodType::LIST_SURVEYS, + $this->iterableData, + ]; + + $notIterableDataArguments = [ + MethodType::GET_PARTICIPANT_PROPERTIES, + $this->notIterableData, + ]; + + $this->emptyDataMock = $this->getResultMock($emptyDataArguments); + $this->iterableDataMock = $this->getResultMock($iterableDataArguments); + $this->notIterableDataMock = $this->getResultMock($notIterableDataArguments); + } + + /** + * Returns mock of the tested class + * + * @param array $constructorArguments Arguments of constructor for prepared mock + * @return Result + */ + private function getResultMock($constructorArguments) + { + return $this->getMockForAbstractClass(Result::class, $constructorArguments); + } +} diff --git a/tests/Meritoo/LimeSurvey/Test/ApiClient/Type/MethodTypeTest.php b/tests/Meritoo/LimeSurvey/Test/ApiClient/Type/MethodTypeTest.php new file mode 100644 index 0000000..b9e3c14 --- /dev/null +++ b/tests/Meritoo/LimeSurvey/Test/ApiClient/Type/MethodTypeTest.php @@ -0,0 +1,204 @@ + + * @copyright Meritoo.pl + */ +class MethodTypeTest extends BaseTypeTestCase +{ + /** + * @param string $incorrectMethod Type of method to verify + * @dataProvider provideIncorrectMethod + */ + public function testGetValidatedMethodWithIncorrectMethod($incorrectMethod) + { + $this->expectException(UnknownMethodException::class); + MethodType::getValidatedMethod($incorrectMethod); + } + + /** + * @param string $method Type of method to verify + * @dataProvider provideMethod + */ + public function testGetValidatedMethod($method) + { + static::assertEquals($method, MethodType::getValidatedMethod($method)); + } + + /** + * @param string $incorrectMethod Type of incorrectMethod to verify + * @dataProvider provideIncorrectMethod + */ + public function testIsResultIterableWithIncorrectMethod($incorrectMethod) + { + $this->expectException(UnknownMethodException::class); + MethodType::isResultIterable($incorrectMethod); + } + + /** + * @param string $method Type of method to verify + * @param bool $expected Information if result provided by the API is iterable + * + * @dataProvider provideIterableType + */ + public function testIsResultIterable($method, $expected) + { + static::assertEquals($expected, MethodType::isResultIterable($method)); + } + + /** + * Provides correct type of method + * + * @return Generator + */ + public function provideMethod() + { + yield[ + MethodType::ADD_RESPONSE, + ]; + + yield[ + MethodType::EXPORT_STATISTICS, + ]; + + yield[ + MethodType::GET_PARTICIPANT_PROPERTIES, + ]; + + yield[ + MethodType::LIST_SURVEYS, + ]; + } + + /** + * Provides incorrect type of method + * + * @return Generator + */ + public function provideIncorrectMethod() + { + yield[ + '', + ]; + + yield[ + null, + ]; + + yield[ + true, + ]; + + yield[ + false, + ]; + + yield[ + 'lorem', + ]; + } + + /** + * Provides type of method who result provided by the API is iterable and information if it's iterable + * + * @return Generator + */ + public function provideIterableType() + { + yield[ + MethodType::ADD_RESPONSE, + false, + ]; + + yield[ + MethodType::GET_PARTICIPANT_PROPERTIES, + false, + ]; + + yield[ + MethodType::LIST_PARTICIPANTS, + true, + ]; + + yield[ + MethodType::LIST_QUESTIONS, + true, + ]; + + yield[ + MethodType::LIST_SURVEYS, + true, + ]; + + yield[ + MethodType::LIST_USERS, + true, + ]; + } + + /** + * {@inheritdoc} + */ + protected function getAllExpectedTypes() + { + return [ + 'ADD_RESPONSE' => MethodType::ADD_RESPONSE, + 'EXPORT_STATISTICS' => MethodType::EXPORT_STATISTICS, + 'GET_PARTICIPANT_PROPERTIES' => MethodType::GET_PARTICIPANT_PROPERTIES, + 'GET_QUESTION_PROPERTIES' => MethodType::GET_QUESTION_PROPERTIES, + 'LIST_PARTICIPANTS' => MethodType::LIST_PARTICIPANTS, + 'LIST_QUESTIONS' => MethodType::LIST_QUESTIONS, + 'LIST_SURVEYS' => MethodType::LIST_SURVEYS, + 'LIST_USERS' => MethodType::LIST_USERS, + ]; + } + + /** + * {@inheritdoc} + */ + protected function getTestedTypeInstance() + { + return new MethodType(); + } + + /** + * {@inheritdoc} + */ + public function provideTypeToVerify() + { + yield[ + '', + false, + ]; + + yield[ + 'lorem', + false, + ]; + + yield[ + MethodType::ADD_RESPONSE, + true, + ]; + + yield[ + MethodType::GET_PARTICIPANT_PROPERTIES, + true, + ]; + } +} diff --git a/tests/Meritoo/LimeSurvey/Test/ApiClient/Type/SystemMethodTypeTest.php b/tests/Meritoo/LimeSurvey/Test/ApiClient/Type/SystemMethodTypeTest.php new file mode 100644 index 0000000..03464e6 --- /dev/null +++ b/tests/Meritoo/LimeSurvey/Test/ApiClient/Type/SystemMethodTypeTest.php @@ -0,0 +1,66 @@ + + * @copyright Meritoo.pl + */ +class SystemMethodTypeTest extends BaseTypeTestCase +{ + /** + * {@inheritdoc} + */ + protected function getAllExpectedTypes() + { + return [ + 'GET_SESSION_KEY' => SystemMethodType::GET_SESSION_KEY, + 'RELEASE_SESSION_KEY' => SystemMethodType::RELEASE_SESSION_KEY, + ]; + } + + /** + * {@inheritdoc} + */ + protected function getTestedTypeInstance() + { + return new SystemMethodType(); + } + + /** + * {@inheritdoc} + */ + public function provideTypeToVerify() + { + yield[ + '', + false, + ]; + + yield[ + 'lorem', + false, + ]; + + yield[ + SystemMethodType::GET_SESSION_KEY, + true, + ]; + + yield[ + SystemMethodType::RELEASE_SESSION_KEY, + true, + ]; + } +}