From 0e9b7ab5dd7bea2ae37cbb01d2904c657aa0a2db Mon Sep 17 00:00:00 2001 From: 1stthomas Date: Thu, 10 Mar 2022 22:12:05 +0100 Subject: [PATCH] #30 fix php8 incompatibilities, fix tests, first step fixing repository --- .gitignore | 23 +- composer.json | 13 +- composer.lock | 1428 ----------- composer__.lock | 2173 +++++++++++++++++ src/ContainerLw.php | 136 ++ src/ContainerLwable.php | 49 + src/Dummy.php | 20 + src/Enum.php | 9 +- .../ContainerResolvingException.php | 16 + src/Exceptions/EntryNotFoundException.php | 16 + src/Exceptions/Utility/HelperMessages.php | 40 - src/Exceptions/Utility/Message.php | 150 -- src/Exceptions/Utility/Messages.php | 19 - src/Localization/Adapter.php | 55 - src/Localization/Adapterable.php | 67 - src/Utility/Traits/CanLoadByGetMethod.php | 25 - src/Utility/Traits/CanLoadBySetMethod.php | 25 - src/Utility/Traits/Constants.php | 148 -- tests/Integration/HashListTest_.php | 67 + tests/Integration/ItemListTest_.php | 137 ++ .../LaravelSyntaxValidatorTest_.php | 38 + tests/Unit/ContainerLwTest.php | 170 ++ tmp/src/ContainerLw.php | 136 ++ tmp/src/ContainerLwable.php | 49 + tmp/src/Dummy.php | 20 + tmp/src/Enum.php | 46 + .../ContainerResolvingException.php | 16 + tmp/src/Exceptions/EntryNotFoundException.php | 16 + .../Exceptions/InvalidDatatypeException.php | 38 + .../Exceptions/UndefinedConstantException.php | 13 + .../Exceptions/UndefinedPropertyException.php | 21 + tmp/src/Iterators/SimpleAssocIterator.php | 46 + tmp/src/Iterators/SimpleIndexIterator.php | 76 + tmp/src/Lists/AbstractItemList.php | 140 ++ tmp/src/Lists/HashList.php | 98 + tmp/src/Lists/Hashable.php | 19 + tmp/src/Lists/HashableHashList.php | 43 + tmp/src/Lists/ItemList.php | 33 + tmp/src/Lists/ItemListable.php | 95 + tmp/src/Localization/AbstractTranslator.php | 94 + .../Localization/Adapters/AbstractAdapter.php | 48 + tmp/src/Localization/Adapters/AdapterList.php | 40 + tmp/src/Localization/Adapters/Adapterable.php | 54 + .../Adapters/ClassConstantAdapter.php | 45 + .../Adapters/ContextAdapterable.php | 56 + .../Localization/Adapters/NoLangAdapter.php | 48 + tmp/src/Localization/Languages/Language.php | 20 + .../Localization/Languages/LanguageList.php | 15 + tmp/src/Localization/Locales/Locale.php | 39 + tmp/src/Localization/Locales/LocaleList.php | 15 + tmp/src/Localization/Translator.php | 103 + .../src/Localization/TranslatorOld.php | 2 +- tmp/src/Localization/Translatorable.php | 12 + tmp/src/Messages/Composer.php | 62 + tmp/src/Messages/MessageTypes.php | 17 + tmp/src/Messages/Options/BaseOptions.php | 122 + tmp/src/Messages/Options/Exception.php | 59 + tmp/src/Messages/Options/Optionable.php | 93 + .../Parts/InvalidDataTypeException.php | 71 + .../Patterns/InvalidDataTypeException.php | 50 + tmp/src/Messages/TypeList.php | 15 + tmp/src/Messages/Types/AbstractBaseType.php | 81 + tmp/src/Messages/Types/Exception.php | 30 + .../Types/Parts/InvalidDataTypeException.php | 93 + .../src}/Models/AbstractLoadableModel.php | 0 .../Models/AbstractTransLoadableModel.php | 0 {src => tmp/src}/Models/Loadable.php | 0 {src => tmp/src}/Models/TransLoadable.php | 0 tmp/src/Registry/Entry.php | 26 + tmp/src/Registry/Pointer/Task.php | 30 + tmp/src/Registry/Registry.php | 44 + tmp/src/Registry/Task/Task.php | 30 + tmp/src/Registry/Types/Classes.php | 15 + tmp/src/Registry/Types/Instances.php | 26 + .../Storage/Models/AbstractStorageModel.php | 30 + tmp/src/Storage/Models/StorageModelable.php | 20 + tmp/src/Storage/StorageTypes.php | 51 + .../ClassConstants/ClassConstantModel.php | 48 + tmp/src/Storage/Types/None/NoneModel.php | 21 + .../Utility/Importers/AbstractImporter.php | 0 .../Utility/Importers/Files/ArrayImporter.php | 0 .../src}/Utility/Importers/Importable.php | 0 {src => tmp/src}/Utility/Strings.php | 0 .../Utility/Traits/CanAddByPropertyName.php | 25 + .../Traits/CanRestrictInexVariables.php | 21 + .../AbstractValidationContainer.php | 101 + tmp/src/Validation/Error/ThrowHandler.php | 43 + .../Validation/Iterators/RuleListIterator.php | 22 + .../Lists/AbstractValidationList.php | 60 + tmp/src/Validation/Lists/RuleList.php | 40 + tmp/src/Validation/Lists/TypeList.php | 88 + tmp/src/Validation/Options/BaseOptionable.php | 47 + tmp/src/Validation/Options/BaseOptions.php | 59 + .../Validation/Options/BaseTypeOptionable.php | 31 + .../Validation/Options/TypeListOptions.php | 46 + tmp/src/Validation/Rules/IsAlphaNumeric.php | 25 + tmp/src/Validation/Rules/IsAlphabetical.php | 25 + tmp/src/Validation/Rules/IsArray.php | 25 + tmp/src/Validation/Rules/IsDateTime.php | 28 + tmp/src/Validation/Rules/IsInstanceOf.php | 26 + tmp/src/Validation/Rules/IsObject.php | 26 + tmp/src/Validation/Rules/IsPrimitive.php | 29 + tmp/src/Validation/Rules/IsRequired.php | 25 + .../Validation/Rules/MultiValueRulable.php | 24 + .../Validation/Rules/SingleValueRulable.php | 23 + .../Types/AbstractSingleValueType.php | 41 + tmp/src/Validation/Types/AbstractType.php | 41 + tmp/src/Validation/Types/AbstractTypeOld.php | 82 + tmp/src/Validation/Types/Accepted.php | 33 + tmp/src/Validation/Types/Datatype.php | 46 + tmp/src/Validation/Types/DefaultTypes.php | 29 + tmp/src/Validation/Types/InstOf.php | 35 + .../Types/MultiValueValidationable.php | 17 + .../Types/Options/AbstractTypeOptions.php | 43 + .../Types/Options/DatatypeOptions.php | 58 + tmp/src/Validation/Types/Options/InstOf.php | 52 + .../Types/Options/ValuesIncluded.php | 31 + .../Parameters/AbstractTypeParameter.php | 15 + .../Validation/Types/Parameters/InstOf.php | 52 + .../Types/SingleValueValidationable.php | 24 + .../Validation/Types/ValidationTypable.php | 28 + .../Validation/ValidationContainerable.php | 77 + .../Validators/AbstractValidator.php | 69 + .../Validators/AbstractValidatorOld.php | 74 + .../Validators/LaravelSyntaxValidator.php | 75 + .../Validators/MultiValueValidationable.php | 13 + .../Transformers/LaravelTransformer.php | 81 + tmp/tests/ContainerLwTest.php | 170 ++ tmp/tests/DummyTest.php | 18 + tmp/tests/EnumTest.php | 41 + .../tests/Exceptions/MessageTest_.php | 0 .../Iterators/SimpleAssocIteratorTest.php | 106 + .../Iterators/SimpleIndexIteratorTest.php | 154 ++ .../tests}/Lists/AbstractItemListTest.php | 0 .../Unit => tmp/tests}/Lists/HashListTest.php | 0 .../Unit => tmp/tests}/Lists/ItemListTest.php | 0 .../Adapters/NoLangAdapterTest_.php | 108 + .../Localization/TranslatorOldTest__.php | 14 +- .../Messages/Options/BaseOptionsTest_.php | 109 + .../Models/AbstractLoadableModelTest.php | 46 + .../Models/AbstractTransLoadableModelTest.php | 96 + tmp/tests/Models/LoadableModelTest_.php | 30 + .../tests/Utility/StringsTest_.php | 2 +- .../Traits/CanAddByPropertyNameTest.php | 67 + .../Lists/AbstractValidationListTest.php | 41 + tmp/tests/Validation/Lists/RuleListTest.php | 80 + tmp/tests/Validation/Lists/TypeListTest.php | 204 ++ .../Validation/Options/BaseOptionsTest.php | 85 + .../Options/TypeListOptionsTest.php | 65 + .../Types/AbstractSingleValueTypeTest.php | 193 ++ .../Validation/Types/AbstractTypeTest.php | 183 ++ 151 files changed, 9041 insertions(+), 1980 deletions(-) delete mode 100644 composer.lock create mode 100644 composer__.lock create mode 100644 src/ContainerLw.php create mode 100644 src/ContainerLwable.php create mode 100644 src/Dummy.php create mode 100644 src/Exceptions/ContainerResolvingException.php create mode 100644 src/Exceptions/EntryNotFoundException.php delete mode 100644 src/Exceptions/Utility/HelperMessages.php delete mode 100644 src/Exceptions/Utility/Message.php delete mode 100644 src/Exceptions/Utility/Messages.php delete mode 100644 src/Localization/Adapter.php delete mode 100644 src/Localization/Adapterable.php delete mode 100644 src/Utility/Traits/CanLoadByGetMethod.php delete mode 100644 src/Utility/Traits/CanLoadBySetMethod.php delete mode 100644 src/Utility/Traits/Constants.php create mode 100644 tests/Integration/HashListTest_.php create mode 100644 tests/Integration/ItemListTest_.php create mode 100644 tests/Integration/Validation/Validators/LaravelSyntaxValidatorTest_.php create mode 100644 tests/Unit/ContainerLwTest.php create mode 100644 tmp/src/ContainerLw.php create mode 100644 tmp/src/ContainerLwable.php create mode 100644 tmp/src/Dummy.php create mode 100644 tmp/src/Enum.php create mode 100644 tmp/src/Exceptions/ContainerResolvingException.php create mode 100644 tmp/src/Exceptions/EntryNotFoundException.php create mode 100644 tmp/src/Exceptions/InvalidDatatypeException.php create mode 100644 tmp/src/Exceptions/UndefinedConstantException.php create mode 100644 tmp/src/Exceptions/UndefinedPropertyException.php create mode 100644 tmp/src/Iterators/SimpleAssocIterator.php create mode 100644 tmp/src/Iterators/SimpleIndexIterator.php create mode 100644 tmp/src/Lists/AbstractItemList.php create mode 100644 tmp/src/Lists/HashList.php create mode 100644 tmp/src/Lists/Hashable.php create mode 100644 tmp/src/Lists/HashableHashList.php create mode 100644 tmp/src/Lists/ItemList.php create mode 100644 tmp/src/Lists/ItemListable.php create mode 100644 tmp/src/Localization/AbstractTranslator.php create mode 100644 tmp/src/Localization/Adapters/AbstractAdapter.php create mode 100644 tmp/src/Localization/Adapters/AdapterList.php create mode 100644 tmp/src/Localization/Adapters/Adapterable.php create mode 100644 tmp/src/Localization/Adapters/ClassConstantAdapter.php create mode 100644 tmp/src/Localization/Adapters/ContextAdapterable.php create mode 100644 tmp/src/Localization/Adapters/NoLangAdapter.php create mode 100644 tmp/src/Localization/Languages/Language.php create mode 100644 tmp/src/Localization/Languages/LanguageList.php create mode 100644 tmp/src/Localization/Locales/Locale.php create mode 100644 tmp/src/Localization/Locales/LocaleList.php create mode 100644 tmp/src/Localization/Translator.php rename src/Localization/Translator.php => tmp/src/Localization/TranslatorOld.php (99%) create mode 100644 tmp/src/Localization/Translatorable.php create mode 100644 tmp/src/Messages/Composer.php create mode 100644 tmp/src/Messages/MessageTypes.php create mode 100644 tmp/src/Messages/Options/BaseOptions.php create mode 100644 tmp/src/Messages/Options/Exception.php create mode 100644 tmp/src/Messages/Options/Optionable.php create mode 100644 tmp/src/Messages/Options/Parts/InvalidDataTypeException.php create mode 100644 tmp/src/Messages/Patterns/InvalidDataTypeException.php create mode 100644 tmp/src/Messages/TypeList.php create mode 100644 tmp/src/Messages/Types/AbstractBaseType.php create mode 100644 tmp/src/Messages/Types/Exception.php create mode 100644 tmp/src/Messages/Types/Parts/InvalidDataTypeException.php rename {src => tmp/src}/Models/AbstractLoadableModel.php (100%) rename {src => tmp/src}/Models/AbstractTransLoadableModel.php (100%) rename {src => tmp/src}/Models/Loadable.php (100%) rename {src => tmp/src}/Models/TransLoadable.php (100%) create mode 100644 tmp/src/Registry/Entry.php create mode 100644 tmp/src/Registry/Pointer/Task.php create mode 100644 tmp/src/Registry/Registry.php create mode 100644 tmp/src/Registry/Task/Task.php create mode 100644 tmp/src/Registry/Types/Classes.php create mode 100644 tmp/src/Registry/Types/Instances.php create mode 100644 tmp/src/Storage/Models/AbstractStorageModel.php create mode 100644 tmp/src/Storage/Models/StorageModelable.php create mode 100644 tmp/src/Storage/StorageTypes.php create mode 100644 tmp/src/Storage/Types/ClassConstants/ClassConstantModel.php create mode 100644 tmp/src/Storage/Types/None/NoneModel.php rename {src => tmp/src}/Utility/Importers/AbstractImporter.php (100%) rename {src => tmp/src}/Utility/Importers/Files/ArrayImporter.php (100%) rename {src => tmp/src}/Utility/Importers/Importable.php (100%) rename {src => tmp/src}/Utility/Strings.php (100%) create mode 100644 tmp/src/Utility/Traits/CanAddByPropertyName.php create mode 100644 tmp/src/Utility/Traits/CanRestrictInexVariables.php create mode 100644 tmp/src/Validation/AbstractValidationContainer.php create mode 100644 tmp/src/Validation/Error/ThrowHandler.php create mode 100644 tmp/src/Validation/Iterators/RuleListIterator.php create mode 100644 tmp/src/Validation/Lists/AbstractValidationList.php create mode 100644 tmp/src/Validation/Lists/RuleList.php create mode 100644 tmp/src/Validation/Lists/TypeList.php create mode 100644 tmp/src/Validation/Options/BaseOptionable.php create mode 100644 tmp/src/Validation/Options/BaseOptions.php create mode 100644 tmp/src/Validation/Options/BaseTypeOptionable.php create mode 100644 tmp/src/Validation/Options/TypeListOptions.php create mode 100644 tmp/src/Validation/Rules/IsAlphaNumeric.php create mode 100644 tmp/src/Validation/Rules/IsAlphabetical.php create mode 100644 tmp/src/Validation/Rules/IsArray.php create mode 100644 tmp/src/Validation/Rules/IsDateTime.php create mode 100644 tmp/src/Validation/Rules/IsInstanceOf.php create mode 100644 tmp/src/Validation/Rules/IsObject.php create mode 100644 tmp/src/Validation/Rules/IsPrimitive.php create mode 100644 tmp/src/Validation/Rules/IsRequired.php create mode 100644 tmp/src/Validation/Rules/MultiValueRulable.php create mode 100644 tmp/src/Validation/Rules/SingleValueRulable.php create mode 100644 tmp/src/Validation/Types/AbstractSingleValueType.php create mode 100644 tmp/src/Validation/Types/AbstractType.php create mode 100644 tmp/src/Validation/Types/AbstractTypeOld.php create mode 100644 tmp/src/Validation/Types/Accepted.php create mode 100644 tmp/src/Validation/Types/Datatype.php create mode 100644 tmp/src/Validation/Types/DefaultTypes.php create mode 100644 tmp/src/Validation/Types/InstOf.php create mode 100644 tmp/src/Validation/Types/MultiValueValidationable.php create mode 100644 tmp/src/Validation/Types/Options/AbstractTypeOptions.php create mode 100644 tmp/src/Validation/Types/Options/DatatypeOptions.php create mode 100644 tmp/src/Validation/Types/Options/InstOf.php create mode 100644 tmp/src/Validation/Types/Options/ValuesIncluded.php create mode 100644 tmp/src/Validation/Types/Parameters/AbstractTypeParameter.php create mode 100644 tmp/src/Validation/Types/Parameters/InstOf.php create mode 100644 tmp/src/Validation/Types/SingleValueValidationable.php create mode 100644 tmp/src/Validation/Types/ValidationTypable.php create mode 100644 tmp/src/Validation/ValidationContainerable.php create mode 100644 tmp/src/Validation/Validators/AbstractValidator.php create mode 100644 tmp/src/Validation/Validators/AbstractValidatorOld.php create mode 100644 tmp/src/Validation/Validators/LaravelSyntaxValidator.php create mode 100644 tmp/src/Validation/Validators/MultiValueValidationable.php create mode 100644 tmp/src/Validation/Validators/Transformers/LaravelTransformer.php create mode 100644 tmp/tests/ContainerLwTest.php create mode 100644 tmp/tests/DummyTest.php create mode 100644 tmp/tests/EnumTest.php rename tests/unit/Exceptions/MessageTest.php => tmp/tests/Exceptions/MessageTest_.php (100%) create mode 100644 tmp/tests/Iterators/SimpleAssocIteratorTest.php create mode 100644 tmp/tests/Iterators/SimpleIndexIteratorTest.php rename {tests/Unit => tmp/tests}/Lists/AbstractItemListTest.php (100%) rename {tests/Unit => tmp/tests}/Lists/HashListTest.php (100%) rename {tests/Unit => tmp/tests}/Lists/ItemListTest.php (100%) create mode 100644 tmp/tests/Localization/Adapters/NoLangAdapterTest_.php rename tests/unit/Localization/TranslatorTest.php => tmp/tests/Localization/TranslatorOldTest__.php (60%) create mode 100644 tmp/tests/Messages/Options/BaseOptionsTest_.php create mode 100644 tmp/tests/Models/AbstractLoadableModelTest.php create mode 100644 tmp/tests/Models/AbstractTransLoadableModelTest.php create mode 100644 tmp/tests/Models/LoadableModelTest_.php rename tests/unit/Utility/StringsTest.php => tmp/tests/Utility/StringsTest_.php (97%) create mode 100644 tmp/tests/Utility/Traits/CanAddByPropertyNameTest.php create mode 100644 tmp/tests/Validation/Lists/AbstractValidationListTest.php create mode 100644 tmp/tests/Validation/Lists/RuleListTest.php create mode 100644 tmp/tests/Validation/Lists/TypeListTest.php create mode 100644 tmp/tests/Validation/Options/BaseOptionsTest.php create mode 100644 tmp/tests/Validation/Options/TypeListOptionsTest.php create mode 100644 tmp/tests/Validation/Types/AbstractSingleValueTypeTest.php create mode 100644 tmp/tests/Validation/Types/AbstractTypeTest.php diff --git a/.gitignore b/.gitignore index d0bb2a4..b4a0bb7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,17 @@ -/nbproject/ -/vendor/ -/tests/configuration.xml -/tests/test.bat -/tests/bootstrap.php -/tests/run/ \ No newline at end of file +/nbproject/ +/vendor/ +/tests/configuration.xml +/tests/test.bat +/tests/bootstrap.php +/tests/run/ +/test01.php +/tests/cache_test +/php_errors.log +/ht7-base__20191128_02.zip +/test02.php +/test11.php +/tests/.phpunit.result.cache +/tests/configuration_1.xml +/tests/php_errors.log +/tests/t1.php +/tests/output/ diff --git a/composer.json b/composer.json index 8e89d3e..e78ae15 100644 --- a/composer.json +++ b/composer.json @@ -30,11 +30,16 @@ "source": "https://github.com/1stthomas/ht7-base" }, "require": { - "php": "^7.0" + "php": "^7.0|^8.0", + "psr/container": "1.0" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^7.0|^9.0" }, "minimum-stability": "dev", - "prefer-stable": true -} \ No newline at end of file + "prefer-stable": true, + "scripts": { + "test": ".\\vendor\\bin\\phpunit --bootstrap .\\tests\\bootstrap.php --configuration .\\tests\\configuration.xml --testdox", + "php1": "php -v" + } +} diff --git a/composer.lock b/composer.lock deleted file mode 100644 index e5a3e82..0000000 --- a/composer.lock +++ /dev/null @@ -1,1428 +0,0 @@ -{ - "_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#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "ff8edfa3105e7a3ce9199dff5d5a1489", - "packages": [], - "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "^6.2.3", - "squizlabs/php_codesniffer": "^3.0.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.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": "2017-07-22T11:58:36+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.8.1", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", - "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "replace": { - "myclabs/deep-copy": "self.version" - }, - "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, - "files": [ - "src/DeepCopy/deep_copy.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "time": "2018-06-11T23:09:50+00:00" - }, - { - "name": "phar-io/manifest", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "phar-io/version": "^2.0", - "php": "^5.6 || ^7.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": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2018-07-08T19:23:20+00:00" - }, - { - "name": "phar-io/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Library for handling version information and constraints", - "time": "2018-07-08T19:19:57+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": "4.3.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08", - "shasum": "" - }, - "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0.0", - "phpdocumentor/type-resolver": "^0.4.0", - "webmozart/assert": "^1.0" - }, - "require-dev": { - "doctrine/instantiator": "~1.0.5", - "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.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" - } - ], - "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-11-30T07:14:17+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "0.4.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", - "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-07-14T14:27:02+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "1.8.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", - "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", - "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|^3.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.8.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": "2018-08-05T17:53:17+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "6.1.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-xmlwriter": "*", - "php": "^7.1", - "phpunit/php-file-iterator": "^2.0", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1 || ^4.0", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "suggest": { - "ext-xdebug": "^2.6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.1-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 provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2018-10-31T16:06:48+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "050bedf145a257b1ff02746c31894800e5122946" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", - "reference": "050bedf145a257b1ff02746c31894800e5122946", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.1" - }, - "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": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2018-09-13T20:33:42+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": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8b8454ea6958c3dee38453d3bd571e023108c91f", - "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.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": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2018-02-01T13:07:23+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "3.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/c99e3be9d3e85f60646f152f9002d46ed7770d18", - "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "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" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2018-10-30T05:52:18+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "7.4.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "b1be2c8530c4c29c3519a052c9fb6cee55053bbd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b1be2c8530c4c29c3519a052c9fb6cee55053bbd", - "reference": "b1be2c8530c4c29c3519a052c9fb6cee55053bbd", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.1", - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "myclabs/deep-copy": "^1.7", - "phar-io/manifest": "^1.0.2", - "phar-io/version": "^2.0", - "php": "^7.1", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^6.0.7", - "phpunit/php-file-iterator": "^2.0.1", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.0", - "sebastian/comparator": "^3.0", - "sebastian/diff": "^3.0", - "sebastian/environment": "^3.1 || ^4.0", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0", - "sebastian/version": "^2.0.1" - }, - "conflict": { - "phpunit/phpunit-mock-objects": "*" - }, - "require-dev": { - "ext-pdo": "*" - }, - "suggest": { - "ext-soap": "*", - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "7.4-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": "2018-11-14T16:52:02+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": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "shasum": "" - }, - "require": { - "php": "^7.1", - "sebastian/diff": "^3.0", - "sebastian/exporter": "^3.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.1" - }, - "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": "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": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2018-07-12T15:12:46+00:00" - }, - { - "name": "sebastian/diff", - "version": "3.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "366541b989927187c4ca70490a35615d3fef2dce" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/366541b989927187c4ca70490a35615d3fef2dce", - "reference": "366541b989927187c4ca70490a35615d3fef2dce", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0", - "symfony/process": "^2 || ^3.3 || ^4" - }, - "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": "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", - "udiff", - "unidiff", - "unified diff" - ], - "time": "2018-06-10T07:54:39+00:00" - }, - { - "name": "sebastian/environment", - "version": "4.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "febd209a219cea7b56ad799b30ebbea34b71eb8f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/febd209a219cea7b56ad799b30ebbea34b71eb8f", - "reference": "febd209a219cea7b56ad799b30ebbea34b71eb8f", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.4" - }, - "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" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2018-11-25T09:31:21+00:00" - }, - { - "name": "sebastian/exporter", - "version": "3.1.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", - "shasum": "" - }, - "require": { - "php": "^7.0", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1.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": "2017-04-03T13:19:02+00:00" - }, - { - "name": "sebastian/global-state", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.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": "2017-04-27T15:39:26+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "shasum": "" - }, - "require": { - "php": "^7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.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-08-03T12:35:26+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "773f97c67f28de00d397be301821b06708fca0be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", - "reference": "773f97c67f28de00d397be301821b06708fca0be", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29T09:07:27+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.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": "2017-03-03T06:23:57+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-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": "2018-10-04T04:07:39+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": "theseer/tokenizer", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - } - ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2017-04-07T12:08:54+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.3.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a", - "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": "2018-01-29T19:49:41+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=5.3.2" - }, - "platform-dev": [] -} diff --git a/composer__.lock b/composer__.lock new file mode 100644 index 0000000..dd9e3f7 --- /dev/null +++ b/composer__.lock @@ -0,0 +1,2173 @@ +{ + "_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#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "a70a424c596258a57f10393f1145f2cd", + "packages": [ + { + "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" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/master" + }, + "time": "2017-02-14T16:28:37+00:00" + } + ], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" + }, + "type": "library", + "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": "https://ocramius.github.io/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.4.1" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2022-03-03T08:28:38+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.11.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" + }, + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "type": "library", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2022-03-03T13:19:32+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v4.13.2", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "210577fe3cf7badcc5814d99455df46564f3c077" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", + "reference": "210577fe3cf7badcc5814d99455df46564f3c077", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.9-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" + }, + "time": "2021-11-30T19:35:32+00:00" + }, + { + "name": "phar-io/manifest", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.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": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.3" + }, + "time": "2021-07-20T11:28:43+00:00" + }, + { + "name": "phar-io/version", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "time": "2022-02-21T01:04:05+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-2.x": "2.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" + ], + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + }, + "time": "2020-06-27T09:03:43+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "5.3.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^1.3", + "webmozart/assert": "^1.9.1" + }, + "require-dev": { + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.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" + }, + { + "name": "Jaap van Otterdijk", + "email": "account@ijaap.nl" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" + }, + "time": "2021-10-19T17:43:47+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "1.6.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706", + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.0" + }, + "require-dev": { + "ext-tokenizer": "*", + "psalm/phar": "^4.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-1.x": "1.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" + } + ], + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.0" + }, + "time": "2022-01-04T19:58:01+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "v1.15.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.2", + "php": "^7.2 || ~8.0, <8.2", + "phpdocumentor/reflection-docblock": "^5.2", + "sebastian/comparator": "^3.0 || ^4.0", + "sebastian/recursion-context": "^3.0 || ^4.0" + }, + "require-dev": { + "phpspec/phpspec": "^6.0 || ^7.0", + "phpunit/phpunit": "^8.0 || ^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Prophecy\\": "src/Prophecy" + } + }, + "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" + ], + "support": { + "issues": "https://github.com/phpspec/prophecy/issues", + "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" + }, + "time": "2021-12-08T12:19:24+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "9.2.15", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f", + "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^4.13.0", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-text-template": "^2.0.2", + "sebastian/code-unit-reverse-lookup": "^2.0.2", + "sebastian/complexity": "^2.0", + "sebastian/environment": "^5.1.2", + "sebastian/lines-of-code": "^1.0.3", + "sebastian/version": "^3.0.1", + "theseer/tokenizer": "^1.2.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcov": "*", + "ext-xdebug": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.2-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 provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-03-07T09:28:20+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "3.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "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": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-12-02T12:48:52+00:00" + }, + { + "name": "phpunit/php-invoker", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcntl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-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": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:58:55+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.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": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T05:33:50+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "5.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.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": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:16:10+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "9.5.18", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "1b5856028273bfd855e60a887278857d872ec67a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1b5856028273bfd855e60a887278857d872ec67a", + "reference": "1b5856028273bfd855e60a887278857d872ec67a", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.3.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.1", + "phar-io/manifest": "^2.0.3", + "phar-io/version": "^3.0.2", + "php": ">=7.3", + "phpspec/prophecy": "^1.12.1", + "phpunit/php-code-coverage": "^9.2.13", + "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-invoker": "^3.1.1", + "phpunit/php-text-template": "^2.0.3", + "phpunit/php-timer": "^5.0.2", + "sebastian/cli-parser": "^1.0.1", + "sebastian/code-unit": "^1.0.6", + "sebastian/comparator": "^4.0.5", + "sebastian/diff": "^4.0.3", + "sebastian/environment": "^5.1.3", + "sebastian/exporter": "^4.0.3", + "sebastian/global-state": "^5.0.1", + "sebastian/object-enumerator": "^4.0.3", + "sebastian/resource-operations": "^3.0.3", + "sebastian/type": "^2.3.4", + "sebastian/version": "^3.0.2" + }, + "require-dev": { + "ext-pdo": "*", + "phpspec/prophecy-phpunit": "^2.0.1" + }, + "suggest": { + "ext-soap": "*", + "ext-xdebug": "*" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.5-dev" + } + }, + "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], + "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" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.18" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-03-08T06:52:28+00:00" + }, + { + "name": "sebastian/cli-parser", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "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", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:08:49+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "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", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:08:54+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-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/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:30:19+00:00" + }, + { + "name": "sebastian/comparator", + "version": "4.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "55f4261989e546dc112258c7a75935a81a7ce382" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", + "reference": "55f4261989e546dc112258c7a75935a81a7ce382", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "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" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:49:45+00:00" + }, + { + "name": "sebastian/complexity", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.7", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.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": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:52:27+00:00" + }, + { + "name": "sebastian/diff", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" + }, + "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" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:10:38+00:00" + }, + { + "name": "sebastian/environment", + "version": "5.1.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "388b6ced16caa751030f6a69e588299fa09200ac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac", + "reference": "388b6ced16caa751030f6a69e588299fa09200ac", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.1-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" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:52:38+00:00" + }, + { + "name": "sebastian/exporter", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^9.3" + }, + "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" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "https://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-11-11T14:18:36+00:00" + }, + { + "name": "sebastian/global-state", + "version": "5.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.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" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-02-14T08:28:10+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.6", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "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", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-28T06:42:11+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "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" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:12:34+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:14:26+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", + "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "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" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:17:30+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "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" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "support": { + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:45:17+00:00" + }, + { + "name": "sebastian/type", + "version": "2.3.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-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": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-06-15T12:49:02+00:00" + }, + { + "name": "sebastian/version", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "c6c1022351a901512170118436c764e473f6de8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "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": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:39:44+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "30885182c981ab175d4d034db0f6f469898070ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-10-20T20:35:02+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2021-07-28T10:34:58+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.10.0", + "source": { + "type": "git", + "url": "https://github.com/webmozarts/assert.git", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<4.6.1 || 4.6.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.5.13" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-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" + ], + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/1.10.0" + }, + "time": "2021-03-09T10:59:23+00:00" + } + ], + "aliases": [], + "minimum-stability": "dev", + "stability-flags": [], + "prefer-stable": true, + "prefer-lowest": false, + "platform": { + "php": "^7.0|^8.0" + }, + "platform-dev": [], + "plugin-api-version": "2.2.0" +} diff --git a/src/ContainerLw.php b/src/ContainerLw.php new file mode 100644 index 0000000..acbb5be --- /dev/null +++ b/src/ContainerLw.php @@ -0,0 +1,136 @@ +test = 'test'; + $this->bindings = []; + $this->instances = []; + + $this->bind('exc/container/psr/container', ContainerResolvingException::class); + $this->bind('exc/container/psr/notfound', EntryNotFoundException::class); + } + public static function getInstance() + { + if (empty(self::$instance)) { + static::$instance = new static(); + } + + return static::$instance; + } + /** + * {@inheritdoc} + */ + public function bind($abstract, $concrete = null, $shared = true) + { + $this->bindings[$abstract] = $concrete; + } + /** + * Alias of ContainerLw::has($abstract) + * + * {@inheritdoc} + */ + public function bound($abstract) + { + return $this->has($abstract); + } + /** + * Get the binding of the present abstract. + * + * {@inheritdoc} + */ + public function get($abstract) + { + return $this->resolve($abstract); + } + public function getBindings() + { + return $this->bindings; + } + public function getInstances() + { + return $this->instances; + } + /** + * {@inheritdoc} + */ + public function has($abstract) + { + return array_key_exists($abstract, $this->getBindings()); + } + /** + * {@inheritdoc} + */ + public function instance($abstract, $instance) + { + $this->bind($abstract, get_class($instance), true); + + $this->instances[$abstract] = $instance; + } + /** + * {@inheritdoc} + */ + public function make($abstract, $parameters = []) + { + return $this->resolve($abstract, $parameters); + } + public function reset() + { + $this->bindings = []; + $this->instances = []; + } + public function resolve($abstract, $parameters = []) + { + if ($this->has($abstract)) { + $instances = $this->getInstances(); + + if (array_key_exists($abstract, $instances)) { + return $instances[$abstract]; + } else { + $class = $this->getBindings()[$abstract]; + + try { + if (is_callable($class)) { + $instances[$abstract] = $class(...$parameters); + } elseif (!count($parameters)) { + $instances[$abstract] = new $class(); + } elseif (count($parameters) === 1) { + $instances[$abstract] = new $class($parameters[0]); + } else { + $instances[$abstract] = new $class(...$parameters); + } + } catch (\Exception $e) { + $class = $this->getBindings()['exc/container/psr/container']; + throw new $class($e->getMessage(), $e->getCode(), $e); + } + } + } else { + $class = $this->getBindings()['exc/container/psr/notfound']; + throw new $class(); + } + } + /** + * {@inheritdoc} + */ + public function singleton($abstract, $concrete = null) + { + $this->bind($abstract, $concrete, true); + } +} diff --git a/src/ContainerLwable.php b/src/ContainerLwable.php new file mode 100644 index 0000000..57d9929 --- /dev/null +++ b/src/ContainerLwable.php @@ -0,0 +1,49 @@ +Message::compose(). - * - * @author Thomas Plüss - */ -class Message -{ - - /** - * - * @param string $name The name of the invalid property. This - * should be the reason for the current - * exception. - * @param string $class The exception class. - * @param mixed $found The invalid variable. E.g. for the - * InvalidDatatypeException this parameter - * will be transformed with get_type(). - * @param array $primitiv An array of allowed primitiv datatypes. - * @param array $instances An array of classes whichs instances are - * allowed. - * @return string The exception message. - */ - public static function compose(string $name, string $class, $found, array $primitiv = [], array $instances = []) - { - // Get the index to gain the desired text pattern. - $index = static::getIndex($class); - $parameters = [static::getParameters($primitiv, $instances)]; - // Prepend the name of the invalid property. - array_unshift($parameters, $name); - - // Get the invalid datatype. For objects its class will be reported. - $foundType = gettype($found) === 'object' ? get_class($found) : gettype($found); - // Append the invalid datatype/class. - array_push($parameters, $foundType); - - return Translator::t(Messages::getConstant($index), $parameters); - } - - /** - * Get the index of the string for the calling exception class. - * - * This method removes all namespaces and the word "Exception" and - * decamelizes the result. E.g. InvalidDatatypeException will - * result in invalid_datatype. - * - * @param string $class The absolute class name of the exception to - * throw. - */ - public static function getIndex($class) - { - $parts = explode('\\', $class); - $count = count($parts); - - if ($class !== '' && $count > 0) { - $name = str_replace('Exception', '', $parts[$count - 1]); - - return Strings::decamelize($name); - } else { - $e = Translator::t( - '%s must not be empty.', - ['Classname'], - 'ht7-base-testing' - ); - - throw new InvalidArgumentException($e); - } - } - - /** - * Get the translation for a list of instances. - * - * @param array $instances An indexed array with class names. - * @return string The composed instance string. - */ - public static function getInstances(array $instances) - { - $text = ''; - - switch (count($instances)) { - case 0: - return $text; - case 1: - $text = HelperMessages::INSTANCES_ONE; - break; - case 2: - $text = HelperMessages::INSTANCES_TWO; - break; - case 3: - default: - $text = HelperMessages::INSTANCES_MT_TWO; - $instances = [implode(', ', $instances)]; - break; - } - - return Translator::t($text, $instances); - } - - /** - * Get the translation text of a composition of primitiv datatypes and - * instances. - * - * @param string $primitiv The transformed string of primitiv datatypes. - * @param string $instances The transformed string of instances. - * @return string The composed message. - */ - public static function getParameters($primitiv, $instances) - { - if (empty($primitiv) && empty($instances)) { - // @todo: throw error. - return 'undefined'; - } elseif (!empty($primitiv) && empty($instances)) { - return static::getPrimitivs($primitiv); - } elseif (empty($primitiv) && !empty($instances)) { - return static::getInstances($instances); - } else { - $arr = [ - static::getPrimitivs($primitiv), - static::getInstances($instances) - ]; - - return Translator::t(HelperMessages::INSTANCES_PRIMITIV, $arr); - } - } - - /** - * Get the translation for a list of primitiv datatypes. - * - * @param array $list Indexed array of primitiv datatypes. - * @return string The composed datatype string. - */ - public static function getPrimitivs(array $list) - { - return Translator::t( - HelperMessages::PRIMITIV_MT_ZERO, - [implode(', ', $list)] - ); - } - -} diff --git a/src/Exceptions/Utility/Messages.php b/src/Exceptions/Utility/Messages.php deleted file mode 100644 index 6989059..0000000 --- a/src/Exceptions/Utility/Messages.php +++ /dev/null @@ -1,19 +0,0 @@ - 1) { - array_unshift($args, $str2); - - return call_user_func_array('sprintf', $args); - } else { - return $this->t1($str1, $args); - } - } - - /** - * @override - */ - public function t3($context, $str, array $args = []) - { - return $this->t1($str, $args); - } - - /** - * @override - */ - public function t4($context, $str1, $str2, $count = 1, array $args = []) - { - return $this->t2($str1, $str2, $count, $args); - } - -} diff --git a/src/Localization/Adapterable.php b/src/Localization/Adapterable.php deleted file mode 100644 index f221078..0000000 --- a/src/Localization/Adapterable.php +++ /dev/null @@ -1,67 +0,0 @@ - $value) { - $methodName = 'set' . ucfirst($name); - - if (method_exists($this, $methodName)) { - $this->$methodName($value); - } else { - $this->$name = $value; - } - } - } - -} diff --git a/src/Utility/Traits/CanLoadBySetMethod.php b/src/Utility/Traits/CanLoadBySetMethod.php deleted file mode 100644 index 352a711..0000000 --- a/src/Utility/Traits/CanLoadBySetMethod.php +++ /dev/null @@ -1,25 +0,0 @@ - $value) { - $methodName = 'set' . ucfirst($name); - - if (method_exists($this, $methodName)) { - $this->$methodName($value); - } else { - $this->$name = $value; - } - } - } - -} diff --git a/src/Utility/Traits/Constants.php b/src/Utility/Traits/Constants.php deleted file mode 100644 index 2f6ad66..0000000 --- a/src/Utility/Traits/Constants.php +++ /dev/null @@ -1,148 +0,0 @@ -$icludeAncestors = false could produce unexpected results. - */ - public static function getConstants($includeAncestors = true) - { - $cache = self::getCacheConstants(); - - $cacheC = $cache[0] === null ? [] : $cache[0]; - $cacheIA = $cache[1] === null ? [] : $cache[1]; - - $calledClass = get_called_class(); - - if (!array_key_exists($calledClass, $cacheC) || $cacheIA[$calledClass] !== $includeAncestors) { - $reflection = new ReflectionClass($calledClass); - // Get an assoc array of all constants, also the ones defined by ancestors. - $constants = $reflection->getConstants(); - - if (!$includeAncestors) { - // Look for a parent class. - $parent = $reflection->getParentClass(); - - if (is_object($parent)) { - // Get all constants of the parent with its ancestors. - $constantsParent = $parent->getConstants(); - // Remove the constants from the ancestors. - $constants = array_diff_assoc($constants, $constantsParent); - } - } - - self::setCacheConstants($calledClass, $constants, $includeAncestors); - } else { - $constants = $cacheC[$calledClass]; - } - - return $constants; - } - - /** - * Get all constants defined by this class or its ancestors with a specific prefix. - * - * @param string $prefix The prefix to search for. - * @param boolean $includeAncestors True if also constants from anscestors should be included. - * @return array - * @since 0.0.1 - */ - public static function getConstantsByPrefix($prefix, $includeAncestors = true) - { - $constantsAll = static::getConstants($includeAncestors); - - if (!empty($prefix)) { - $constants = []; - - foreach ($constantsAll as $name => $value) { - if (is_array($prefix) && !empty($prefix[0])) { - $prefix = $prefix[0]; - } - - if (strpos($name, $prefix) !== false) { - $constants[$name] = $value; - } - } - } else { - $constants = $constantsAll; - } - - return $constants; - } - - /** - * Get the constants cache. - * - * @return array Indexed array with self::$cacheConstants - * on the first position, followed by - * self::cacheIncludeAncestors. - */ - private static function getCacheConstants() - { - return [ - self::$cacheConstants, - self::$cacheIncludeAncestors - ]; - } - - /** - * Set the constants cache. - * - * @param string $calledClass The full qualified class name of the - * calling class. - * @param array $constants Assoc array with the constant name as - * key and the correpsonding value as value. - * @param boolean $includeAncestors Flag to control if the constants from - * ancestors should be added too (true). - */ - private static function setCacheConstants($calledClass, $constants, $includeAncestors) - { - self::$cacheConstants[$calledClass] = $constants; - self::$cacheIncludeAncestors[$calledClass] = $includeAncestors; - } - -} diff --git a/tests/Integration/HashListTest_.php b/tests/Integration/HashListTest_.php new file mode 100644 index 0000000..89a004f --- /dev/null +++ b/tests/Integration/HashListTest_.php @@ -0,0 +1,67 @@ +getAll(); + + $this->assertCount(2, $items); + + return $hL; + } + + /** + * @depends testConstructor + */ + public function testAdd(HashList $hL) + { + $hi1 = new HashListItemImplementation('three', 'v3'); + $hi2 = new HashListItemImplementation('two', 'v2a'); + $hL->add($hi1); + $hL->add($hi2); + + $items = $hL->getAll(); + + $this->assertCount(3, $items); + + $this->assertArrayHasKey('one', $items); + $this->assertArrayHasKey('two', $items); + $this->assertArrayHasKey('three', $items); + + $this->assertEquals('v3', $hL->get('three')->getValue()); + $this->assertEquals('v2a', $hL->get('two')->getValue()); + + $this->expectException(InvalidArgumentException::class); + $hL->add('Should fail'); + + $this->expectException(InvalidArgumentException::class); + $test = new stdClass(); + $hL->add($test); + } + +} diff --git a/tests/Integration/ItemListTest_.php b/tests/Integration/ItemListTest_.php new file mode 100644 index 0000000..d89431e --- /dev/null +++ b/tests/Integration/ItemListTest_.php @@ -0,0 +1,137 @@ +getAll(); + + $this->assertCount(2, $items); + + $this->assertEquals('one', $items[0]); + $this->assertEquals('two', $items[1]); + + return $iL; + } + + /** + * @depends testConstructor + */ + public function testAdd(ItemList $iL) + { + $iL->add(null); + $iL->add('one'); + $iL->add('two')->add('two'); + + $items = $iL->getAll(); + + $this->assertCount(6, $items); + + $this->assertEquals(null, $items[2]); + $this->assertEquals('one', $items[3]); + $this->assertEquals('two', $items[4]); + $this->assertEquals('two', $items[5]); + + return $iL; + } + + /** + * @depends testAdd + */ + public function testCount(ItemList $iL) + { + $this->assertCount(6, $iL); + + return $iL; + } + + /** + * @depends testCount + */ + public function testForEach(ItemList $iL) + { + $i = 0; + + foreach ($iL as $item) { + if ($i === 2) { + $this->assertNull($item); + } + + $i++; + } + + $this->assertEquals(6, $i); + + return $iL; + } + + /** + * @depends testForEach + */ + public function testGet(ItemList $iL) + { + $item1 = $iL->get(0); + $item2 = $iL->get(2); + + $this->assertEquals('one', $item1); + $this->assertEquals(null, $item2); + + return $iL; + } + + /** + * @depends testGet + */ + public function testHas(ItemList $iL) + { + $this->assertTrue($iL->has(5)); + $this->assertFalse($iL->has(6)); + + return $iL; + } + + /** + * @depends testHas + */ + public function testHasByValue(ItemList $iL) + { + $iL->add('ten'); + + $this->assertTrue($iL->hasByValue('ten')); + + return $iL; + } + + /** + * @depends testHasByValue + */ + public function testRestricted(ItemList $iL) + { + $this->expectException(InvalidArgumentException::class); + + $iL->test = 'Should fail'; + } + +} diff --git a/tests/Integration/Validation/Validators/LaravelSyntaxValidatorTest_.php b/tests/Integration/Validation/Validators/LaravelSyntaxValidatorTest_.php new file mode 100644 index 0000000..51e2a05 --- /dev/null +++ b/tests/Integration/Validation/Validators/LaravelSyntaxValidatorTest_.php @@ -0,0 +1,38 @@ +object = new LaravelSyntaxValidator([], []); + } + + protected function tearDown() + { + + } + + public function testInitialisation() + { + $this->assertIsObject($this->object->getList()); + $this->assertIsObject($this->object->getOptions()); + $this->assertInstanceOf(MultiValueValidationable::class, $this->object); + + $this->assertIsString($this->object->getHash()); + $this->assertNotEmpty($this->object->getHash()); + } + +// public function testValidate() +// { +// +// } +} diff --git a/tests/Unit/ContainerLwTest.php b/tests/Unit/ContainerLwTest.php new file mode 100644 index 0000000..38fd363 --- /dev/null +++ b/tests/Unit/ContainerLwTest.php @@ -0,0 +1,170 @@ +getMockBuilder($className) + ->setMethods(['bind']) + ->disableOriginalConstructor() + ->getMock(); + + $reflectedClass = new \ReflectionClass($className); + $propBindings = $reflectedClass->getProperty('bindings'); + $propBindings->setAccessible(true); + $propInstances = $reflectedClass->getProperty('instances'); + $propInstances->setAccessible(true); + + $this->assertNull($propBindings->getValue($mock)); + $this->assertNull($propInstances->getValue($mock)); + + $constructor = $reflectedClass->getConstructor(); + $constructor->invoke($mock); + + $this->assertIsArray($propBindings->getValue($mock)); + $this->assertEmpty($propBindings->getValue($mock)); + $this->assertIsArray($propInstances->getValue($mock)); + $this->assertEmpty($propInstances->getValue($mock)); + } + public function testGetInstance() + { + $this->assertInstanceOf(ContainerLw::class, ContainerLw::getInstance()); + } + public function testGetInstanceSingleton() + { + $this->assertSame(ContainerLw::getInstance(), ContainerLw::getInstance()); + } + public function testBind() + { + $className = ContainerLw::class; + + $mock = $this->getMockBuilder($className) + ->setMethods(['bound']) + ->disableOriginalConstructor() + ->getMock(); + + $reflectedClass = new \ReflectionClass($className); + $prop = $reflectedClass->getProperty('bindings'); + $prop->setAccessible(true); + $prop->setValue($mock, []); + + $mock->bind('ht7/test'); + + $this->assertArrayHasKey('ht7/test', $prop->getValue($mock)); + $this->assertNull($prop->getValue($mock)['ht7/test']); + + $mock->bind('ht7/test/exception', \InvalidArgumentException::class); + + $this->assertArrayHasKey('ht7/test/exception', $prop->getValue($mock)); + $this->assertEquals(\InvalidArgumentException::class, $prop->getValue($mock)['ht7/test/exception']); + } + public function testBond() + { + $className = ContainerLw::class; + + $bindings = ['ht7/test' => null]; + + $mock = $this->getMockBuilder($className) + ->setMethods(['getBindings']) + ->disableOriginalConstructor() + ->getMock(); + $mock->expects($this->exactly(3)) + ->method('getBindings') + ->willReturn($bindings); + + $this->assertIsBool($mock->bound('ht7/test')); + $this->assertTrue($mock->bound('ht7/test')); + $this->assertFalse($mock->bound('ht7/test1')); + } +// public function testGet() +// { +// $className = ContainerLw::class; +// +// $bindings = ['ht7/test' => 'expected binding']; +// +// $mock = $this->getMockBuilder($className) +// ->setMethods(['getBindings']) +// ->disableOriginalConstructor() +// ->getMock(); +// $mock->expects($this->exactly(1)) +// ->method('getBindings') +// ->willReturn($bindings); +// +// $this->assertEquals($bindings['ht7/test'], $mock->get('ht7/test')); +// } + + public function testGet() + { + $className = ContainerLw::class; + + $bindings = ['ht7/test' => 'expected binding']; + + $mock = $this->getMockBuilder($className) + ->setMethods(['resolve']) + ->disableOriginalConstructor() + ->getMock(); + $mock->expects($this->exactly(1)) + ->method('resolve') + ->willReturn($bindings['ht7/test']); + + $this->assertEquals($bindings['ht7/test'], $mock->get('ht7/test')); + } +// public function testGetExceptionContainer() +// { +// $className = ContainerLw::class; +// +// $excBinding = [ +// 'ht7/exc' => function() { +// throw new \Exception(); +// } +// ]; +// $errBinding = ['exc/container/psr/container' => ContainerResolvingException::class]; +// +// $mock = $this->getMockBuilder($className) +// ->setMethods(['has', 'getBindings']) +// ->disableOriginalConstructor() +// ->getMock(); +// $mock->expects($this->exactly(1)) +// ->method('has') +// ->willReturn(true); +// $mock->expects($this->exactly(2)) +// ->method('getBindings') +//// ->will($this->returnCallback(function() { +// ->willReturnOnConsecutiveCalls($excBinding, $errBinding); +//// ->willReturnOnConsecutiveCalls($excBinding, $errBinding); +//// ->willReturn($excBinding, $errBinding); +//// ->will($this->returnValueMap([$bindings,])); +//// ->willReturn($bindings); +// +// $this->expectException(ContainerResolvingException::class); +// +// $mock->get('ht7/exc'); +// } + + public function testGetExceptionEntryNotFound() + { + $className = ContainerLw::class; + + $mock = $this->getMockBuilder($className) + ->setMethods(['getBindings']) + ->disableOriginalConstructor() + ->getMock(); + $mock->expects($this->exactly(2)) + ->method('getBindings') + ->willReturn([], ['exc/container/psr/notfound' => EntryNotFoundException::class]); + + $this->expectException(EntryNotFoundException::class); + + $mock->get('ht7/not_found'); + } +// public function testGetBindings +} diff --git a/tmp/src/ContainerLw.php b/tmp/src/ContainerLw.php new file mode 100644 index 0000000..acbb5be --- /dev/null +++ b/tmp/src/ContainerLw.php @@ -0,0 +1,136 @@ +test = 'test'; + $this->bindings = []; + $this->instances = []; + + $this->bind('exc/container/psr/container', ContainerResolvingException::class); + $this->bind('exc/container/psr/notfound', EntryNotFoundException::class); + } + public static function getInstance() + { + if (empty(self::$instance)) { + static::$instance = new static(); + } + + return static::$instance; + } + /** + * {@inheritdoc} + */ + public function bind($abstract, $concrete = null, $shared = true) + { + $this->bindings[$abstract] = $concrete; + } + /** + * Alias of ContainerLw::has($abstract) + * + * {@inheritdoc} + */ + public function bound($abstract) + { + return $this->has($abstract); + } + /** + * Get the binding of the present abstract. + * + * {@inheritdoc} + */ + public function get($abstract) + { + return $this->resolve($abstract); + } + public function getBindings() + { + return $this->bindings; + } + public function getInstances() + { + return $this->instances; + } + /** + * {@inheritdoc} + */ + public function has($abstract) + { + return array_key_exists($abstract, $this->getBindings()); + } + /** + * {@inheritdoc} + */ + public function instance($abstract, $instance) + { + $this->bind($abstract, get_class($instance), true); + + $this->instances[$abstract] = $instance; + } + /** + * {@inheritdoc} + */ + public function make($abstract, $parameters = []) + { + return $this->resolve($abstract, $parameters); + } + public function reset() + { + $this->bindings = []; + $this->instances = []; + } + public function resolve($abstract, $parameters = []) + { + if ($this->has($abstract)) { + $instances = $this->getInstances(); + + if (array_key_exists($abstract, $instances)) { + return $instances[$abstract]; + } else { + $class = $this->getBindings()[$abstract]; + + try { + if (is_callable($class)) { + $instances[$abstract] = $class(...$parameters); + } elseif (!count($parameters)) { + $instances[$abstract] = new $class(); + } elseif (count($parameters) === 1) { + $instances[$abstract] = new $class($parameters[0]); + } else { + $instances[$abstract] = new $class(...$parameters); + } + } catch (\Exception $e) { + $class = $this->getBindings()['exc/container/psr/container']; + throw new $class($e->getMessage(), $e->getCode(), $e); + } + } + } else { + $class = $this->getBindings()['exc/container/psr/notfound']; + throw new $class(); + } + } + /** + * {@inheritdoc} + */ + public function singleton($abstract, $concrete = null) + { + $this->bind($abstract, $concrete, true); + } +} diff --git a/tmp/src/ContainerLwable.php b/tmp/src/ContainerLwable.php new file mode 100644 index 0000000..57d9929 --- /dev/null +++ b/tmp/src/ContainerLwable.php @@ -0,0 +1,49 @@ +UndefinedConstantException if a constant + * could not be found. + * + * @param string $name The constant name. This value will automatically + * transformed to uppercase letters. + * @return mixed The constant value, if there has been found one with + * the given name, otherwise an exception. + * @throws UndefinedConstantException + */ + public static function getConstant($name) + { +// $constant = constant('static::' . strtoupper($name)); + + if (!defined('static::' . $name)) { +// if ($constant === null) { + // @todo.. + $message = sprintf('Undefined constant %s', $name); + + throw new UndefinedConstantException($message); + } + $constant = constant('static::' . strtoupper($name)); + + return $constant; + } +} diff --git a/tmp/src/Exceptions/ContainerResolvingException.php b/tmp/src/Exceptions/ContainerResolvingException.php new file mode 100644 index 0000000..e7bd23b --- /dev/null +++ b/tmp/src/Exceptions/ContainerResolvingException.php @@ -0,0 +1,16 @@ +Iterator + * interface. + * + * @author Thomas Pluess + * @version 0.0.1 + * @since 0.0.1 + */ +class SimpleAssocIterator extends SimpleIndexIterator +{ + + /** + * @var array The array keys. + */ + protected $keys; + + public function __construct(array $array) + { + parent::__construct($array); + + $this->keys = array_keys($array); + } + + /** + * {@inheritdoc} + */ + public function key() + { + return $this->keys[$this->position]; + } + + /** + * {@inheritdoc} + */ + public function valid() + { + return isset($this->keys[$this->position]); + } + +} diff --git a/tmp/src/Iterators/SimpleIndexIterator.php b/tmp/src/Iterators/SimpleIndexIterator.php new file mode 100644 index 0000000..8189c4b --- /dev/null +++ b/tmp/src/Iterators/SimpleIndexIterator.php @@ -0,0 +1,76 @@ +Iterator + * interface. + * + * @author Thomas Pluess + * @version 0.0.1 + * @since 0.0.1 + */ +class SimpleIndexIterator implements Iterator +{ + + /** + * @var array The array to iterate. + */ + protected $array; + + /** + * + * @var integer The current position. + */ + protected $position; + + public function __construct(array $array) + { + $this->array = $array; + + $this->rewind(); + } + + /** + * {@inheritdoc} + */ + public function current() + { + return $this->array[$this->key()]; + } + + /** + * {@inheritdoc} + */ + public function key() + { + return $this->position; + } + + /** + * {@inheritdoc} + */ + public function next() + { + $this->position++; + } + + /** + * {@inheritdoc} + */ + public function rewind() + { + $this->position = 0; + } + + /** + * {@inheritdoc} + */ + public function valid() + { + return isset($this->array[$this->key()]); + } + +} diff --git a/tmp/src/Lists/AbstractItemList.php b/tmp/src/Lists/AbstractItemList.php new file mode 100644 index 0000000..42f1d66 --- /dev/null +++ b/tmp/src/Lists/AbstractItemList.php @@ -0,0 +1,140 @@ +load($data); + } + + /** + * {@inheritdoc} + */ + public abstract function add($item); + + /** + * {@inheritdoc} + */ + public abstract function merge(ItemListable $iL); + + /** + * {@inheritdoc} + */ + public function count() + { + return count($this->getAll()); + } + + /** + * {@inheritdoc} + */ + public function get($index) + { + return $this->items[$index]; + } + + /** + * {@inheritdoc} + */ + public function getAll() + { + return $this->items; + } + + /** + * Get an iterator. + * + * This method is the implementation of the IteratorAggergate interface, + * which makes this class accessable through the foreach loop. + * + * @return SimpleIndexIterator + */ + public function getIterator() + { + return new SimpleIndexIterator($this->getAll()); + } + + /** + * {@inheritdoc} + */ + public function getNext($index) + { + return empty($index) ? null : $this->items[($index + 1)]; + } + + /** + * {@inheritdoc} + */ + public function getPrevious($index) + { + return empty($index) ? null : $this->items[($index - 1)]; + } + + /** + * {@inheritdoc} + */ + public function has($index) + { + return isset($this->items[$index]); + } + + /** + * {@inheritdoc} + */ + public function hasByValue($compare) + { + return in_array($compare, $this->items); + } + + /** + * {@inheritdoc} + */ + public function load(array $data) + { + foreach ($data as $item) { + $this->add($item); + } + } + + /** + * {@inheritdoc} + */ + public function remove($index) + { + unset($this->items[$index]); + } + + /** + * Throw an InvalidArgumentException. + * + * @param mixed $index The invalid index. + * @throws InvalidArgumentException + */ + protected function handleInvalidIndex($index) + { + $e = 'Invalid index: ' . $index; + + throw new InvalidArgumentException($e); + } + +} diff --git a/tmp/src/Lists/HashList.php b/tmp/src/Lists/HashList.php new file mode 100644 index 0000000..e704f27 --- /dev/null +++ b/tmp/src/Lists/HashList.php @@ -0,0 +1,98 @@ +items[$item->getHash()] = $item; + } else { + // @todo: generalize the validation.. + $msg = 'The item has to be an implementation of the Hashable interface, found %s'; + $e = sprintf($msg, gettype($item)); + + throw new InvalidArgumentException($e); + } + + return $this; + } + + /** + * {@inheritdoc} + * + * @return SimpleAssocIterator + */ + public function getIterator() + { + return new SimpleAssocIterator($this->getAll()); + } + + /** + * {@inheritdoc} + */ + public function getNext($index) + { + $keys = array_keys($this->items); + $cIndex = array_search($index, $keys); + + if ($cIndex === false) { + $this->handleInvalidIndex($index); + } else { + if (count($keys) === ($cIndex + 1)) { + return null; + } else { + return $this->get($keys[$cIndex + 1]); + } + } + } + + /** + * {@inheritdoc} + */ + public function getPrevious($index) + { + $keys = array_keys($this->items); + $cIndex = array_search($index, $keys); + + if ($cIndex === false) { + $this->handleInvalidIndex($index); + } else { + if ($cIndex === 0) { + return null; + } else { + return $this->get($keys[$cIndex - 1]); + } + } + } + + /** + * Merge an instance of an implementation of the ItemListable + * interface with the present one. + * + * This method will add all inexistent Hashable items into the present + * HashList. + */ + public function merge(ItemListable $iL) + { + $this->items = array_merge($iL->getAll(), $this->getAll()); + } + +} diff --git a/tmp/src/Lists/Hashable.php b/tmp/src/Lists/Hashable.php new file mode 100644 index 0000000..60e7288 --- /dev/null +++ b/tmp/src/Lists/Hashable.php @@ -0,0 +1,19 @@ +HashLists. + * + * @author Thomas Pluess + */ +class HashableHashList extends HashList implements Hashable +{ + + protected $hash; + + public function __construct(string $hash, array $data = array()) + { + $this->setHash($hash); + + parent::__construct($data); + } + + /** + * {@inheritdoc} + */ + public function getHash() + { + return $this->hash; + } + + /** + * Set the hash of the present HashList. + * + * @param string $hash + */ + public function setHash(string $hash) + { + $this->hash = $hash; + } + +} diff --git a/tmp/src/Lists/ItemList.php b/tmp/src/Lists/ItemList.php new file mode 100644 index 0000000..2ae9679 --- /dev/null +++ b/tmp/src/Lists/ItemList.php @@ -0,0 +1,33 @@ +items[] = $item; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function merge(ItemListable $iL) + { + $this->items = array_merge($this->getAll(), $iL->getAll()); + } + +} diff --git a/tmp/src/Lists/ItemListable.php b/tmp/src/Lists/ItemListable.php new file mode 100644 index 0000000..df4135b --- /dev/null +++ b/tmp/src/Lists/ItemListable.php @@ -0,0 +1,95 @@ +sprintf() will be used to combine the + * several text parts. + * + * @author Thomas Plüss + */ +abstract class AbstractTranslator +{ + + /** + * The object which defines the mapping for the translation methods. + * + * @var AdapterList + */ + protected $adapterList; + + public function __construct(array $adapters = [], array $options = []) + { + // Initialize the adapter list with the default adapters. + $this->createAdapterList(); + // Override existing and add new ones. + $this->getAdapterList()->load($adapters); + } + + /** + * Create an adapter list with the default adapters. + */ + abstract public function createAdapterList(); + + /** + * Get the current translation adapter. + * + * In case this property was not set, an instance of this class will be returned. + * + * @return AdapterList + */ + public function getAdapterList() + { + return $this->adapterList; + } + + /** + * Translate a given text pattern with placeholders into a full text. + * This method supports only singular forms. + * + * @param string $str For simple and context translation types + * there is only one text pattern needed. + * @param array $parameters + * @param string $context The context of the translation. This is + * only needed for contextual translations. + * @return string The translated string. + */ + public function t($str, array $parameters = [], $context = '') + { + if (empty($context)) { + $adapter = $this->getAdapterList()->get('default'); + } else { + $adapter = $this->getAdapterList()->get($context); + } + + return $adapter->t($str, $parameters); + } + + /** + * + * @param string $str1 Singular string to translate. + * @param string $str2 Plural string to translate. + * @param array $parameters + * @param string $context The context of the translation. This is + * only needed for contextual translations. + * @return string The translated string. + */ + public function t2($str1, $str2, $count, array $parameters = [], $context = '') + { + if (empty($context)) { + $adapter = $this->getAdapterList()->get('default'); + } else { + $adapter = $this->getAdapterList()->get($context); + } + + return $adapter->t2($str1, $str2, $count, $parameters); + } + +} diff --git a/tmp/src/Localization/Adapters/AbstractAdapter.php b/tmp/src/Localization/Adapters/AbstractAdapter.php new file mode 100644 index 0000000..a1c692a --- /dev/null +++ b/tmp/src/Localization/Adapters/AbstractAdapter.php @@ -0,0 +1,48 @@ +context = $context; + } + + /** + * {@inheritdoc} + */ + public function getHash() + { + return $this->context; + } + + /** + * {@inheritdoc} + */ + public function getStorageType() + { + return $this->storageType; + } + + /** + * {@inheritdoc} + */ + public function setStorageType(StorageModelable $storageType) + { + $this->storageType = $storageType; + } + +} diff --git a/tmp/src/Localization/Adapters/AdapterList.php b/tmp/src/Localization/Adapters/AdapterList.php new file mode 100644 index 0000000..c78a1de --- /dev/null +++ b/tmp/src/Localization/Adapters/AdapterList.php @@ -0,0 +1,40 @@ + 1) { + array_unshift($args, $str2); + + return call_user_func_array('sprintf', $args); + } else { + return $this->t1($str1, $args); + } + } + +} diff --git a/tmp/src/Localization/Adapters/ContextAdapterable.php b/tmp/src/Localization/Adapters/ContextAdapterable.php new file mode 100644 index 0000000..5f87217 --- /dev/null +++ b/tmp/src/Localization/Adapters/ContextAdapterable.php @@ -0,0 +1,56 @@ + 1) { + $str = $str2; + } else { + $str = $str1; + } + + array_unshift($args, $count); + + return $this->t($str, $args); + } + +} diff --git a/tmp/src/Localization/Languages/Language.php b/tmp/src/Localization/Languages/Language.php new file mode 100644 index 0000000..d244a6e --- /dev/null +++ b/tmp/src/Localization/Languages/Language.php @@ -0,0 +1,20 @@ +language = $language; + } + +} diff --git a/tmp/src/Localization/Languages/LanguageList.php b/tmp/src/Localization/Languages/LanguageList.php new file mode 100644 index 0000000..db91d0f --- /dev/null +++ b/tmp/src/Localization/Languages/LanguageList.php @@ -0,0 +1,15 @@ +locale = $locale; + $this->language = $this->createLanguageFromLocaleString($locale); + } + + public function createLanguageFromLocaleString(string $locale) + { + return new Language(substr($locale, 0, 2)); + } + + public function getLocale() + { + return $this->locale; + } + + public function getLanguage() + { + return $this->language; + } + +} diff --git a/tmp/src/Localization/Locales/LocaleList.php b/tmp/src/Localization/Locales/LocaleList.php new file mode 100644 index 0000000..0a52250 --- /dev/null +++ b/tmp/src/Localization/Locales/LocaleList.php @@ -0,0 +1,15 @@ +sprintf() will be used to combine the + * several text parts. + * + * @author Thomas Plüss + */ +class Translator +{ + + /** + * The object which defines the mapping for the translation methods. + * + * @var AdapterList + */ + protected $adapterList; + + public function __construct(array $adapters = [], array $options = []) + { + // Initialize the adapter list with the default adapters. + $this->createAdapterList(); + // Override existing and add new ones. + $this->getAdapterList()->load($adapters); + } + + /** + * Create an adapter list with the default adapters. + */ + public function createAdapterList() + { + $adapters = [ + 'default' => '' + ]; + + $this->adapterList = new AdapterList($adapters); + } + + /** + * Get the current translation adapter. + * + * In case this property was not set, an instance of this class will be returned. + * + * @return AdapterList + */ + public function getAdapterList() + { + return $this->adapterList; + } + + /** + * Translate a given text pattern with placeholders into a full text. + * This method supports only singular forms. + * + * @param string $str For simple and context translation types + * there is only one text pattern needed. + * @param array $parameters + * @param string $context The context of the translation. This is + * only needed for contextual translations. + * @return string The translated string. + */ + public static function t($str, array $parameters = [], $context = '') + { + if (empty($context)) { + $adapter = $this->getAdapterList()->get('default'); + } else { + $adapter = $this->getAdapterList()->get($context); + } + + return $adapter->t($str, $parameters); + } + + /** + * + * @param string $str1 Singular string to translate. + * @param string $str2 Plural string to translate. + * @param array $parameters + * @param string $context The context of the translation. This is + * only needed for contextual translations. + * @return string The translated string. + */ + public static function t2($str1, $str2, $count, array $parameters = [], $context = '') + { + $adapter = static::getAdapter(); + + if (empty($context)) { + $return = $adapter->t2($str1, $str2, $count, $parameters); + } else { + $return = $adapter->t4($context, $str1, $str2, $count, $parameters); + } + + return $return; + } + +} diff --git a/src/Localization/Translator.php b/tmp/src/Localization/TranslatorOld.php similarity index 99% rename from src/Localization/Translator.php rename to tmp/src/Localization/TranslatorOld.php index ee1c40e..49dd729 100644 --- a/src/Localization/Translator.php +++ b/tmp/src/Localization/TranslatorOld.php @@ -9,7 +9,7 @@ * * @author Thomas Plüss */ -class Translator +class TranslatorOld { /** diff --git a/tmp/src/Localization/Translatorable.php b/tmp/src/Localization/Translatorable.php new file mode 100644 index 0000000..597d40e --- /dev/null +++ b/tmp/src/Localization/Translatorable.php @@ -0,0 +1,12 @@ +resolve($options); + } + + if ($options instanceof BaseOptions) { + + } else { + throw new \InvalidArgumentException('Invalid datatype.'); + } + } + + public function load(array $types) + { + foreach ($types as $typeKey => $type) { + if (is_string($type)) { + + } + + $this->add($type); + } + } + + public function reslove(array $options) + { + if ($this->has($options['index'])) { + $this->get($options['index'])->load($options); + } else { + + } + + return $this->get($options['index']); + } + +} diff --git a/tmp/src/Messages/MessageTypes.php b/tmp/src/Messages/MessageTypes.php new file mode 100644 index 0000000..85379df --- /dev/null +++ b/tmp/src/Messages/MessageTypes.php @@ -0,0 +1,17 @@ +setupDefaults(); + + parent::__construct($data); + } + + /** + * {@inheritdoc} + */ + public function getDefaults() + { + return []; + } + + /** + * {@inheritdoc} + */ + public function getOptionsClass() + { + return $this->optionsClass; + } + + /** + * {@inheritdoc} + */ + public function getPatternsClass() + { + return $this->patternsClass; + } + + /** + * {@inheritdoc} + */ + public function getTranslator() + { + return $this->translator; + } + + /** + * {@inheritdoc} + */ + public function getType() + { + return $this->type; + } + + /** + * {@inheritdoc} + */ + public function getTypeClass() + { + return $this->typeClass; + } + + /** + * {@inheritdoc} + */ + public function setOptionsClass($optionsClass) + { + $this->optionsClass = $optionsClass; + } + + /** + * {@inheritdoc} + */ + public function setPatternsClass($patternsClass) + { + $this->patternsClass = $patternsClass; + } + + /** + * {@inheritdoc} + */ + public function setTranslator($translator) + { + $this->translator = $translator; + } + + /** + * {@inheritdoc} + */ + public function setType($type) + { + $this->type = $type; + } + + /** + * {@inheritdoc} + */ + public function setTypeClass($typeClass) + { + $this->typeClass = $typeClass; + } + + protected function setupDefaults() + { + $this->load($this->getDefaults()); + } + +} diff --git a/tmp/src/Messages/Options/Exception.php b/tmp/src/Messages/Options/Exception.php new file mode 100644 index 0000000..1fbabfe --- /dev/null +++ b/tmp/src/Messages/Options/Exception.php @@ -0,0 +1,59 @@ +type = MessageTypes::EXCEPTION; + + parent::__construct($data); + } + + public function getDefaults() + { + return array_merge(parent::getDefaults(), [ + 'patternsClass' => ExceptionPattern::class, + 'typeClass' => ExceptionType::class + ]); + } + + public function getIndex() + { + return $this->index; + } + + public function getParts() + { + return $this->parts; + } + + public function setIndex(string $index) + { + $this->index = $index; + } + + public function setParts(object $parts) + { + $this->parts = $parts; + } + +} diff --git a/tmp/src/Messages/Options/Optionable.php b/tmp/src/Messages/Options/Optionable.php new file mode 100644 index 0000000..afd28c7 --- /dev/null +++ b/tmp/src/Messages/Options/Optionable.php @@ -0,0 +1,93 @@ +Ht7\Base\Messages\MessageTypes. + */ + public function setType(int $type); + + /** + * Set the type class definition. + * + * @param string $typeClass The type class definition. + */ + public function setTypeClass(string $typeClass); +} diff --git a/tmp/src/Messages/Options/Parts/InvalidDataTypeException.php b/tmp/src/Messages/Options/Parts/InvalidDataTypeException.php new file mode 100644 index 0000000..dcf84af --- /dev/null +++ b/tmp/src/Messages/Options/Parts/InvalidDataTypeException.php @@ -0,0 +1,71 @@ +allowedClasses; + } + + public function getAllowedPrimitives() + { + return $this->allowedPrimitives; + } + + public function getClassPartsPattern() + { + return $this->classPartsPattern; + } + + public function getNameInvalidProperty() + { + return $this->nameInvalidProperty; + } + + public function getValueInvalidProperty() + { + return $this->valueInvalidProperty; + } + + public function setAllowedClasses($allowedClasses) + { + $this->allowedClasses = $allowedClasses; + } + + public function setAllowedPrimitives($allowedPrimitives) + { + $this->allowedPrimitives = $allowedPrimitives; + } + + public function setClassPartsPattern($classPartsPattern) + { + $this->classPartsPattern = $classPartsPattern; + } + + public function setNameInvalidProperty($nameInvalidProperty) + { + $this->nameInvalidProperty = $nameInvalidProperty; + } + + public function setValueInvalidProperty($valueInvalidProperty) + { + $this->valueInvalidProperty = $valueInvalidProperty; + } + +} diff --git a/tmp/src/Messages/Patterns/InvalidDataTypeException.php b/tmp/src/Messages/Patterns/InvalidDataTypeException.php new file mode 100644 index 0000000..518e965 --- /dev/null +++ b/tmp/src/Messages/Patterns/InvalidDataTypeException.php @@ -0,0 +1,50 @@ +setOptions($options); + } + + abstract public function text(); + + public function getHash() + { + return $this->type; + } + + /** + * + * @return BaseOptions + */ + public function getOptions() + { + return $this->options; + } + +// +// public function getStrings() +// { +// if (empty($this->getStrings())) { +// $this->strings = $this->getOptions()->getStringsClass()(); +// } +// +// return $this->strings; +// } + + public function getTranslator() + { + if (is_string($this->getOptions()->getTranslator())) { + $this->getOptions()->setTranslator((new ($this->getOptions()->getTranslator())())); + } + + return $this->getOptions()->getTranslator(); + } + + public function getType() + { + return $this->type; + } + + public function setOptions(BaseOptions $options) + { + $this->options = $options; + } + +// +// public function setStrings($strings) +// { +// $this->strings = $strings; +// } + + public function setType($type) + { + $this->type = $type; + } + +} diff --git a/tmp/src/Messages/Types/Exception.php b/tmp/src/Messages/Types/Exception.php new file mode 100644 index 0000000..f94b10f --- /dev/null +++ b/tmp/src/Messages/Types/Exception.php @@ -0,0 +1,30 @@ +type = MessageTypes::EXCEPTION; + + parent::__construct($options); + } + + public function text() + { + + } + +} diff --git a/tmp/src/Messages/Types/Parts/InvalidDataTypeException.php b/tmp/src/Messages/Types/Parts/InvalidDataTypeException.php new file mode 100644 index 0000000..d2acd93 --- /dev/null +++ b/tmp/src/Messages/Types/Parts/InvalidDataTypeException.php @@ -0,0 +1,93 @@ +getParts()->getAllowedClasses(); + $partsPatternClass = $options->getParts()->getClassPartsPattern(); + + switch (count($classes)) { + case 0: + return $text; + case 1: + $text = constant($partsPatternClass . '::CLASSES_ONE'); + break; + case 2: + $text = constant($partsPatternClass . '::CLASSES_TWO'); + break; + case 3: + default: + $text = constant($partsPatternClass . '::CLASSES_MT_TWO'); + $instances = [implode(', ', $instances)]; + break; + } + + return Translator::t($text, $instances); + } + + /** + * Get the translation text of a composition of primitiv datatypes and + * instances. + * + * @param string $primitiv The transformed string of primitiv datatypes. + * @param string $instances The transformed string of instances. + * @return string The composed message. + */ + public function getParameters($primitiv, $instances) + { + if (empty($primitiv) && empty($instances)) { + // @todo: throw error. + return 'undefined'; + } elseif (!empty($primitiv) && empty($instances)) { + return $this->getPrimitivs($primitiv); + } elseif (empty($primitiv) && !empty($instances)) { + return $this->getInstances($instances); + } else { + $arr = [ + $this->getPrimitivs($primitiv), + $this->getInstances($instances) + ]; + + return Translator::t(HelperMessages::INSTANCES_PRIMITIV, $arr); + } + } + + /** + * Get the translation for a list of primitiv datatypes. + * + * @param array $list Indexed array of primitiv datatypes. + * @return string The composed datatype string. + */ + public function getPrimitivs(array $list) + { + return Translator::t( + HelperMessages::PRIMITIV_MT_ZERO, + [implode(', ', $list)] + ); + } + +} diff --git a/src/Models/AbstractLoadableModel.php b/tmp/src/Models/AbstractLoadableModel.php similarity index 100% rename from src/Models/AbstractLoadableModel.php rename to tmp/src/Models/AbstractLoadableModel.php diff --git a/src/Models/AbstractTransLoadableModel.php b/tmp/src/Models/AbstractTransLoadableModel.php similarity index 100% rename from src/Models/AbstractTransLoadableModel.php rename to tmp/src/Models/AbstractTransLoadableModel.php diff --git a/src/Models/Loadable.php b/tmp/src/Models/Loadable.php similarity index 100% rename from src/Models/Loadable.php rename to tmp/src/Models/Loadable.php diff --git a/src/Models/TransLoadable.php b/tmp/src/Models/TransLoadable.php similarity index 100% rename from src/Models/TransLoadable.php rename to tmp/src/Models/TransLoadable.php diff --git a/tmp/src/Registry/Entry.php b/tmp/src/Registry/Entry.php new file mode 100644 index 0000000..8ac6d62 --- /dev/null +++ b/tmp/src/Registry/Entry.php @@ -0,0 +1,26 @@ +name; + } + + public function getType() + { + ; + } + +} diff --git a/tmp/src/Registry/Registry.php b/tmp/src/Registry/Registry.php new file mode 100644 index 0000000..9dca463 --- /dev/null +++ b/tmp/src/Registry/Registry.php @@ -0,0 +1,44 @@ +classes = new Classes(); + } + + public function getClasses() + { + return $this->classes; + } + + public function getEntry() + { + return []; + } + + public function register(Entry $entry) + { + + } + +} diff --git a/tmp/src/Registry/Task/Task.php b/tmp/src/Registry/Task/Task.php new file mode 100644 index 0000000..ffde311 --- /dev/null +++ b/tmp/src/Registry/Task/Task.php @@ -0,0 +1,30 @@ +name; + } + + public function getType() + { + ; + } + +} diff --git a/tmp/src/Registry/Types/Classes.php b/tmp/src/Registry/Types/Classes.php new file mode 100644 index 0000000..b782c69 --- /dev/null +++ b/tmp/src/Registry/Types/Classes.php @@ -0,0 +1,15 @@ +items[get_class($item)] = $item; + + return $this; + } + +} diff --git a/tmp/src/Storage/Models/AbstractStorageModel.php b/tmp/src/Storage/Models/AbstractStorageModel.php new file mode 100644 index 0000000..1090b15 --- /dev/null +++ b/tmp/src/Storage/Models/AbstractStorageModel.php @@ -0,0 +1,30 @@ +StorageModelable interface. + * + * @author Thomas Pluess + */ +abstract class AbstractStorageModel implements StorageModelable +{ + + /** + * @var int The storage type of the present model. + * One of the constants defined in + * \Ht7\Base\Storage\StorageTypes. + */ + protected $storageType; + + /** + * {@inheritdoc} + */ + public function getStorageType() + { + return $this->storageType; + } + +} diff --git a/tmp/src/Storage/Models/StorageModelable.php b/tmp/src/Storage/Models/StorageModelable.php new file mode 100644 index 0000000..547106e --- /dev/null +++ b/tmp/src/Storage/Models/StorageModelable.php @@ -0,0 +1,20 @@ +session.options_php.use_cookies = 1 by a CLI + * request, this storage will not work. + */ + const SESSION = 3; + + /** + * The data is stored in a cookie on the client. + * + * This does not work in case the request is from a CLI. + */ + const COOKIE = 4; + + /** + * + */ + const CLASS_CONSTANT = 21; + +} diff --git a/tmp/src/Storage/Types/ClassConstants/ClassConstantModel.php b/tmp/src/Storage/Types/ClassConstants/ClassConstantModel.php new file mode 100644 index 0000000..db2fc86 --- /dev/null +++ b/tmp/src/Storage/Types/ClassConstants/ClassConstantModel.php @@ -0,0 +1,48 @@ +storageType = StorageTypes::CLASS_CONSTANT; + + $this->setClass($class); +// $this->setConstant($constant); + } + + public function getClass() + { + return $this->class; + } + +// public function getConstant() +// { +// return $this->constant; +// } + + public function setClass(string $class) + { + $this->class = $class; + } + +// public function setConstant(string $contstant) +// { +// $this->constant = $contstant; +// } +} diff --git a/tmp/src/Storage/Types/None/NoneModel.php b/tmp/src/Storage/Types/None/NoneModel.php new file mode 100644 index 0000000..d3198b8 --- /dev/null +++ b/tmp/src/Storage/Types/None/NoneModel.php @@ -0,0 +1,21 @@ +storageType = StorageTypes::NONE; + } + +} diff --git a/src/Utility/Importers/AbstractImporter.php b/tmp/src/Utility/Importers/AbstractImporter.php similarity index 100% rename from src/Utility/Importers/AbstractImporter.php rename to tmp/src/Utility/Importers/AbstractImporter.php diff --git a/src/Utility/Importers/Files/ArrayImporter.php b/tmp/src/Utility/Importers/Files/ArrayImporter.php similarity index 100% rename from src/Utility/Importers/Files/ArrayImporter.php rename to tmp/src/Utility/Importers/Files/ArrayImporter.php diff --git a/src/Utility/Importers/Importable.php b/tmp/src/Utility/Importers/Importable.php similarity index 100% rename from src/Utility/Importers/Importable.php rename to tmp/src/Utility/Importers/Importable.php diff --git a/src/Utility/Strings.php b/tmp/src/Utility/Strings.php similarity index 100% rename from src/Utility/Strings.php rename to tmp/src/Utility/Strings.php diff --git a/tmp/src/Utility/Traits/CanAddByPropertyName.php b/tmp/src/Utility/Traits/CanAddByPropertyName.php new file mode 100644 index 0000000..90d68bc --- /dev/null +++ b/tmp/src/Utility/Traits/CanAddByPropertyName.php @@ -0,0 +1,25 @@ +$method($value); + } else { + throw new \InvalidArgumentException('Unkown property: ' . $name); + } + } + +} diff --git a/tmp/src/Utility/Traits/CanRestrictInexVariables.php b/tmp/src/Utility/Traits/CanRestrictInexVariables.php new file mode 100644 index 0000000..88e1d22 --- /dev/null +++ b/tmp/src/Utility/Traits/CanRestrictInexVariables.php @@ -0,0 +1,21 @@ +AbstractValidator class. + * + * @param array $items Assoc array of type names/type class + * definition pairs. + */ + public function __construct(array $items, $options) + { + if (is_array($options)) { + $options = $this->createOptionsFromArray($options); + } else if (!($options instanceof BaseOptionable)) { + $e = 'The options parameter has to be an array or an instance of' + . ' ' . BaseOptionable::class . '.'; + + throw \InvalidArgumentException($e); + } + + $this->setOptions($options); + + if ($options->getIsMerged()) { + $items = array_merge($this->getDefaults(), $items); + } + + $this->setList($this->createListFromArray($items)); + } + + /** + * {@inheritdoc} + */ + public function getHash() + { + return $this->hash; + } + + /** + * {@inheritdoc} + */ + public function getList() + { + return $this->list; + } + + /** + * {@inheritdoc} + */ + public function getOptions() + { + return $this->options; + } + + /** + * {@inheritdoc} + */ + public function setList(AbstractValidationList $list) + { + $this->list = $list; + } + + /** + * {@inheritdoc} + */ + public function setOptions($options) + { + $this->options = $options; + } + +} diff --git a/tmp/src/Validation/Error/ThrowHandler.php b/tmp/src/Validation/Error/ThrowHandler.php new file mode 100644 index 0000000..d90fe59 --- /dev/null +++ b/tmp/src/Validation/Error/ThrowHandler.php @@ -0,0 +1,43 @@ +defaultExceptionClass = InvalidArgumentException::class; + + $this->setExceptionClass($options); + } + + public function setExceptionClass(Options $options) + { + if (method_exists($options, 'getErrorOptions')) { + + } + } + + public function throwException(string $class, $msg = '') + { + if (empty($msg)) { + + } else { + throw new $class($msg); + } + } + +} diff --git a/tmp/src/Validation/Iterators/RuleListIterator.php b/tmp/src/Validation/Iterators/RuleListIterator.php new file mode 100644 index 0000000..f891e98 --- /dev/null +++ b/tmp/src/Validation/Iterators/RuleListIterator.php @@ -0,0 +1,22 @@ +AbstractValidationList class. + * + * @param array $data The items to add to the list of the new + * instance. + */ + public function __construct(array $data = []) + { + parent::__construct($data); + } + + /** + * Get the isCached flag. + * + * @return boolean True if the new instances should be stored + * instead of their class name. + */ + public function getIsCached() + { + return $this->isCached; + } + + public function load(array $data) + { + foreach ($data as $key => $value) { + if (is_string($value) || is_object($value)) { + $this->items[$key] = $value; + } + } + } + + /** + * Set the isCached flag. + * + * @param boolean $isCached True if the new instances should be stored + * instead of their class name. + * @return void + */ + public function setIsCached($isCached) + { + $this->isCached = $isCached ? true : false; + } + +} diff --git a/tmp/src/Validation/Lists/RuleList.php b/tmp/src/Validation/Lists/RuleList.php new file mode 100644 index 0000000..68faa7f --- /dev/null +++ b/tmp/src/Validation/Lists/RuleList.php @@ -0,0 +1,40 @@ +getAll()); + } + +} diff --git a/tmp/src/Validation/Lists/TypeList.php b/tmp/src/Validation/Lists/TypeList.php new file mode 100644 index 0000000..b247514 --- /dev/null +++ b/tmp/src/Validation/Lists/TypeList.php @@ -0,0 +1,88 @@ +TypeList class. + * + * @param array $data An assoc array of the types. + * @param array $options + */ + public function __construct(array $data = [], array $options = []) + { + $opt = array_merge($this->getDefaults(), $options); + + $this->setOptions($this->createOptionsFromArray($opt)); + + parent::__construct($data); + } + + public function createOptionsFromArray(array $options) + { + return new TypeListOptions($options); + } + + public function get($index) + { + $item = parent::get($index); + + if (is_string($item)) { + $item = new $item(); + + if ($this->getOptions()->getIsCached()) { + $this->items[$index] = $item; + } + } + + return $item; + } + + /** + * Get the default options. + * + * @return array Assoc array of option name/option default value. + */ + public function getDefaults() + { + return [ + 'isCached' => true + ]; + } + + /** + * + * @return TypeListOptions + */ + public function getOptions() + { + return $this->options; + } + + /** + * + * @param TypeListOptions $options + */ + public function setOptions(TypeListOptions $options) + { + $this->options = $options; + } + +} diff --git a/tmp/src/Validation/Options/BaseOptionable.php b/tmp/src/Validation/Options/BaseOptionable.php new file mode 100644 index 0000000..d6ebe1d --- /dev/null +++ b/tmp/src/Validation/Options/BaseOptionable.php @@ -0,0 +1,47 @@ +isMerged; + } + + /** + * {@inheritdoc} + */ + public function getStopOnFail() + { + return $this->stopOnFail; + } + + /** + * {@inheritdoc} + */ + public function setIsMerged($isMerged) + { + $this->isMerged = $isMerged ? true : false; + } + + /** + * {@inheritdoc} + */ + public function setStopOnFail($stopOnFail) + { + $this->stopOnFail = $stopOnFail ? true : false; + } + +} diff --git a/tmp/src/Validation/Options/BaseTypeOptionable.php b/tmp/src/Validation/Options/BaseTypeOptionable.php new file mode 100644 index 0000000..96404f9 --- /dev/null +++ b/tmp/src/Validation/Options/BaseTypeOptionable.php @@ -0,0 +1,31 @@ +isCached flag. + * + * @return boolean True if the new instances should be stored + * instead of their class name. + */ + public function getIsCached() + { + return $this->isCached; + } + + /** + * Set the isCached flag. + * + * @param boolean $isCached True if the new instances should be stored + * instead of their class name. + * @return void + */ + public function setIsCached(bool $isCached) + { + $this->isCached = $isCached; + } + +} diff --git a/tmp/src/Validation/Rules/IsAlphaNumeric.php b/tmp/src/Validation/Rules/IsAlphaNumeric.php new file mode 100644 index 0000000..6771613 --- /dev/null +++ b/tmp/src/Validation/Rules/IsAlphaNumeric.php @@ -0,0 +1,25 @@ +getFormat(), $value); + + return $dt && $dt->format($options->getFormat()) == $value; + } + +} diff --git a/tmp/src/Validation/Rules/IsInstanceOf.php b/tmp/src/Validation/Rules/IsInstanceOf.php new file mode 100644 index 0000000..2270191 --- /dev/null +++ b/tmp/src/Validation/Rules/IsInstanceOf.php @@ -0,0 +1,26 @@ +getInstance(), true); + } + +} diff --git a/tmp/src/Validation/Rules/IsObject.php b/tmp/src/Validation/Rules/IsObject.php new file mode 100644 index 0000000..5a2187e --- /dev/null +++ b/tmp/src/Validation/Rules/IsObject.php @@ -0,0 +1,26 @@ +$options->getValuesIncluded(). + * + * {@inheritdoc} + */ + public function check($value, BaseTypeOptionable $options) + { + /* @var $options Ht7\Base\Validation\Types\Options\ValuesIncluded */ + return in_array($value, $options->getValuesIncluded()); + } + +} diff --git a/tmp/src/Validation/Rules/IsRequired.php b/tmp/src/Validation/Rules/IsRequired.php new file mode 100644 index 0000000..ab99477 --- /dev/null +++ b/tmp/src/Validation/Rules/IsRequired.php @@ -0,0 +1,25 @@ +getList() as $key => $rule) { + if (!$rule->check($value, $options)) { + $result = false; + + $this->handleValidationFail($value, $name, $key, $options); + + if ($options->getBaseOptions()->getStopOnFail()) { + return false; + } + } + } + + return $result; + } + +} diff --git a/tmp/src/Validation/Types/AbstractType.php b/tmp/src/Validation/Types/AbstractType.php new file mode 100644 index 0000000..0ca393c --- /dev/null +++ b/tmp/src/Validation/Types/AbstractType.php @@ -0,0 +1,41 @@ +type; + } + + /** + * {@inheritdoc} + */ + public function handleValidationFail($value, string $name, string $check, $options) + { +// if ($options->getBaseOptions()->getThrowOnFail()) { +// +// } + } + +} diff --git a/tmp/src/Validation/Types/AbstractTypeOld.php b/tmp/src/Validation/Types/AbstractTypeOld.php new file mode 100644 index 0000000..d108e97 --- /dev/null +++ b/tmp/src/Validation/Types/AbstractTypeOld.php @@ -0,0 +1,82 @@ +AbstractType class. + * + * @param array $rules Assoc array with the rules definitions. + */ + public function __construct(array $rules = [], bool $isMerged = true) + { + $rulesMerged = $isMerged ? array_merge($this->getDefaults(), $rules) : $rules; + + $this->setRuleList($this->createRuleListFromArray($rulesMerged)); + } + + /** + * {@inheritdoc} + */ + public function createRuleListFromArray(array $rules) + { + return new RuleList($rules); + } + + /** + * {@inheritdoc} + */ + public function getHash() + { + return $this->type; + } + + /** + * {@inheritdoc} + */ + public function getRuleList() + { + return $this->ruleList; + } + + /** + * {@inheritdoc} + */ + public function handleValidationFail($value, string $name, string $check, $options) + { + if ($options->getBase()->getThrowOnFail()) { + + } + } + + /** + * {@inheritdoc} + */ + public function setRuleList(RuleList $ruleList) + { + $this->ruleList = $ruleList; + } + +} diff --git a/tmp/src/Validation/Types/Accepted.php b/tmp/src/Validation/Types/Accepted.php new file mode 100644 index 0000000..2db3de7 --- /dev/null +++ b/tmp/src/Validation/Types/Accepted.php @@ -0,0 +1,33 @@ +getPrimitives(); + + if (!empty($options->getPrimitives())) { +// $this->get + } + } + +} diff --git a/tmp/src/Validation/Types/DefaultTypes.php b/tmp/src/Validation/Types/DefaultTypes.php new file mode 100644 index 0000000..2a2a087 --- /dev/null +++ b/tmp/src/Validation/Types/DefaultTypes.php @@ -0,0 +1,29 @@ + Accepted::class, + 'instanceOf' => InstOf::class, + ]; + } + +} diff --git a/tmp/src/Validation/Types/InstOf.php b/tmp/src/Validation/Types/InstOf.php new file mode 100644 index 0000000..c568f80 --- /dev/null +++ b/tmp/src/Validation/Types/InstOf.php @@ -0,0 +1,35 @@ +base; + } + + /** + * {@inheritdoc} + */ + public function setBaseOptions(BaseOptionable $options) + { + $this->base = $options; + } + +} diff --git a/tmp/src/Validation/Types/Options/DatatypeOptions.php b/tmp/src/Validation/Types/Options/DatatypeOptions.php new file mode 100644 index 0000000..d91b129 --- /dev/null +++ b/tmp/src/Validation/Types/Options/DatatypeOptions.php @@ -0,0 +1,58 @@ + 'instance', + 'object' => 'instance', + 'objs' => 'instances', + 'objects' => 'instances', + ]; + + parent::__construct($data, $transformations); + } + + public function getPrimitives() + { + return $this->primitives; + } + + public function getInstances() + { + return $this->instance; + } + + public function setPrimitives($primitives) + { + $this->primitives = $primitives; + } + + public function setInstances(array $instances) + { + $this->instances = $instances; + } + +} diff --git a/tmp/src/Validation/Types/Options/InstOf.php b/tmp/src/Validation/Types/Options/InstOf.php new file mode 100644 index 0000000..2cca42b --- /dev/null +++ b/tmp/src/Validation/Types/Options/InstOf.php @@ -0,0 +1,52 @@ + 'instance', + 'object' => 'instance' + ]; + + parent::__construct($data, $transformations); + } + + public function getClass() + { + return $this->class; + } + + public function getInstance() + { + return $this->instance; + } + + public function setClass($class) + { + $this->class = $class; + } + + public function setInstance($instance) + { + $this->instance = $instance; + } + +} diff --git a/tmp/src/Validation/Types/Options/ValuesIncluded.php b/tmp/src/Validation/Types/Options/ValuesIncluded.php new file mode 100644 index 0000000..eddae13 --- /dev/null +++ b/tmp/src/Validation/Types/Options/ValuesIncluded.php @@ -0,0 +1,31 @@ +valuesIncluded; + } + + public function setValuesIncluded($valuesIncluded) + { + $this->valuesIncluded = $valuesIncluded; + } + +} diff --git a/tmp/src/Validation/Types/Parameters/AbstractTypeParameter.php b/tmp/src/Validation/Types/Parameters/AbstractTypeParameter.php new file mode 100644 index 0000000..efd8c03 --- /dev/null +++ b/tmp/src/Validation/Types/Parameters/AbstractTypeParameter.php @@ -0,0 +1,15 @@ + 'instance', + 'object' => 'instance' + ]; + + parent::__construct($data, $transformations); + } + + public function getClass() + { + return $this->class; + } + + public function getInstance() + { + return $this->instance; + } + + public function setClass($class) + { + $this->class = $class; + } + + public function setInstance($instance) + { + $this->instance = $instance; + } + +} diff --git a/tmp/src/Validation/Types/SingleValueValidationable.php b/tmp/src/Validation/Types/SingleValueValidationable.php new file mode 100644 index 0000000..35af0d1 --- /dev/null +++ b/tmp/src/Validation/Types/SingleValueValidationable.php @@ -0,0 +1,24 @@ +get(); + } + + /** + * Get the validation type list. + * + * @return TypeList The validation type list. + */ + public function getList() + { + return parent::getList(); + } + + /** + * Set the validation type list. + * + * @param TypeList $list The validation type list. + * @return void + */ + public function setList($list) + { + if ($list instanceof TypeList) { + parent::setList($list); + } else { + $e = 'The list parameter has to be an instance of ' . TypeList::class . '.'; + + throw new InvalidArgumentException($e); + } + } + +} diff --git a/tmp/src/Validation/Validators/AbstractValidatorOld.php b/tmp/src/Validation/Validators/AbstractValidatorOld.php new file mode 100644 index 0000000..cbf52ef --- /dev/null +++ b/tmp/src/Validation/Validators/AbstractValidatorOld.php @@ -0,0 +1,74 @@ +AbstractValidator class. + * + * @param array $types Assoc array of type names/type class + * definition pairs. + */ + public function __construct(array $types, $isMerged = true) + { + $typesMerged = $isMerged ? array_merge($this->getDefaults(), $types) : $types; + + $this->setTypeList($this->createTypeListFromArray($typesMerged)); + } + + abstract public function getDefaults(); + + /** + * Create a validation type list by an array and return it. + * + * @param array $types Assoc array of type names/type class + * definition pairs. + * @return TypeList The validation type list created + * with the present type definitions. + */ + public function createTypeListFromArray(array $types) + { + return new TypeList($types, []); + } + + /** + * Get the validation type list. + * + * @return TypeList The validation type list. + */ + public function getTypeList() + { + return $this->typeList; + } + + /** + * Set the validation type list. + * + * @param TypeList $typeList The validation type list. + * @return void + */ + public function setTypeList(TypeList $typeList) + { + $this->typeList = $typeList; + } + +} diff --git a/tmp/src/Validation/Validators/LaravelSyntaxValidator.php b/tmp/src/Validation/Validators/LaravelSyntaxValidator.php new file mode 100644 index 0000000..6611d5b --- /dev/null +++ b/tmp/src/Validation/Validators/LaravelSyntaxValidator.php @@ -0,0 +1,75 @@ +hash = 'laravel_syntax'; + + parent::__construct($items, $options); + } + + public function checkItemRules(string $name, $values, $rules) + { + if (is_string($rules)) { + $tL = $this->getTransformer()->createTypeListFromString($rules); + } elseif (is_array($rules)) { + $tL = $this->getTransformer()->createTypeListFromString($rules); + } elseif (!is_array($rules)) { + throw new InvalidArgumentException('The rules need to be an array or string.'); + } + + foreach ($tL as $key => $type) { + if ($type instanceof SingleValueValidationable) { + $type->validate($values[$name], $rules, []); + } elseif ($type instanceof MultiValueValidationable) { + $type->validate($values, $rules, []); + } + } + } + + /** + * {@inheritdoc} + */ + public function createOptionsFromArray(array $options) + { + return new BaseOptions($options); + } + + public function getTransformer() + { + if (empty($this->transformer)) { + $this->transformer = new LaravelTransformer($this->getList()); + } + + return $this->transformer; + } + + public function validate(array $values, array $rules, array $options = []) + { + foreach ($rules as $name => $itemRules) { + $result = $this->checkItemRules($name, $values, $itemRules); + } + } + +} diff --git a/tmp/src/Validation/Validators/MultiValueValidationable.php b/tmp/src/Validation/Validators/MultiValueValidationable.php new file mode 100644 index 0000000..0babfb6 --- /dev/null +++ b/tmp/src/Validation/Validators/MultiValueValidationable.php @@ -0,0 +1,13 @@ +setDelimiter('|'); + $this->setTypeList($typeList); + } + + public function createTypeListFromArray(array $rules) + { + $arr = []; + $trans = $this->getLaravelToHt7(); + $tLOrg = $this->getTypeList(); + + foreach ($rules as $rule) { + $name = explode(':', $rule)[0]; + + if (array_key_exists($name, $trans)) { + $arr[] = $tLOrg->get($name); + } + } + + $tL = new TypeList($arr); + + return $tL; + } + + public function createTypeListFromString(string $rules) + { + $arr = explode($this->getDelimiter(), $rules); + + return $this->createTypeListFromArray($arr); + } + + public function getDelimiter() + { + return $this->delimiter; + } + + public function getLaravelToHt7() + { + return [ + 'accepted' => 'accepted', + 'required' => 'required' + ]; + } + + public function getTypeList() + { + return $this->typeList; + } + + public function setDelimiter($delimiter) + { + $this->delimiter = $delimiter; + } + + public function setTypeList($typeList) + { + $this->typeList = $typeList; + } + +} diff --git a/tmp/tests/ContainerLwTest.php b/tmp/tests/ContainerLwTest.php new file mode 100644 index 0000000..38fd363 --- /dev/null +++ b/tmp/tests/ContainerLwTest.php @@ -0,0 +1,170 @@ +getMockBuilder($className) + ->setMethods(['bind']) + ->disableOriginalConstructor() + ->getMock(); + + $reflectedClass = new \ReflectionClass($className); + $propBindings = $reflectedClass->getProperty('bindings'); + $propBindings->setAccessible(true); + $propInstances = $reflectedClass->getProperty('instances'); + $propInstances->setAccessible(true); + + $this->assertNull($propBindings->getValue($mock)); + $this->assertNull($propInstances->getValue($mock)); + + $constructor = $reflectedClass->getConstructor(); + $constructor->invoke($mock); + + $this->assertIsArray($propBindings->getValue($mock)); + $this->assertEmpty($propBindings->getValue($mock)); + $this->assertIsArray($propInstances->getValue($mock)); + $this->assertEmpty($propInstances->getValue($mock)); + } + public function testGetInstance() + { + $this->assertInstanceOf(ContainerLw::class, ContainerLw::getInstance()); + } + public function testGetInstanceSingleton() + { + $this->assertSame(ContainerLw::getInstance(), ContainerLw::getInstance()); + } + public function testBind() + { + $className = ContainerLw::class; + + $mock = $this->getMockBuilder($className) + ->setMethods(['bound']) + ->disableOriginalConstructor() + ->getMock(); + + $reflectedClass = new \ReflectionClass($className); + $prop = $reflectedClass->getProperty('bindings'); + $prop->setAccessible(true); + $prop->setValue($mock, []); + + $mock->bind('ht7/test'); + + $this->assertArrayHasKey('ht7/test', $prop->getValue($mock)); + $this->assertNull($prop->getValue($mock)['ht7/test']); + + $mock->bind('ht7/test/exception', \InvalidArgumentException::class); + + $this->assertArrayHasKey('ht7/test/exception', $prop->getValue($mock)); + $this->assertEquals(\InvalidArgumentException::class, $prop->getValue($mock)['ht7/test/exception']); + } + public function testBond() + { + $className = ContainerLw::class; + + $bindings = ['ht7/test' => null]; + + $mock = $this->getMockBuilder($className) + ->setMethods(['getBindings']) + ->disableOriginalConstructor() + ->getMock(); + $mock->expects($this->exactly(3)) + ->method('getBindings') + ->willReturn($bindings); + + $this->assertIsBool($mock->bound('ht7/test')); + $this->assertTrue($mock->bound('ht7/test')); + $this->assertFalse($mock->bound('ht7/test1')); + } +// public function testGet() +// { +// $className = ContainerLw::class; +// +// $bindings = ['ht7/test' => 'expected binding']; +// +// $mock = $this->getMockBuilder($className) +// ->setMethods(['getBindings']) +// ->disableOriginalConstructor() +// ->getMock(); +// $mock->expects($this->exactly(1)) +// ->method('getBindings') +// ->willReturn($bindings); +// +// $this->assertEquals($bindings['ht7/test'], $mock->get('ht7/test')); +// } + + public function testGet() + { + $className = ContainerLw::class; + + $bindings = ['ht7/test' => 'expected binding']; + + $mock = $this->getMockBuilder($className) + ->setMethods(['resolve']) + ->disableOriginalConstructor() + ->getMock(); + $mock->expects($this->exactly(1)) + ->method('resolve') + ->willReturn($bindings['ht7/test']); + + $this->assertEquals($bindings['ht7/test'], $mock->get('ht7/test')); + } +// public function testGetExceptionContainer() +// { +// $className = ContainerLw::class; +// +// $excBinding = [ +// 'ht7/exc' => function() { +// throw new \Exception(); +// } +// ]; +// $errBinding = ['exc/container/psr/container' => ContainerResolvingException::class]; +// +// $mock = $this->getMockBuilder($className) +// ->setMethods(['has', 'getBindings']) +// ->disableOriginalConstructor() +// ->getMock(); +// $mock->expects($this->exactly(1)) +// ->method('has') +// ->willReturn(true); +// $mock->expects($this->exactly(2)) +// ->method('getBindings') +//// ->will($this->returnCallback(function() { +// ->willReturnOnConsecutiveCalls($excBinding, $errBinding); +//// ->willReturnOnConsecutiveCalls($excBinding, $errBinding); +//// ->willReturn($excBinding, $errBinding); +//// ->will($this->returnValueMap([$bindings,])); +//// ->willReturn($bindings); +// +// $this->expectException(ContainerResolvingException::class); +// +// $mock->get('ht7/exc'); +// } + + public function testGetExceptionEntryNotFound() + { + $className = ContainerLw::class; + + $mock = $this->getMockBuilder($className) + ->setMethods(['getBindings']) + ->disableOriginalConstructor() + ->getMock(); + $mock->expects($this->exactly(2)) + ->method('getBindings') + ->willReturn([], ['exc/container/psr/notfound' => EntryNotFoundException::class]); + + $this->expectException(EntryNotFoundException::class); + + $mock->get('ht7/not_found'); + } +// public function testGetBindings +} diff --git a/tmp/tests/DummyTest.php b/tmp/tests/DummyTest.php new file mode 100644 index 0000000..3cb1156 --- /dev/null +++ b/tmp/tests/DummyTest.php @@ -0,0 +1,18 @@ +assertTrue($dummy->getDummy()); + } + +} diff --git a/tmp/tests/EnumTest.php b/tmp/tests/EnumTest.php new file mode 100644 index 0000000..0768943 --- /dev/null +++ b/tmp/tests/EnumTest.php @@ -0,0 +1,41 @@ +object = new EnumImplementation(); + } + /** + * Test to get a defined constant by comparing the expected value. An undefined + * constant will throw an exception. This case is tested by this method too. + */ + public function testGetConstant() + { + $this->assertEquals('test 1', EnumImplementation::getConstant('TEST_1')); + + $this->expectException(UndefinedConstantException::class); + + EnumImplementation::getConstant('test_11111'); + } + /** + * Test setting an undefined property on the enum, which should throw an + * exception. + * This functionallity is implemented by a trait. + */ + public function testSet() + { + $this->expectException(InvalidArgumentException::class); + + $this->object->test = 'Should throw an exception.'; + } +} diff --git a/tests/unit/Exceptions/MessageTest.php b/tmp/tests/Exceptions/MessageTest_.php similarity index 100% rename from tests/unit/Exceptions/MessageTest.php rename to tmp/tests/Exceptions/MessageTest_.php diff --git a/tmp/tests/Iterators/SimpleAssocIteratorTest.php b/tmp/tests/Iterators/SimpleAssocIteratorTest.php new file mode 100644 index 0000000..c9ebdd8 --- /dev/null +++ b/tmp/tests/Iterators/SimpleAssocIteratorTest.php @@ -0,0 +1,106 @@ + 'test_1', + 'key2' => 'test2' + ]; + + $mock = $this->getMockBuilder($className) + ->setMethods(['rewind']) + ->disableOriginalConstructor() + ->getMock(); + $mock->expects($this->once()) + ->method('rewind'); + + $this->assertInstanceOf(Iterator::class, $mock); + + $reflectedClass = new \ReflectionClass($className); + $constructor = $reflectedClass->getConstructor(); + $constructor->invoke($mock, $data); + $propertyArray = $reflectedClass->getProperty('array'); + $propertyArray->setAccessible(true); + + $this->assertEquals($data, $propertyArray->getValue($mock)); + + $propertyArrayKeys = $reflectedClass->getProperty('keys'); + $propertyArrayKeys->setAccessible(true); + + $this->assertEquals(['key1', 'key2'], $propertyArrayKeys->getValue($mock)); + } + + public function testKey() + { + $className = SimpleAssocIterator::class; + + $keys = [ + 'key1', + 'key2', + 'key3', + 'key4', + 'key5' + ]; + + $mock = $this->getMockBuilder($className) + ->setMethods(['current']) + ->disableOriginalConstructor() + ->getMock(); + + $reflectedClass = new \ReflectionClass($className); + + $propertyKeys = $reflectedClass->getProperty('keys'); + $propertyKeys->setAccessible(true); + $propertyKeys->setValue($mock, $keys); + + $propertyPosition = $reflectedClass->getProperty('position'); + $propertyPosition->setAccessible(true); + $propertyPosition->setValue($mock, 4); + + $this->assertEquals('key5', $mock->key()); + } + + public function testValid() + { + $className = SimpleAssocIterator::class; + + $keys = [ + 'key1', + 'key2', + 'key3', + 'key4', + 'key5' + ]; + + $mock = $this->getMockBuilder($className) + ->setMethods(['key']) + ->disableOriginalConstructor() + ->getMock(); + + $reflectedClass = new \ReflectionClass($className); + $propertyKeys = $reflectedClass->getProperty('keys'); + $propertyKeys->setAccessible(true); + $propertyKeys->setValue($mock, $keys); + $propertyPosition = $reflectedClass->getProperty('position'); + $propertyPosition->setAccessible(true); + $propertyPosition->setValue($mock, 4); + + $this->assertTrue($mock->valid()); + + $propertyPosition->setValue($mock, 5); + + $this->assertFalse($mock->valid()); + } + +} diff --git a/tmp/tests/Iterators/SimpleIndexIteratorTest.php b/tmp/tests/Iterators/SimpleIndexIteratorTest.php new file mode 100644 index 0000000..4352b28 --- /dev/null +++ b/tmp/tests/Iterators/SimpleIndexIteratorTest.php @@ -0,0 +1,154 @@ +getMockBuilder($className) + ->setMethods(['rewind']) + ->disableOriginalConstructor() + ->getMock(); + $mock->expects($this->once()) + ->method('rewind'); + + $this->assertInstanceOf(Iterator::class, $mock); + + $reflectedClass = new \ReflectionClass($className); + $constructor = $reflectedClass->getConstructor(); + $constructor->invoke($mock, $data); + $property = $reflectedClass->getProperty('array'); + $property->setAccessible(true); + + $this->assertEquals($data, $property->getValue($mock)); + } + + public function testCurrent() + { + $className = SimpleIndexIterator::class; + + $data = [ + 'test_1', + 'test2' + ]; + + $mock = $this->getMockBuilder($className) + ->setMethods(['key']) + ->disableOriginalConstructor() + ->getMock(); + $mock->expects($this->once()) + ->method('key') + ->willReturn(1); + + $reflectedClass = new \ReflectionClass($className); + $property = $reflectedClass->getProperty('array'); + $property->setAccessible(true); + + $property->setValue($mock, $data); + + $this->assertEquals($data[1], $mock->current()); + } + + public function testKey() + { + $className = SimpleIndexIterator::class; + + $mock = $this->getMockBuilder($className) + ->setMethods(['current']) + ->disableOriginalConstructor() + ->getMock(); + + $reflectedClass = new \ReflectionClass($className); + $property = $reflectedClass->getProperty('position'); + $property->setAccessible(true); + + $property->setValue($mock, 5); + + $this->assertEquals(5, $mock->key()); + } + + public function testRewind() + { + $className = SimpleIndexIterator::class; + + $mock = $this->getMockBuilder($className) + ->setMethods(['current']) + ->disableOriginalConstructor() + ->getMock(); + + $reflectedClass = new \ReflectionClass($className); + $property = $reflectedClass->getProperty('position'); + $property->setAccessible(true); + + $property->setValue($mock, 5); + + $this->assertEquals(5, $property->getValue($mock)); + + $mock->rewind(); + + $this->assertEquals(0, $property->getValue($mock)); + } + + public function testNext() + { + $className = SimpleIndexIterator::class; + + $mock = $this->getMockBuilder($className) + ->setMethods(['current']) + ->disableOriginalConstructor() + ->getMock(); + + $reflectedClass = new \ReflectionClass($className); + $property = $reflectedClass->getProperty('position'); + $property->setAccessible(true); + + $property->setValue($mock, 1); + + $this->assertEquals(1, $property->getValue($mock)); + + $mock->next(); + + $this->assertEquals(2, $property->getValue($mock)); + } + + public function testValid() + { + $className = SimpleIndexIterator::class; + + $data = [ + 'test_1', + 'test2' + ]; + + $mock = $this->getMockBuilder($className) + ->setMethods(['key']) + ->disableOriginalConstructor() + ->getMock(); + $mock->expects($this->exactly(2)) + ->method('key') + ->willReturnOnConsecutiveCalls(1, 2); + + $reflectedClass = new \ReflectionClass($className); + $propertyArray = $reflectedClass->getProperty('array'); + $propertyArray->setAccessible(true); + $propertyArray->setValue($mock, $data); + + $this->assertTrue($mock->valid()); + + $this->assertFalse($mock->valid()); + } + +} diff --git a/tests/Unit/Lists/AbstractItemListTest.php b/tmp/tests/Lists/AbstractItemListTest.php similarity index 100% rename from tests/Unit/Lists/AbstractItemListTest.php rename to tmp/tests/Lists/AbstractItemListTest.php diff --git a/tests/Unit/Lists/HashListTest.php b/tmp/tests/Lists/HashListTest.php similarity index 100% rename from tests/Unit/Lists/HashListTest.php rename to tmp/tests/Lists/HashListTest.php diff --git a/tests/Unit/Lists/ItemListTest.php b/tmp/tests/Lists/ItemListTest.php similarity index 100% rename from tests/Unit/Lists/ItemListTest.php rename to tmp/tests/Lists/ItemListTest.php diff --git a/tmp/tests/Localization/Adapters/NoLangAdapterTest_.php b/tmp/tests/Localization/Adapters/NoLangAdapterTest_.php new file mode 100644 index 0000000..309604f --- /dev/null +++ b/tmp/tests/Localization/Adapters/NoLangAdapterTest_.php @@ -0,0 +1,108 @@ +getMockBuilder($className) + ->setMethods(['t']) + ->disableOriginalConstructor() + ->getMock(); + + $reflectedClass = new \ReflectionClass($className); + $prop = $reflectedClass->getProperty('context'); + $prop->setAccessible(true); + + $this->assertNull($prop->getValue($mock)); + + $constructor = $reflectedClass->getConstructor(); + $constructor->invoke($mock); + + $this->assertEquals('no-lang', $prop->getValue($mock)); + } + + public function testT() + { + $className = NoLangAdapter::class; + + $str = 'The %s has won a %s.'; + $expected = 'The player has won a cup.'; + + $args = [ + 'player', + 'cup' + ]; + + $mock = $this->getMockBuilder($className) + ->setMethods(['t2']) + ->disableOriginalConstructor() + ->getMock(); + + $this->assertEquals($expected, $mock->t($str, $args)); + } + + public function testTWithMultiple() + { + $className = NoLangAdapter::class; + + $str = 'The %2$s has won %1s %3$s cup.'; + $expected = 'The player has won 1 stanley cup.'; + + $args = [ + 1, + 'player', + 'stanley' + ]; + + $mock = $this->getMockBuilder($className) + ->setMethods(['t2']) + ->disableOriginalConstructor() + ->getMock(); + + $this->assertEquals($expected, $mock->t($str, $args)); + } + + public function testT2() + { + $className = NoLangAdapter::class; + + $str1 = 'The %s has won %d %s cup.'; + $str2 = 'The %s has won %d %s cups.'; + + $args = [ + 'player', + 'stanley' + ]; + $args1 = [ + 1, + 'player', + 'stanley' + ]; + $args2 = [ + 2, + 'player', + 'stanley' + ]; + + $mock = $this->getMockBuilder($className) + ->setMethods(['t']) + ->disableOriginalConstructor() + ->getMock(); + $mock->expects($this->exactly(2)) + ->method('t') + ->withConsecutive([$str1, $args1], [$str2, $args2]); + + $mock->t2($str1, $str2, 1, $args); + $mock->t2($str1, $str2, 2, $args); + } + +} diff --git a/tests/unit/Localization/TranslatorTest.php b/tmp/tests/Localization/TranslatorOldTest__.php similarity index 60% rename from tests/unit/Localization/TranslatorTest.php rename to tmp/tests/Localization/TranslatorOldTest__.php index 96ed8a2..dfc6071 100644 --- a/tests/unit/Localization/TranslatorTest.php +++ b/tmp/tests/Localization/TranslatorOldTest__.php @@ -4,7 +4,7 @@ use \InvalidArgumentException; use \PHPUnit\Framework\TestCase; -use \Ht7\Base\Localization\Translator; +use \Ht7\Base\Localization\TranslatorOld; /** * Test class for the Enum Base class. @@ -14,32 +14,32 @@ * @version 0.0.1 * @copyright (c) 2019, Thomas Pluess */ -class TranslatorTest extends TestCase +class TranslatorOldTest extends TestCase { public function testTranslate() { - $str1 = Translator::t('A %s test.', ['short']); + $str1 = TranslatorOld::t('A %s test.', ['short']); $this->assertContains('short', $str1); $this->assertContains('test', $str1); - $str2 = Translator::t('A %s test.', ['long'], 'with_context'); + $str2 = TranslatorOld::t('A %s test.', ['long'], 'with_context'); $this->assertContains('long', $str2); $this->assertContains('test', $str2); - $str3a = Translator::t2('A %s new-test.', 'Multiple %s new-tests.', 1, ['I-have-no-context']); + $str3a = TranslatorOld::t2('A %s new-test.', 'Multiple %s new-tests.', 1, ['I-have-no-context']); $this->assertContains('I-have-no-context', $str3a); $this->assertContains('new-test.', $str3a); - $str3b = Translator::t2('A %s new-test.', 'Multiple %s new-tests.', 2, ['I-have-no-context']); + $str3b = TranslatorOld::t2('A %s new-test.', 'Multiple %s new-tests.', 2, ['I-have-no-context']); $this->assertContains('I-have-no-context', $str3b); $this->assertContains('new-tests.', $str3b); - $str4 = Translator::t2('A %s last test.', 'Multiple %s last tests.', 2, ['I-have-a-context'], 'with_context'); + $str4 = TranslatorOld::t2('A %s last test.', 'Multiple %s last tests.', 2, ['I-have-a-context'], 'with_context'); $this->assertContains('I-have-a-context', $str4); $this->assertContains('Multiple', $str4); diff --git a/tmp/tests/Messages/Options/BaseOptionsTest_.php b/tmp/tests/Messages/Options/BaseOptionsTest_.php new file mode 100644 index 0000000..7c4b182 --- /dev/null +++ b/tmp/tests/Messages/Options/BaseOptionsTest_.php @@ -0,0 +1,109 @@ + \InvalidArgumentException::class, + ]; + + $mock = $this->getMockBuilder($className) + ->setMethods(['setStringsClass']) + ->disableOriginalConstructor() + ->getMock(); + $mock->expects($this->once()) + ->method('setStringsClass') + ->with($this->equalTo($data['stringsClass'])); + + $mock->load($data); + } + + public function testGetStringsClass() + { + $className = BaseOptions::class; + + $expected = 'test-value'; + + $mock = $this->getMockBuilder($className) + ->setMethods(['load']) + ->disableOriginalConstructor() + ->getMock(); + + $reflectedClass = new \ReflectionClass($className); + $property = $reflectedClass->getProperty('stringsClass'); + $property->setAccessible(true); + $property->setValue($mock, $expected); + + $this->assertEquals($expected, $mock->getStringsClass()); + } + + public function testGetTypeClass() + { + $className = BaseOptions::class; + + $expected = 'test-value'; + + $mock = $this->getMockBuilder($className) + ->setMethods(['load']) + ->disableOriginalConstructor() + ->getMock(); + + $reflectedClass = new \ReflectionClass($className); + $property = $reflectedClass->getProperty('typeClass'); + $property->setAccessible(true); + $property->setValue($mock, $expected); + + $this->assertEquals($expected, $mock->getTypeClass()); + } + + public function testSetStringsClass() + { + $className = BaseOptions::class; + + $expected = 'test-value'; + + $mock = $this->getMockBuilder($className) + ->setMethods(['load']) + ->disableOriginalConstructor() + ->getMock(); + + $mock->setStringsClass($expected); + + $reflectedClass = new \ReflectionClass($className); + $property = $reflectedClass->getProperty('stringsClass'); + $property->setAccessible(true); + + $this->assertEquals($expected, $property->getValue($mock)); + } + + public function testSetTypeClass() + { + $className = BaseOptions::class; + + $expected = 'test-value'; + + $mock = $this->getMockBuilder($className) + ->setMethods(['load']) + ->disableOriginalConstructor() + ->getMock(); + + $mock->setTypeClass($expected); + + $reflectedClass = new \ReflectionClass($className); + $property = $reflectedClass->getProperty('typeClass'); + $property->setAccessible(true); + + $this->assertEquals($expected, $property->getValue($mock)); + } + +} diff --git a/tmp/tests/Models/AbstractLoadableModelTest.php b/tmp/tests/Models/AbstractLoadableModelTest.php new file mode 100644 index 0000000..caedde1 --- /dev/null +++ b/tmp/tests/Models/AbstractLoadableModelTest.php @@ -0,0 +1,46 @@ +getMockBuilder($className) + ->setMethods(['load']) + ->getMockForAbstractClass(); + + $mock->expects($this->once()) + ->method('load') + ->with($this->equalTo($items)); + + $reflectedClass = new \ReflectionClass($className); + $constructor = $reflectedClass->getConstructor(); + $constructor->invoke($mock, $items); + } + + public function testLoad() + { + $className = AbstractLoadableModel::class; + + $items = [1, 2, 5]; + + $mock = $this->getMockBuilder($className) + ->setMethods(['addByPropertyName']) + ->getMockForAbstractClass(); + $mock->expects($this->exactly(3)) + ->method('addByPropertyName') + ->withConsecutive([0, 1], [1, 2], [2, 5]); + + $mock->load($items); + } + +} diff --git a/tmp/tests/Models/AbstractTransLoadableModelTest.php b/tmp/tests/Models/AbstractTransLoadableModelTest.php new file mode 100644 index 0000000..a8a78fb --- /dev/null +++ b/tmp/tests/Models/AbstractTransLoadableModelTest.php @@ -0,0 +1,96 @@ + 'testProperty1', + 'test2' => 'testProperty2', + ]; + + $mock = $this->getMockBuilder($className) + ->setMethods(['getTransformations', 'setTransformations', 'load']) + ->getMockForAbstractClass(); + + $mock->expects($this->once()) + ->method('setTransformations') + ->with($this->equalTo($transformations)); + $mock->expects($this->once()) + ->method('load') + ->with($this->equalTo($items)); + + $reflectedClass = new \ReflectionClass($className); + $constructor = $reflectedClass->getConstructor(); + $constructor->invoke($mock, $items, $transformations); + } + + public function testLoad() + { + $className = AbstractTransLoadableModel::class; + + $items = [1, 2, 5]; + + /* @var $mock AbstractTransLoadableModel */ + $mock = $this->getMockBuilder($className) + ->setMethods(['getTransformations', 'addByPropertyName']) + ->getMockForAbstractClass(); + + $mock->expects($this->once()) + ->method('getTransformations') + ->willReturn([0 => 10, 1 => 100, 2 => 1000]); + $mock->expects($this->exactly(3)) + ->method('addByPropertyName') + ->withConsecutive( + [$this->equalTo(10), $this->equalTo(1)], + [$this->equalTo(100), $this->equalTo(2)], + [$this->equalTo(1000), $this->equalTo(5)] + ); + + $mock->load($items); + } + + public function testGetTranformations() + { + $className = AbstractTransLoadableModel::class; + + $expected = [0 => 10, 5 => 20]; + + $mock = $this->getMockForAbstractClass($className); + + $reflectedClass = new \ReflectionClass($className); + $property = $reflectedClass->getProperty('transformations'); + $property->setAccessible(true); + $property->setValue($mock, $expected); + + $this->assertEquals($expected, $mock->getTransformations()); + } + + public function testSetTranformations() + { + $className = AbstractTransLoadableModel::class; + + $expected = [0 => 10, 5 => 20]; + + $mock = $this->getMockForAbstractClass($className); + + $mock->setTransformations($expected); + + $reflectedClass = new \ReflectionClass($className); + $property = $reflectedClass->getProperty('transformations'); + $property->setAccessible(true); + $property->setValue($mock, $expected); + + $this->assertEquals($expected, $property->getValue($mock)); + } + +} diff --git a/tmp/tests/Models/LoadableModelTest_.php b/tmp/tests/Models/LoadableModelTest_.php new file mode 100644 index 0000000..20f6423 --- /dev/null +++ b/tmp/tests/Models/LoadableModelTest_.php @@ -0,0 +1,30 @@ +getMockBuilder($className) + ->setMethods(['load']) + ->disableOriginalConstructor() + ->getMock(); + $mock->expects($this->once()) + ->method('load') + ->with($this->equalTo($items)); + + $reflectedClass = new \ReflectionClass($className); + $constructor = $reflectedClass->getConstructor(); + $constructor->invoke($mock, $items); + } + +} diff --git a/tests/unit/Utility/StringsTest.php b/tmp/tests/Utility/StringsTest_.php similarity index 97% rename from tests/unit/Utility/StringsTest.php rename to tmp/tests/Utility/StringsTest_.php index 2511cb6..14cf757 100644 --- a/tests/unit/Utility/StringsTest.php +++ b/tmp/tests/Utility/StringsTest_.php @@ -13,7 +13,7 @@ * @version 0.0.1 * @copyright (c) 2019, Thomas Pluess */ -class StringTest extends TestCase +class StringsTest extends TestCase { public function testDecamelize() diff --git a/tmp/tests/Utility/Traits/CanAddByPropertyNameTest.php b/tmp/tests/Utility/Traits/CanAddByPropertyNameTest.php new file mode 100644 index 0000000..aea4dc2 --- /dev/null +++ b/tmp/tests/Utility/Traits/CanAddByPropertyNameTest.php @@ -0,0 +1,67 @@ + 'value 1', + 'testProperty2' => 'value 2' + ]; + + $mock = new class + { + + use CanAddByPropertyName; + + protected $testOne; + protected $testTwo; + + public function setTestProperty1($test1) + { + return $this->testOne = $test1; + } + + public function setTestProperty2($test2) + { + $this->testTwo = $test2; + } + }; + + $reflectedClass = new \ReflectionClass($mock); + $testProperty1 = $reflectedClass->getProperty('testOne'); + $testProperty1->setAccessible(true); + $testProperty2 = $reflectedClass->getProperty('testTwo'); + $testProperty2->setAccessible(true); + + $this->assertNull($testProperty1->getValue($mock)); + $this->assertNull($testProperty2->getValue($mock)); + + $mock->addByPropertyName('testProperty1', $items['testProperty1']); + $mock->addByPropertyName('testProperty2', $items['testProperty2']); + + $this->assertEquals($items['testProperty1'], $testProperty1->getValue($mock)); + $this->assertEquals($items['testProperty2'], $testProperty2->getValue($mock)); + } + + public function testAddByPropertyNameWithException() + { + $mock = $this->getMockForTrait(CanAddByPropertyName::class); + + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessageRegExp('/(U|u)nkown property(.)+unknownProperty/'); + + $mock->addByPropertyName('unknownProperty', 'value'); + } + +} diff --git a/tmp/tests/Validation/Lists/AbstractValidationListTest.php b/tmp/tests/Validation/Lists/AbstractValidationListTest.php new file mode 100644 index 0000000..05068cb --- /dev/null +++ b/tmp/tests/Validation/Lists/AbstractValidationListTest.php @@ -0,0 +1,41 @@ + \InvalidArgumentException::class, + 'rule2' => new \stdClass() + ]; + + $mock = $this->getMockBuilder($className) + ->setMethods(['get']) + ->disableOriginalConstructor() + ->getMock(); + + $reflectedClass = new \ReflectionClass($className); + $property = $reflectedClass->getProperty('items'); + $property->setAccessible(true); + $property->setValue($mock, []); + + $mock->load($items); + + $itemsStored = $property->getValue($mock); + + $this->assertIsArray($itemsStored); + $this->assertArrayHasKey('rule1', $items); + $this->assertArrayHasKey('rule2', $items); + $this->assertEquals(\InvalidArgumentException::class, $itemsStored['rule1']); + $this->assertIsObject($itemsStored['rule2']); + } + +} diff --git a/tmp/tests/Validation/Lists/RuleListTest.php b/tmp/tests/Validation/Lists/RuleListTest.php new file mode 100644 index 0000000..e77f0ec --- /dev/null +++ b/tmp/tests/Validation/Lists/RuleListTest.php @@ -0,0 +1,80 @@ + \InvalidArgumentException::class, + 'rule2' => \stdClass::class + ]; + + $mock = $this->getMockBuilder($className) + ->setMethods(['load']) + ->disableOriginalConstructor() + ->getMock(); + + $reflectedClass = new \ReflectionClass($className); + $property = $reflectedClass->getProperty('items'); + $property->setAccessible(true); + $property->setValue($mock, $items); + + $actual1 = $mock->get('rule1'); + + $this->assertIsObject($actual1); + $this->assertInstanceOf(\InvalidArgumentException::class, $actual1); + + $actual2 = $mock->get('rule2'); + + $this->assertIsObject($actual2); + $this->assertInstanceOf(\stdClass::class, $actual2); + } + + public function testForEach() + { + $className = RuleList::class; + + $items = [ + 'rule1' => \InvalidArgumentException::class, + 'rule2' => \stdClass::class + ]; + + $mock = $this->getMockBuilder($className) + ->setMethods(['load']) + ->disableOriginalConstructor() + ->getMock(); + + $reflectedClass = new \ReflectionClass($className); + $property = $reflectedClass->getProperty('items'); + $property->setAccessible(true); + $property->setValue($mock, $items); + + $index = 0; + + foreach ($mock as $value) { + $this->assertIsObject($value); + + switch ($index) { + case 0: + $this->assertInstanceOf(\InvalidArgumentException::class, $value); + break; + case 1: + $this->assertInstanceOf(\stdClass::class, $value); + break; + default: + break; + } + + $index++; + } + } + +} diff --git a/tmp/tests/Validation/Lists/TypeListTest.php b/tmp/tests/Validation/Lists/TypeListTest.php new file mode 100644 index 0000000..2d342e1 --- /dev/null +++ b/tmp/tests/Validation/Lists/TypeListTest.php @@ -0,0 +1,204 @@ + 'test_01', + 'test2' => 'test_02', + ]; + $options = [ + 'test1', + 'isCached' => true + ]; + + $stubOptions = $this->createMock($className2); + $mock = $this->getMockBuilder($className) + ->setMethods(['createOptionsFromArray', 'setOptions', 'load']) + ->disableOriginalConstructor() + ->getMock(); + + $mock->expects($this->once()) + ->method('createOptionsFromArray') + ->with($this->equalTo($options)) + ->willReturn($stubOptions); + $mock->expects($this->once()) + ->method('setOptions') + ->with($this->equalTo($stubOptions)); + $mock->expects($this->once()) + ->method('load') + ->with($this->equalTo($expected)); + + $reflectedClass = new \ReflectionClass($className); + $constructor = $reflectedClass->getConstructor(); + $constructor->invoke($mock, $expected, $options); + } + + public function testCreateOptionsFromArray() + { + $className = TypeList::class; + $className2 = TypeListOptions::class; + + $mock = $this->getMockBuilder($className) + // Without this definition the test would fail due tue null + // return value of the method createOptionsFromArray. + ->setMethods(['load']) + ->disableOriginalConstructor() + ->getMock(); + + $this->assertInstanceOf($className2, $mock->createOptionsFromArray([])); + } + + public function testGetReturnCachedObject() + { + $className = TypeList::class; + + $items = [ + 'test1' => \InvalidArgumentException::class, + 'test2' => (new \stdClass()) + ]; + + $mock = $this->getMockBuilder($className) + ->setMethods(['load']) + ->disableOriginalConstructor() + ->getMock(); + + $reflectedClass = new \ReflectionClass($className); + $property = $reflectedClass->getProperty('items'); + $property->setAccessible(true); + $property->setValue($mock, $items); + + $this->assertInstanceOf(\stdClass::class, $mock->get('test2')); + } + + public function testGetReturnNewObject() + { + $className = TypeList::class; + $className2 = TypeListOptions::class; + + $items = [ + 'test1' => \InvalidArgumentException::class, + 'test2' => (new \stdClass()) + ]; + + $mockOptions = $this->getMockBuilder($className2) + ->setMethods(['getIsCached']) + ->disableOriginalConstructor() + ->getMock(); + $mockOptions->expects($this->once()) + ->method('getIsCached') + ->willReturn(false); + + $mock = $this->getMockBuilder($className) + ->setMethods(['getOptions']) + ->disableOriginalConstructor() + ->getMock(); + $mock->expects($this->once()) + ->method('getOptions') + ->willReturn($mockOptions); + + $reflectedClass = new \ReflectionClass($className); + $property = $reflectedClass->getProperty('items'); + $property->setAccessible(true); + $property->setValue($mock, $items); + + $this->assertInstanceOf(\InvalidArgumentException::class, $mock->get('test1')); + + $this->assertIsString($property->getValue($mock)['test1']); + } + + public function testGetReturnNewObjectCacheNewObject() + { + $className = TypeList::class; + $className2 = TypeListOptions::class; + + $items = [ + 'test1' => \InvalidArgumentException::class, + 'test2' => (new \stdClass()) + ]; + + $mockOptions = $this->getMockBuilder($className2) + ->setMethods(['getIsCached']) + ->disableOriginalConstructor() + ->getMock(); + $mockOptions->expects($this->once()) + ->method('getIsCached') + ->willReturn(true); + + $mock = $this->getMockBuilder($className) + ->setMethods(['getOptions']) + ->disableOriginalConstructor() + ->getMock(); + $mock->expects($this->once()) + ->method('getOptions') + ->willReturn($mockOptions); + + $reflectedClass = new \ReflectionClass($className); + $property = $reflectedClass->getProperty('items'); + $property->setAccessible(true); + $property->setValue($mock, $items); + + $this->assertInstanceOf(\InvalidArgumentException::class, $mock->get('test1')); + + $this->assertIsObject($property->getValue($mock)['test1']); + + $this->assertInstanceOf(\InvalidArgumentException::class, $mock->get('test1')); + } + + public function testGetOptions() + { + $className = TypeList::class; + + $expected = [ + 'test' => 'test val' + ]; + + $mock = $this->getMockBuilder($className) + ->setMethods(['load']) + ->disableOriginalConstructor() + ->getMock(); + + $reflectedClass = new \ReflectionClass($className); + $property = $reflectedClass->getProperty('options'); + $property->setAccessible(true); + $property->setValue($mock, $expected); + + $this->assertEquals($expected, $mock->getOptions()); + } + + public function testSetOptions() + { + $className = TypeList::class; + $className2 = TypeListOptions::class; + + $mockOptions = $this->getMockBuilder($className2) + ->setMethods(['getIsCached']) + ->disableOriginalConstructor() + ->getMock(); + + $mock = $this->getMockBuilder($className) + ->setMethods(['load']) + ->disableOriginalConstructor() + ->getMock(); + + $mock->setOptions($mockOptions); + + $reflectedClass = new \ReflectionClass($className); + $property = $reflectedClass->getProperty('options'); + $property->setAccessible(true); + + $this->assertEquals($mockOptions, $property->getValue($mock)); + } + +} diff --git a/tmp/tests/Validation/Options/BaseOptionsTest.php b/tmp/tests/Validation/Options/BaseOptionsTest.php new file mode 100644 index 0000000..9023463 --- /dev/null +++ b/tmp/tests/Validation/Options/BaseOptionsTest.php @@ -0,0 +1,85 @@ +getMockBuilder($className) + ->setMethods(['getStopOnFail']) + ->disableOriginalConstructor() + ->getMock(); + + $this->assertInstanceOf(BaseOptionable::class, $mock); + $this->assertInstanceOf(Loadable::class, $mock); + } + + public function testGetStopOnFail() + { + $className = BaseOptions::class; + + $mock = $this->getMockBuilder($className) + ->setMethods(['setStopOnFail']) + ->disableOriginalConstructor() + ->getMock(); + + $reflectedClass = new \ReflectionClass($className); + $property = $reflectedClass->getProperty('stopOnFail'); + $property->setAccessible(true); + $property->setValue($mock, true); + + $this->assertTrue($mock->getStopOnFail()); + + $property->setValue($mock, false); + + $this->assertFalse($mock->getStopOnFail()); + } + + public function testSetStopOnFail() + { + $className = BaseOptions::class; + + $mock = $this->getMockBuilder($className) + ->setMethods(['getStopOnFail']) + ->disableOriginalConstructor() + ->getMock(); + + $reflectedClass = new \ReflectionClass($className); + $property = $reflectedClass->getProperty('stopOnFail'); + $property->setAccessible(true); + + $mock->setStopOnFail(true); + $this->assertTrue($property->getValue($mock)); + + $mock->setStopOnFail(false); + $this->assertFalse($property->getValue($mock)); + + $mock->setStopOnFail(1); + $this->assertTrue($property->getValue($mock)); + + $mock->setStopOnFail(null); + $this->assertFalse($property->getValue($mock)); + + $mock->setStopOnFail((new \stdClass())); + $this->assertTrue($property->getValue($mock)); + + $mock->setStopOnFail(0); + $this->assertFalse($property->getValue($mock)); + + $mock->setStopOnFail(-1); + $this->assertTrue($property->getValue($mock)); + + $mock->setStopOnFail(''); + $this->assertFalse($property->getValue($mock)); + } + +} diff --git a/tmp/tests/Validation/Options/TypeListOptionsTest.php b/tmp/tests/Validation/Options/TypeListOptionsTest.php new file mode 100644 index 0000000..e6ed33c --- /dev/null +++ b/tmp/tests/Validation/Options/TypeListOptionsTest.php @@ -0,0 +1,65 @@ +getMockBuilder($className) + ->setMethods(['setIsCached']) + ->disableOriginalConstructor() + ->getMock(); + + $this->assertInstanceOf(Loadable::class, $mock); + } + + public function testGetIsCached() + { + $className = TypeListOptions::class; + + $mock = $this->getMockBuilder($className) + ->setMethods(['setIsCached']) + ->disableOriginalConstructor() + ->getMock(); + + $reflectedClass = new \ReflectionClass($className); + $property = $reflectedClass->getProperty('isCached'); + $property->setAccessible(true); + $property->setValue($mock, true); + + $this->assertTrue($mock->getIsCached()); + + $property->setValue($mock, false); + + $this->assertFalse($mock->getIsCached()); + } + + public function testSetIsCached() + { + $className = TypeListOptions::class; + + $mock = $this->getMockBuilder($className) + ->setMethods(['getIsCached']) + ->disableOriginalConstructor() + ->getMock(); + + $reflectedClass = new \ReflectionClass($className); + $property = $reflectedClass->getProperty('isCached'); + $property->setAccessible(true); + + $this->assertNull($property->getValue($mock)); + + $mock->setIsCached(true); + + $this->assertTrue($property->getValue($mock)); + } + +} diff --git a/tmp/tests/Validation/Types/AbstractSingleValueTypeTest.php b/tmp/tests/Validation/Types/AbstractSingleValueTypeTest.php new file mode 100644 index 0000000..440ef4e --- /dev/null +++ b/tmp/tests/Validation/Types/AbstractSingleValueTypeTest.php @@ -0,0 +1,193 @@ +getMockBuilder($className) + ->setMethods(['validate']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $this->assertInstanceOf($className2, $mock); + $this->assertInstanceOf($className3, $mock); + } + + public function testValidateAllPassed() + { + $className = AbstractSingleValueType::class; + $className2 = IsArray::class; + $className3 = IsInstanceOf::class; + + $stub1 = $this->getMockBuilder($className2) + ->setMethods(['check']) + ->disableOriginalConstructor() + ->getMock(); + $stub1->expects($this->once()) + ->method('check') + ->willReturn(true); + + $stub2 = $this->getMockBuilder($className3) + ->setMethods(['check']) + ->disableOriginalConstructor() + ->getMock(); + $stub2->expects($this->once()) + ->method('check') + ->willReturn(true); + + $rL = [ + $stub1, + $stub2 + ]; + + $mock = $this->getMockBuilder($className) + ->setMethods(['getList']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $mock->expects($this->once()) + ->method('getList') + ->willReturn($rL); + + $this->assertTrue($mock->validate('test value', 'variable name', [])); + } + + public function testValidateFailed() + { + $className = AbstractSingleValueType::class; + $className2 = IsArray::class; + $className3 = IsInstanceOf::class; + + $baseOptions = $this->getMockBuilder(BaseOptions::class) + ->setMethods(['getStopOnFail']) + ->disableOriginalConstructor() + ->getMock(); + $baseOptions->expects($this->once()) + ->method('getStopOnFail') + ->willReturn(false); + + $options = $this->getMockBuilder(AbstractTypeOptions::class) + ->setMethods(['getBaseOptions']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $options->expects($this->once()) + ->method('getBaseOptions') + ->willReturn($baseOptions); + + $stub1 = $this->getMockBuilder($className2) + ->setMethods(['check']) + ->disableOriginalConstructor() + ->getMock(); + $stub1->expects($this->once()) + ->method('check') + ->willReturn(true); + + $stub2 = $this->getMockBuilder($className3) + ->setMethods(['check']) + ->disableOriginalConstructor() + ->getMock(); + $stub2->expects($this->once()) + ->method('check') + ->willReturn(false); + + $rL = [ + 'IsArray' => $stub1, + 'IsInstanceOf' => $stub2 + ]; + + $mock = $this->getMockBuilder($className) + ->setMethods(['getList', 'handleValidationFail']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $mock->expects($this->once()) + ->method('getList') + ->willReturn($rL); + $mock->expects($this->once()) + ->method('handleValidationFail') + ->with( + $this->equalTo('test value'), + $this->equalTo('variable name'), + $this->equalTo('IsInstanceOf'), + $this->equalTo($options) + ); + + $this->assertFalse($mock->validate('test value', 'variable name', $options)); + } + + public function testValidateFailedWithStop() + { + $className = AbstractSingleValueType::class; + $className2 = IsArray::class; + $className3 = IsInstanceOf::class; + + $baseOptions = $this->getMockBuilder(BaseOptions::class) + ->setMethods(['getStopOnFail']) + ->disableOriginalConstructor() + ->getMock(); + $baseOptions->expects($this->once()) + ->method('getStopOnFail') + ->willReturn(true); + + $options = $this->getMockBuilder(AbstractTypeOptions::class) + ->setMethods(['getBaseOptions']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $options->expects($this->once()) + ->method('getBaseOptions') + ->willReturn($baseOptions); + + $stub1 = $this->getMockBuilder($className2) + ->setMethods(['check']) + ->disableOriginalConstructor() + ->getMock(); + $stub1->expects($this->once()) + ->method('check') + ->willReturn(false); + + $stub2 = $this->getMockBuilder($className3) + ->setMethods(['check']) + ->disableOriginalConstructor() + ->getMock(); + $stub2->expects($this->exactly(0)) + ->method('check'); + + $rL = [ + 'IsArray' => $stub1, + 'IsInstanceOf' => $stub2 + ]; + + $mock = $this->getMockBuilder($className) + ->setMethods(['getList', 'handleValidationFail']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $mock->expects($this->once()) + ->method('getList') + ->willReturn($rL); + $mock->expects($this->once()) + ->method('handleValidationFail') + ->with( + $this->equalTo('test value'), + $this->equalTo('variable name'), + $this->equalTo('IsArray'), + $this->equalTo($options) + ); + + $this->assertFalse($mock->validate('test value', 'variable name', $options)); + } + +} diff --git a/tmp/tests/Validation/Types/AbstractTypeTest.php b/tmp/tests/Validation/Types/AbstractTypeTest.php new file mode 100644 index 0000000..98a0f81 --- /dev/null +++ b/tmp/tests/Validation/Types/AbstractTypeTest.php @@ -0,0 +1,183 @@ +createMock($className3); +// +// $mock = $this->getMockBuilder($className) +// ->setMethods(['getDefaults', 'createRuleListFromArray', 'setRuleList']) +// ->disableOriginalConstructor() +// ->getMockForAbstractClass(); +// +// $this->assertInstanceOf($className2, $mock); +// +// $mock->expects($this->once()) +// ->method('getDefaults') +// ->willReturn($rulesDefault); +// $mock->expects($this->once()) +// ->method('createRuleListFromArray') +// ->with($this->equalTo($rulesMerged)) +// ->willReturn($stub); +// $mock->expects($this->once()) +// ->method('setRuleList') +// ->with($this->equalTo($stub)); +// +// $reflectedClass = new \ReflectionClass($className); +// $constructor = $reflectedClass->getConstructor(); +// $constructor->invoke($mock, $rulesInit); +// } +// +// public function testConstructWithoutDefaults() +// { +// $className = AbstractType::class; +// $className2 = ValidationTypable::class; +// $className3 = RuleList::class; +// +// $rulesInit = [ +// IsArray::class, +// IsInstanceOf::class +// ]; +// +// $stub = $this->createMock($className3); +// +// $mock = $this->getMockBuilder($className) +// ->setMethods(['getDefaults', 'createRuleListFromArray', 'setRuleList']) +// ->disableOriginalConstructor() +// ->getMockForAbstractClass(); +// +// $this->assertInstanceOf($className2, $mock); +// +// $mock->expects($this->exactly(0)) +// ->method('getDefaults'); +// $mock->expects($this->once()) +// ->method('createRuleListFromArray') +// ->with($this->equalTo($rulesInit)) +// ->willReturn($stub); +// $mock->expects($this->once()) +// ->method('setRuleList') +// ->with($this->equalTo($stub)); +// +// $reflectedClass = new \ReflectionClass($className); +// $constructor = $reflectedClass->getConstructor(); +// $constructor->invoke($mock, $rulesInit, false); +// } +// +// public function testCreateRuleListFromArray() +// { +// $className = AbstractType::class; +// +// $items = [ +// 'test1', +// new \stdClass() +// ]; +// +// $stub = $this->getMockBuilder($className) +// ->setMethods(['getDefaults']) +// ->disableOriginalConstructor() +// ->getMockForAbstractClass(); +// +// $rL = $stub->createRuleListFromArray($items); +// +// $this->assertInstanceOf(RuleList::class, $rL); +// +// $reflectedClass = new \ReflectionClass(RuleList::class); +// $property = $reflectedClass->getProperty('items'); +// $property->setAccessible(true); +// +// $this->assertEquals($items, $property->getValue($rL)); +// } + + public function testGetHash() + { + $className = AbstractType::class; + + $stub = $this->getMockBuilder($className) + ->setMethods(['getDefaults']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + + $reflectedClass = new \ReflectionClass($className); + $property = $reflectedClass->getProperty('type'); + $property->setAccessible(true); + $property->setValue($stub, 'test_123'); + + $this->assertEquals('test_123', $stub->getHash()); + } + +// public function testGetRuleList() +// { +// $className = AbstractType::class; +// $className2 = RuleList::class; +// +// $stubRl = $this->getMockBuilder($className2) +// ->setMethods(['get']) +// ->disableOriginalConstructor() +// ->getMockForAbstractClass(); +// +// $stub = $this->getMockBuilder($className) +// ->setMethods(['getDefaults']) +// ->disableOriginalConstructor() +// ->getMockForAbstractClass(); +// +// $reflectedClass = new \ReflectionClass($className); +// $property = $reflectedClass->getProperty('ruleList'); +// $property->setAccessible(true); +// $property->setValue($stub, $stubRl); +// +// $this->assertEquals($stubRl, $stub->getRuleList()); +// } +// +// public function testSetRuleList() +// { +// $className = AbstractType::class; +// $className2 = RuleList::class; +// +// $stubRl = $this->getMockBuilder($className2) +// ->setMethods(['get']) +// ->disableOriginalConstructor() +// ->getMockForAbstractClass(); +// +// $stub = $this->getMockBuilder($className) +// ->setMethods(['getDefaults']) +// ->disableOriginalConstructor() +// ->getMockForAbstractClass(); +// +// $stub->setRuleList($stubRl); +// +// $reflectedClass = new \ReflectionClass($className); +// $property = $reflectedClass->getProperty('ruleList'); +// $property->setAccessible(true); +// +// $this->assertEquals($stubRl, $property->getValue($stub)); +// } +}