diff --git a/composer.json b/composer.json index 8407b24..6338d11 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ } }, "require": { - "php": "8.*", + "php": ">=7.4", "ext-dom": "*", "ext-bcmath": "*", "ext-mbstring": "*", diff --git a/composer.lock b/composer.lock index 08dc96f..2179b4f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3082960e8f4c2590e29a112827e8b83c", + "content-hash": "f385eae3358f893a5b226f4d4681f98b", "packages": [ { "name": "google/protobuf", - "version": "v3.17.3", + "version": "v3.14.0", "source": { "type": "git", "url": "https://github.com/protocolbuffers/protobuf-php.git", - "reference": "ae9282cf11dd2933b7e71a611f9590f07d53d3f3" + "reference": "03f132a66f09f96064309e81c5fac8d35b7474e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/ae9282cf11dd2933b7e71a611f9590f07d53d3f3", - "reference": "ae9282cf11dd2933b7e71a611f9590f07d53d3f3", + "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/03f132a66f09f96064309e81c5fac8d35b7474e1", + "reference": "03f132a66f09f96064309e81c5fac8d35b7474e1", "shasum": "" }, "require": { @@ -47,9 +47,9 @@ ], "support": { "issues": "https://github.com/protocolbuffers/protobuf-php/issues", - "source": "https://github.com/protocolbuffers/protobuf-php/tree/v3.17.3" + "source": "https://github.com/protocolbuffers/protobuf-php/tree/v3.14.0" }, - "time": "2021-06-08T14:59:41+00:00" + "time": "2020-11-13T23:41:35+00:00" }, { "name": "psr/http-client", @@ -284,22 +284,22 @@ }, { "name": "guzzlehttp/guzzle", - "version": "7.3.0", + "version": "7.2.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "7008573787b430c1c1f650e3722d9bba59967628" + "reference": "0aa74dfb41ae110835923ef10a9d803a22d50e79" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7008573787b430c1c1f650e3722d9bba59967628", - "reference": "7008573787b430c1c1f650e3722d9bba59967628", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/0aa74dfb41ae110835923ef10a9d803a22d50e79", + "reference": "0aa74dfb41ae110835923ef10a9d803a22d50e79", "shasum": "" }, "require": { "ext-json": "*", "guzzlehttp/promises": "^1.4", - "guzzlehttp/psr7": "^1.7 || ^2.0", + "guzzlehttp/psr7": "^1.7", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0" }, @@ -307,7 +307,6 @@ "psr/http-client-implementation": "1.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", "ext-curl": "*", "php-http/client-integration-tests": "^3.0", "phpunit/phpunit": "^8.5.5 || ^9.3.5", @@ -321,7 +320,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.3-dev" + "dev-master": "7.1-dev" } }, "autoload": { @@ -363,7 +362,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.3.0" + "source": "https://github.com/guzzle/guzzle/tree/7.2.0" }, "funding": [ { @@ -383,20 +382,20 @@ "type": "github" } ], - "time": "2021-03-23T11:33:13+00:00" + "time": "2020-10-10T11:47:56+00:00" }, { "name": "guzzlehttp/promises", - "version": "1.4.1", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d" + "reference": "60d379c243457e073cff02bc323a2a86cb355631" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/8e7d04f1f6450fef59366c399cfad4b9383aa30d", - "reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d", + "url": "https://api.github.com/repos/guzzle/promises/zipball/60d379c243457e073cff02bc323a2a86cb355631", + "reference": "60d379c243457e073cff02bc323a2a86cb355631", "shasum": "" }, "require": { @@ -436,38 +435,35 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/1.4.1" + "source": "https://github.com/guzzle/promises/tree/1.4.0" }, - "time": "2021-03-07T09:25:29+00:00" + "time": "2020-09-30T07:37:28+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.0.0", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "1dc8d9cba3897165e16d12bb13d813afb1eb3fe7" + "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/1dc8d9cba3897165e16d12bb13d813afb1eb3fe7", - "reference": "1dc8d9cba3897165e16d12bb13d813afb1eb3fe7", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/53330f47520498c0ae1f61f7e2c90f55690c06a3", + "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3", "shasum": "" }, "require": { - "php": "^7.2.5 || ^8.0", - "psr/http-factory": "^1.0", - "psr/http-message": "^1.0", - "ralouphie/getallheaders": "^3.0" + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" }, "provide": { - "psr/http-factory-implementation": "1.0", "psr/http-message-implementation": "1.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", - "http-interop/http-factory-tests": "^0.9", - "phpunit/phpunit": "^8.5.8 || ^9.3.10" + "ext-zlib": "*", + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" @@ -475,13 +471,16 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "1.7-dev" } }, "autoload": { "psr-4": { "GuzzleHttp\\Psr7\\": "src/" - } + }, + "files": [ + "src/functions_include.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -496,11 +495,6 @@ { "name": "Tobias Schultze", "homepage": "https://github.com/Tobion" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://sagikazarmark.hu" } ], "description": "PSR-7 message implementation that also provides common utility methods", @@ -516,22 +510,22 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.0.0" + "source": "https://github.com/guzzle/psr7/tree/1.7.0" }, - "time": "2021-06-30T20:03:07+00:00" + "time": "2020-09-30T07:37:11+00:00" }, { "name": "monolog/monolog", - "version": "2.3.2", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "71312564759a7db5b789296369c1a264efc43aad" + "reference": "1cb1cde8e8dd0f70cc0fe51354a59acad9302084" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/71312564759a7db5b789296369c1a264efc43aad", - "reference": "71312564759a7db5b789296369c1a264efc43aad", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/1cb1cde8e8dd0f70cc0fe51354a59acad9302084", + "reference": "1cb1cde8e8dd0f70cc0fe51354a59acad9302084", "shasum": "" }, "require": { @@ -550,7 +544,7 @@ "php-amqplib/php-amqplib": "~2.4", "php-console/php-console": "^3.1.3", "phpspec/prophecy": "^1.6.1", - "phpstan/phpstan": "^0.12.91", + "phpstan/phpstan": "^0.12.59", "phpunit/phpunit": "^8.5", "predis/predis": "^1.1", "rollbar/rollbar": "^1.3", @@ -602,7 +596,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/2.3.2" + "source": "https://github.com/Seldaek/monolog/tree/2.2.0" }, "funding": [ { @@ -614,7 +608,7 @@ "type": "tidelift" } ], - "time": "2021-07-23T07:42:52+00:00" + "time": "2020-12-14T13:15:25+00:00" }, { "name": "myclabs/deep-copy", @@ -676,16 +670,16 @@ }, { "name": "myclabs/php-enum", - "version": "1.8.3", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/myclabs/php-enum.git", - "reference": "b942d263c641ddb5190929ff840c68f78713e937" + "reference": "46cf3d8498b095bd33727b13fd5707263af99421" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/php-enum/zipball/b942d263c641ddb5190929ff840c68f78713e937", - "reference": "b942d263c641ddb5190929ff840c68f78713e937", + "url": "https://api.github.com/repos/myclabs/php-enum/zipball/46cf3d8498b095bd33727b13fd5707263af99421", + "reference": "46cf3d8498b095bd33727b13fd5707263af99421", "shasum": "" }, "require": { @@ -695,7 +689,7 @@ "require-dev": { "phpunit/phpunit": "^9.5", "squizlabs/php_codesniffer": "1.*", - "vimeo/psalm": "^4.6.2" + "vimeo/psalm": "^4.5.1" }, "type": "library", "autoload": { @@ -720,7 +714,7 @@ ], "support": { "issues": "https://github.com/myclabs/php-enum/issues", - "source": "https://github.com/myclabs/php-enum/tree/1.8.3" + "source": "https://github.com/myclabs/php-enum/tree/1.8.0" }, "funding": [ { @@ -732,20 +726,20 @@ "type": "tidelift" } ], - "time": "2021-07-05T08:18:36+00:00" + "time": "2021-02-15T16:11:48+00:00" }, { "name": "nikic/php-parser", - "version": "v4.12.0", + "version": "v4.10.4", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "6608f01670c3cc5079e18c1dab1104e002579143" + "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6608f01670c3cc5079e18c1dab1104e002579143", - "reference": "6608f01670c3cc5079e18c1dab1104e002579143", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c6d052fc58cb876152f89f532b95a8d7907e7f0e", + "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e", "shasum": "" }, "require": { @@ -786,22 +780,22 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.12.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.10.4" }, - "time": "2021-07-21T10:44:31+00:00" + "time": "2020-12-20T10:01:03+00:00" }, { "name": "phar-io/manifest", - "version": "2.0.3", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", + "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", "shasum": "" }, "require": { @@ -846,22 +840,22 @@ "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" + "source": "https://github.com/phar-io/manifest/tree/master" }, - "time": "2021-07-20T11:28:43+00:00" + "time": "2020-06-27T14:33:11+00:00" }, { "name": "phar-io/version", - "version": "3.1.0", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "bae7c545bef187884426f042434e561ab1ddb182" + "reference": "e4782611070e50613683d2b9a57730e9a3ba5451" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", - "reference": "bae7c545bef187884426f042434e561ab1ddb182", + "url": "https://api.github.com/repos/phar-io/version/zipball/e4782611070e50613683d2b9a57730e9a3ba5451", + "reference": "e4782611070e50613683d2b9a57730e9a3ba5451", "shasum": "" }, "require": { @@ -897,22 +891,22 @@ "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.1.0" + "source": "https://github.com/phar-io/version/tree/3.0.4" }, - "time": "2021-02-23T14:00:09+00:00" + "time": "2020-12-13T23:18:30+00:00" }, { "name": "php-mqtt/client", - "version": "v1.1.0", + "version": "v1.0.0", "source": { "type": "git", "url": "https://github.com/php-mqtt/client.git", - "reference": "85fe51d44a75a4e6a46c31137e94538c810515f1" + "reference": "ca47fff0d5513c7ebeba8698e8ff8397414c38d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-mqtt/client/zipball/85fe51d44a75a4e6a46c31137e94538c810515f1", - "reference": "85fe51d44a75a4e6a46c31137e94538c810515f1", + "url": "https://api.github.com/repos/php-mqtt/client/zipball/ca47fff0d5513c7ebeba8698e8ff8397414c38d4", + "reference": "ca47fff0d5513c7ebeba8698e8ff8397414c38d4", "shasum": "" }, "require": { @@ -954,9 +948,9 @@ ], "support": { "issues": "https://github.com/php-mqtt/client/issues", - "source": "https://github.com/php-mqtt/client/tree/v1.1.0" + "source": "https://github.com/php-mqtt/client/tree/v1.0.0" }, - "time": "2021-03-21T19:23:51+00:00" + "time": "2021-01-10T18:42:03+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -1118,16 +1112,16 @@ }, { "name": "phpspec/prophecy", - "version": "1.13.0", + "version": "1.12.2", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea" + "reference": "245710e971a030f42e08f4912863805570f23d39" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/be1996ed8adc35c3fd795488a653f4b518be70ea", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/245710e971a030f42e08f4912863805570f23d39", + "reference": "245710e971a030f42e08f4912863805570f23d39", "shasum": "" }, "require": { @@ -1179,22 +1173,86 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.13.0" + "source": "https://github.com/phpspec/prophecy/tree/1.12.2" }, - "time": "2021-03-17T13:42:18+00:00" + "time": "2020-12-19T10:15:11+00:00" + }, + { + "name": "phpstan/phpstan", + "version": "0.12.91", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "8226701cd228a0d63c2df995de7ab6070c69ac6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/8226701cd228a0d63c2df995de7ab6070c69ac6a", + "reference": "8226701cd228a0d63c2df995de7ab6070c69ac6a", + "shasum": "" + }, + "require": { + "php": "^7.1|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.12-dev" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "support": { + "issues": "https://github.com/phpstan/phpstan/issues", + "source": "https://github.com/phpstan/phpstan/tree/0.12.91" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + }, + { + "url": "https://www.patreon.com/phpstan", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], + "time": "2021-07-04T15:31:48+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.6", + "version": "9.2.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "f6293e1b30a2354e8428e004689671b83871edde" + "reference": "f3e026641cc91909d421802dd3ac7827ebfd97e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f6293e1b30a2354e8428e004689671b83871edde", - "reference": "f6293e1b30a2354e8428e004689671b83871edde", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f3e026641cc91909d421802dd3ac7827ebfd97e1", + "reference": "f3e026641cc91909d421802dd3ac7827ebfd97e1", "shasum": "" }, "require": { @@ -1250,7 +1308,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.6" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.5" }, "funding": [ { @@ -1258,7 +1316,7 @@ "type": "github" } ], - "time": "2021-03-28T07:26:59+00:00" + "time": "2020-11-28T06:44:49+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1503,16 +1561,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.7", + "version": "9.5.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "d0dc8b6999c937616df4fb046792004b33fd31c5" + "reference": "f661659747f2f87f9e72095bb207bceb0f151cb4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0dc8b6999c937616df4fb046792004b33fd31c5", - "reference": "d0dc8b6999c937616df4fb046792004b33fd31c5", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f661659747f2f87f9e72095bb207bceb0f151cb4", + "reference": "f661659747f2f87f9e72095bb207bceb0f151cb4", "shasum": "" }, "require": { @@ -1542,7 +1600,7 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3.4", + "sebastian/type": "^2.3", "sebastian/version": "^3.0.2" }, "require-dev": { @@ -1590,7 +1648,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.7" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.2" }, "funding": [ { @@ -1602,20 +1660,20 @@ "type": "github" } ], - "time": "2021-07-19T06:14:47+00:00" + "time": "2021-02-02T14:45:58+00:00" }, { "name": "psr/log", - "version": "1.1.4", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", "shasum": "" }, "require": { @@ -1639,7 +1697,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" + "homepage": "http://www.php-fig.org/" } ], "description": "Common interface for logging libraries", @@ -1650,9 +1708,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" + "source": "https://github.com/php-fig/log/tree/1.1.3" }, - "time": "2021-05-03T11:20:27+00:00" + "time": "2020-03-23T09:12:05+00:00" }, { "name": "ralouphie/getallheaders", @@ -1698,6 +1756,65 @@ }, "time": "2019-03-08T08:55:37+00:00" }, + { + "name": "rector/rector", + "version": "0.11.36", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "0c1004ad176273c2249a1384ffb160167f5f2199" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/0c1004ad176273c2249a1384ffb160167f5f2199", + "reference": "0c1004ad176273c2249a1384ffb160167f5f2199", + "shasum": "" + }, + "require": { + "php": "^7.1|^8.0", + "phpstan/phpstan": "0.12.91" + }, + "conflict": { + "phpstan/phpdoc-parser": "<=0.5.3", + "phpstan/phpstan": "<=0.12.82", + "rector/rector-cakephp": "*", + "rector/rector-doctrine": "*", + "rector/rector-nette": "*", + "rector/rector-phpunit": "*", + "rector/rector-prefixed": "*", + "rector/rector-symfony": "*" + }, + "bin": [ + "bin/rector" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "0.10-dev" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Prefixed and PHP 7.1 downgraded version of rector/rector", + "support": { + "issues": "https://github.com/rectorphp/rector/issues", + "source": "https://github.com/rectorphp/rector/tree/0.11.36" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2021-07-10T19:27:51+00:00" + }, { "name": "sebastian/cli-parser", "version": "1.0.1", @@ -2204,16 +2321,16 @@ }, { "name": "sebastian/global-state", - "version": "5.0.3", + "version": "5.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49" + "reference": "a90ccbddffa067b51f574dea6eb25d5680839455" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/a90ccbddffa067b51f574dea6eb25d5680839455", + "reference": "a90ccbddffa067b51f574dea6eb25d5680839455", "shasum": "" }, "require": { @@ -2256,7 +2373,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.2" }, "funding": [ { @@ -2264,7 +2381,7 @@ "type": "github" } ], - "time": "2021-06-11T13:31:12+00:00" + "time": "2020-10-26T15:55:19+00:00" }, { "name": "sebastian/lines-of-code", @@ -2551,21 +2668,20 @@ "type": "github" } ], - "abandoned": true, "time": "2020-09-28T06:45:17+00:00" }, { "name": "sebastian/type", - "version": "2.3.4", + "version": "2.3.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" + "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/81cd61ab7bbf2de744aba0ea61fae32f721df3d2", + "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2", "shasum": "" }, "require": { @@ -2600,7 +2716,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" + "source": "https://github.com/sebastianbergmann/type/tree/2.3.1" }, "funding": [ { @@ -2608,7 +2724,7 @@ "type": "github" } ], - "time": "2021-06-15T12:49:02+00:00" + "time": "2020-10-26T13:18:59+00:00" }, { "name": "sebastian/version", @@ -2665,16 +2781,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.23.0", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + "reference": "c6c942b1ac76c82448322025e084cadc56048b4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e", + "reference": "c6c942b1ac76c82448322025e084cadc56048b4e", "shasum": "" }, "require": { @@ -2686,7 +2802,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2724,7 +2840,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.1" }, "funding": [ { @@ -2740,20 +2856,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "theseer/tokenizer", - "version": "1.2.1", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + "reference": "75a63c33a8577608444246075ea0af0d052e452a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", + "reference": "75a63c33a8577608444246075ea0af0d052e452a", "shasum": "" }, "require": { @@ -2782,7 +2898,7 @@ "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" + "source": "https://github.com/theseer/tokenizer/tree/master" }, "funding": [ { @@ -2790,39 +2906,34 @@ "type": "github" } ], - "time": "2021-07-28T10:34:58+00:00" + "time": "2020-07-12T23:59:07+00:00" }, { "name": "webmozart/assert", - "version": "1.10.0", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", + "php": "^5.3.3 || ^7.0 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<4.6.1 || 4.6.2" + "vimeo/psalm": "<3.9.1" }, "require-dev": { - "phpunit/phpunit": "^8.5.13" + "phpunit/phpunit": "^4.8.36 || ^7.5.13" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -2846,9 +2957,9 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.10.0" + "source": "https://github.com/webmozarts/assert/tree/1.9.1" }, - "time": "2021-03-09T10:59:23+00:00" + "time": "2020-07-08T17:02:28+00:00" } ], "aliases": [], @@ -2857,12 +2968,12 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "8.*", + "php": ">=7.4", "ext-dom": "*", "ext-bcmath": "*", "ext-mbstring": "*", "ext-openssl": "*" }, "platform-dev": [], - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.0.0" } diff --git a/src/Api/Dto/JsonDeserializableInterface.php b/src/Api/Dto/JsonDeserializableInterface.php index 9fa0e4b..0d2085b 100644 --- a/src/Api/Dto/JsonDeserializableInterface.php +++ b/src/Api/Dto/JsonDeserializableInterface.php @@ -16,6 +16,6 @@ interface JsonDeserializableInterface * @return self New onboard response created from data array * @throws JsonException Could be thrown if th entity can not be deserialized. */ - public function jsonDeserialize(array|string $jsonData): self; + public function jsonDeserialize($jsonData); } } \ No newline at end of file diff --git a/src/Api/Exceptions/AuthorizationException.php b/src/Api/Exceptions/AuthorizationException.php index dff389c..d3b3c41 100644 --- a/src/Api/Exceptions/AuthorizationException.php +++ b/src/Api/Exceptions/AuthorizationException.php @@ -3,7 +3,6 @@ namespace App\Api\Exceptions { use Exception; - use JetBrains\PhpStorm\Pure; /** * Will be thrown if there is an error during the signature creation process. @@ -17,7 +16,7 @@ class AuthorizationException extends BusinessException * @param int $code The code. * @param Exception|null $previous Previous exception. */ - #[Pure] public function __construct(string $message, int $code, Exception $previous = null) + public function __construct(string $message, int $code, Exception $previous = null) { parent::__construct($message, $code, $previous); } diff --git a/src/Api/Exceptions/BusinessException.php b/src/Api/Exceptions/BusinessException.php index 858dcbc..387d5d4 100644 --- a/src/Api/Exceptions/BusinessException.php +++ b/src/Api/Exceptions/BusinessException.php @@ -3,7 +3,6 @@ namespace App\Api\Exceptions { use Exception; - use JetBrains\PhpStorm\Pure; /** * Wrapper for all internal exceptions. @@ -17,7 +16,7 @@ class BusinessException extends Exception * @param int $code Internal code. * @param Exception|null $previous Previous exception. */ - #[Pure] public function __construct(string $message, int $code, Exception $previous = null) + public function __construct(string $message, int $code, Exception $previous = null) { parent::__construct($message, $code, $previous); diff --git a/src/Api/Exceptions/DecodeMessageException.php b/src/Api/Exceptions/DecodeMessageException.php index 4b00433..498982a 100644 --- a/src/Api/Exceptions/DecodeMessageException.php +++ b/src/Api/Exceptions/DecodeMessageException.php @@ -3,7 +3,6 @@ namespace App\Api\Exceptions { use Exception; - use JetBrains\PhpStorm\Pure; /** * Will be thrown if there is an error while decoding a message from the AR. @@ -17,7 +16,7 @@ class DecodeMessageException extends BusinessException * @param int $code The code. * @param Exception|null $previous Previous exception. */ - #[Pure] public function __construct(string $message, int $code, Exception $previous = null) + public function __construct(string $message, int $code, Exception $previous = null) { parent::__construct($message, $code, $previous); } diff --git a/src/Api/Exceptions/MessagingException.php b/src/Api/Exceptions/MessagingException.php index 905365f..4cdad05 100644 --- a/src/Api/Exceptions/MessagingException.php +++ b/src/Api/Exceptions/MessagingException.php @@ -2,7 +2,6 @@ namespace App\Api\Exceptions { - use JetBrains\PhpStorm\Pure; /** * Generic messaging exception. @@ -16,7 +15,7 @@ class MessagingException extends BusinessException * @param string $message The message. * @param int $code The code. */ - #[Pure] public function __construct(string $message, int $code) + public function __construct(string $message, int $code) { parent::__construct($message, $code); } diff --git a/src/Api/Exceptions/OnboardException.php b/src/Api/Exceptions/OnboardException.php index 00ca5b2..12646d5 100644 --- a/src/Api/Exceptions/OnboardException.php +++ b/src/Api/Exceptions/OnboardException.php @@ -2,7 +2,6 @@ namespace App\Api\Exceptions { - use JetBrains\PhpStorm\Pure; /** * Will be thrown if there is an error during the onboard process. @@ -16,7 +15,7 @@ class OnboardException extends BusinessException * @param string $message The message. * @param int $code The code. */ - #[Pure] public function __construct(string $message, int $code) + public function __construct(string $message, int $code) { parent::__construct($message, $code); } diff --git a/src/Api/Exceptions/OutboxException.php b/src/Api/Exceptions/OutboxException.php index 5b033bc..14b6313 100644 --- a/src/Api/Exceptions/OutboxException.php +++ b/src/Api/Exceptions/OutboxException.php @@ -2,7 +2,6 @@ namespace App\Api\Exceptions { - use JetBrains\PhpStorm\Pure; /** * Will be thrown if there is any problem during the interaction with the outbox. @@ -16,7 +15,7 @@ class OutboxException extends BusinessException * @param string $message The message. * @param int $code The code. */ - #[Pure] public function __construct(string $message, int $code) + public function __construct(string $message, int $code) { parent::__construct($message, $code); } diff --git a/src/Api/Exceptions/RevokeException.php b/src/Api/Exceptions/RevokeException.php index f341efa..a66345a 100644 --- a/src/Api/Exceptions/RevokeException.php +++ b/src/Api/Exceptions/RevokeException.php @@ -2,7 +2,6 @@ namespace App\Api\Exceptions { - use JetBrains\PhpStorm\Pure; /** * Will be thrown if there is an error during the revoke endpoint process. @@ -16,7 +15,7 @@ class RevokeException extends BusinessException * @param string $message The message. * @param int $code The code. */ - #[Pure] public function __construct(string $message, int $code) + public function __construct(string $message, int $code) { parent::__construct($message, $code); } diff --git a/src/Api/Exceptions/SignatureException.php b/src/Api/Exceptions/SignatureException.php index c45786d..97bfbf5 100644 --- a/src/Api/Exceptions/SignatureException.php +++ b/src/Api/Exceptions/SignatureException.php @@ -3,7 +3,6 @@ namespace App\Api\Exceptions { use Exception; - use JetBrains\PhpStorm\Pure; /** * Will be thrown if there is an error during the signature creation process. @@ -17,7 +16,7 @@ class SignatureException extends BusinessException * @param int $code The code. * @param Exception|null $previous */ - #[Pure] public function __construct(string $message, int $code, Exception $previous = null) + public function __construct(string $message, int $code, Exception $previous = null) { parent::__construct($message, $code, $previous); } diff --git a/src/Api/Exceptions/ValidationException.php b/src/Api/Exceptions/ValidationException.php index 87ea10c..1303937 100644 --- a/src/Api/Exceptions/ValidationException.php +++ b/src/Api/Exceptions/ValidationException.php @@ -2,7 +2,6 @@ namespace App\Api\Exceptions { - use JetBrains\PhpStorm\Pure; /** * Will be thrown if the parameters are not valid. @@ -15,7 +14,7 @@ class ValidationException extends BusinessException * Constructor. * @param string $invalidParameter Invalid parameter */ - #[Pure] public function __construct(string $invalidParameter) + public function __construct(string $invalidParameter) { parent::__construct("Parameters passed are not valid. The following parameter is invalid >>> $invalidParameter", ErrorCodes::PARAMETER_INVALID); } diff --git a/src/Api/Exceptions/VerificationException.php b/src/Api/Exceptions/VerificationException.php index d946063..345a488 100644 --- a/src/Api/Exceptions/VerificationException.php +++ b/src/Api/Exceptions/VerificationException.php @@ -2,7 +2,6 @@ namespace App\Api\Exceptions { - use JetBrains\PhpStorm\Pure; /** * Will be thrown if there is an error during the verification process. @@ -16,7 +15,7 @@ class VerificationException extends BusinessException * @param string $message The message. * @param int $code The code. */ - #[Pure] public function __construct(string $message, int $code) + public function __construct(string $message, int $code) { parent::__construct($message, $code); } diff --git a/src/Dto/Messaging/Http/Inner/Command.php b/src/Dto/Messaging/Http/Inner/Command.php index 3e28aec..60d976b 100644 --- a/src/Dto/Messaging/Http/Inner/Command.php +++ b/src/Dto/Messaging/Http/Inner/Command.php @@ -16,7 +16,10 @@ class Command implements JsonDeserializableInterface private ?string $message = null; - public function jsonDeserialize(array|string $jsonData): JsonDeserializableInterface + /** + * @param mixed[]|string $jsonData + */ + public function jsonDeserialize($jsonData): JsonDeserializableInterface { if (is_string($jsonData)) { $decodedJsonDataArray = json_decode($jsonData, true); @@ -24,10 +27,14 @@ public function jsonDeserialize(array|string $jsonData): JsonDeserializableInter $decodedJsonDataArray = $jsonData; } foreach ($decodedJsonDataArray as $fieldName => $fieldValue) { - $this->message = match ($fieldName) { - self::MESSAGE => $fieldValue, - default => throw new JsonException("Unknown field '$fieldName' for class '" . get_class($this) . "'.", ErrorCodes::UNKNOWN_FIELD_IN_JSON_DATA), - }; + switch ($fieldName) { + case self::MESSAGE: + $this->message = $fieldValue; + break; + default: + throw new JsonException("Unknown field '$fieldName' for class '" . get_class($this) . "'.", ErrorCodes::UNKNOWN_FIELD_IN_JSON_DATA); + break; + } } return $this; } diff --git a/src/Dto/Messaging/Http/Inner/OutboxMessage.php b/src/Dto/Messaging/Http/Inner/OutboxMessage.php index 89bb0a5..4957f3c 100644 --- a/src/Dto/Messaging/Http/Inner/OutboxMessage.php +++ b/src/Dto/Messaging/Http/Inner/OutboxMessage.php @@ -20,7 +20,10 @@ class OutboxMessage implements JsonDeserializableInterface private ?string $sensorAlternateId = null; private ?Command $command = null; - public function jsonDeserialize(array|string $jsonData): JsonDeserializableInterface + /** + * @param mixed[]|string $jsonData + */ + public function jsonDeserialize($jsonData): JsonDeserializableInterface { if (is_string($jsonData)) { $decodedJsonDataArray = json_decode($jsonData, true); diff --git a/src/Dto/Messaging/Http/OutboxResponse.php b/src/Dto/Messaging/Http/OutboxResponse.php index 70b8c02..49b73ce 100644 --- a/src/Dto/Messaging/Http/OutboxResponse.php +++ b/src/Dto/Messaging/Http/OutboxResponse.php @@ -18,7 +18,10 @@ class OutboxResponse implements JsonDeserializableInterface */ private ?array $messages = null; - public function jsonDeserialize(array|string $jsonData): JsonDeserializableInterface + /** + * @param mixed[]|string $jsonData + */ + public function jsonDeserialize($jsonData): JsonDeserializableInterface { if (is_string($jsonData)) { $decodedJsonDataArray = json_decode($jsonData, true); @@ -34,7 +37,7 @@ public function jsonDeserialize(array|string $jsonData): JsonDeserializableInter return $this; } - public function getStatusCode(): string + public function getStatusCode(): ?string { return $this->statusCode; } @@ -47,7 +50,7 @@ public function setStatusCode(string $statusCode): void /** * @return OutboxMessage[] */ - public function getMessages(): array + public function getMessages(): ?array { return $this->messages; } diff --git a/src/Dto/Messaging/Inner/Message.php b/src/Dto/Messaging/Inner/Message.php index 77120f4..0df8dce 100644 --- a/src/Dto/Messaging/Inner/Message.php +++ b/src/Dto/Messaging/Inner/Message.php @@ -37,7 +37,6 @@ public function setTimestamp(string $timestamp): void $this->timestamp = $timestamp; } - #[ArrayShape([self::MESSAGE => "string", self::TIMESTAMP => "string"])] public function jsonSerialize(): array { return [ diff --git a/src/Dto/Onboard/Authentication.php b/src/Dto/Onboard/Authentication.php index 97f8d86..83be75e 100644 --- a/src/Dto/Onboard/Authentication.php +++ b/src/Dto/Onboard/Authentication.php @@ -23,7 +23,6 @@ class Authentication implements JsonSerializable, JsonDeserializableInterface private ?string $certificate = null; - #[ArrayShape([self::TYPE => "string", self::SECRET => "string", self::CERTIFICATE => "string"])] public function jsonSerialize(): array { return [ @@ -63,7 +62,11 @@ public function setCertificate(string $certificate): void $this->certificate = $certificate; } - public function jsonDeserialize(string|array $jsonData): self + /** + * @param string|mixed[] $jsonData + * @return $this + */ + public function jsonDeserialize($jsonData) { if (is_string($jsonData)) { $decodedJsonDataArray = json_decode($jsonData, true); diff --git a/src/Dto/Onboard/AuthorizationToken.php b/src/Dto/Onboard/AuthorizationToken.php index 4c754f5..4b8f470 100644 --- a/src/Dto/Onboard/AuthorizationToken.php +++ b/src/Dto/Onboard/AuthorizationToken.php @@ -50,7 +50,11 @@ public function setExpires(string $expires): void $this->expires = $expires; } - public function jsonDeserialize(string|array $jsonData): self + /** + * @param string|mixed[] $jsonData + * @return $this + */ + public function jsonDeserialize($jsonData) { if (is_string($jsonData)) { $decodedJsonDataArray = json_decode($jsonData, true); diff --git a/src/Dto/Onboard/AuthorizationUrlResult.php b/src/Dto/Onboard/AuthorizationUrlResult.php index 8701314..f658bc9 100644 --- a/src/Dto/Onboard/AuthorizationUrlResult.php +++ b/src/Dto/Onboard/AuthorizationUrlResult.php @@ -11,6 +11,13 @@ class AuthorizationUrlResult private ?string $authorizationUrl = null; private ?string $state = null; + public function __construct(?string $authorizationUrl, ?string $state) + { + $this->authorizationUrl = $authorizationUrl; + $this->state = $state; + } + + public function getAuthorizationUrl(): ?string { return $this->authorizationUrl; diff --git a/src/Dto/Onboard/ConnectionCriteria.php b/src/Dto/Onboard/ConnectionCriteria.php index 1f2b37f..303f381 100644 --- a/src/Dto/Onboard/ConnectionCriteria.php +++ b/src/Dto/Onboard/ConnectionCriteria.php @@ -28,7 +28,6 @@ class ConnectionCriteria implements JsonSerializable, JsonDeserializableInterfac private ?string $port = null; private ?string $clientId = null; - #[ArrayShape([self::CLIENT_ID => "string", self::COMMANDS => "string", self::GATEWAY_ID => "string", self::HOST => "string", self::MEASURES => "string", self::PORT => "string"])] public function jsonSerialize(): array { return [ @@ -102,7 +101,11 @@ public function setPort(string $port): void $this->port = $port; } - public function jsonDeserialize(string|array $jsonData): self + /** + * @param string|mixed[] $jsonData + * @return $this + */ + public function jsonDeserialize($jsonData) { if (is_string($jsonData)) { $decodedJsonDataArray = json_decode($jsonData, true); diff --git a/src/Dto/Onboard/OnboardResponse.php b/src/Dto/Onboard/OnboardResponse.php index a875d2e..18a82a1 100644 --- a/src/Dto/Onboard/OnboardResponse.php +++ b/src/Dto/Onboard/OnboardResponse.php @@ -30,8 +30,6 @@ class OnboardResponse implements JsonSerializable, JsonDeserializableInterface * Serializes the object data to a simple array * @return array Array with object data. */ - #[ArrayShape([self::AUTHENTICATION => Authentication::class, self::CAPABILITY_ALTERNATE_ID => "string", - self::CONNECTION_CRITERIA => ConnectionCriteria::class, self::DEVICE_ALTERNATE_ID => "string", self::SENSOR_ALTERNATE_ID => "string"])] public function jsonSerialize(): array { return [ @@ -93,7 +91,11 @@ public function setSensorAlternateId(string $sensorAlternateId): void $this->sensorAlternateId = $sensorAlternateId; } - public function jsonDeserialize(array|string $jsonData): self + /** + * @param mixed[]|string $jsonData + * @return $this + */ + public function jsonDeserialize($jsonData) { if (is_string($jsonData)) { $decodedJsonDataArray = json_decode($jsonData, true); diff --git a/src/Dto/Onboard/VerificationResponse.php b/src/Dto/Onboard/VerificationResponse.php index 03f5193..a7ad5a7 100644 --- a/src/Dto/Onboard/VerificationResponse.php +++ b/src/Dto/Onboard/VerificationResponse.php @@ -22,7 +22,6 @@ class VerificationResponse implements JsonSerializable, JsonDeserializableInterf * Serializes the object data to a simple array * @return array Array with object data. */ - #[ArrayShape([self::ACCOUNT_ID => "string"])] public function jsonSerialize(): array { return [ @@ -40,7 +39,11 @@ public function setAccountId(string $accountId): void $this->accountId = $accountId; } - public function jsonDeserialize(array|string $jsonData): self + /** + * @param mixed[]|string $jsonData + * @return $this + */ + public function jsonDeserialize($jsonData) { if (is_string($jsonData)) { $decodedJsonDataArray = json_decode($jsonData, true); @@ -48,10 +51,14 @@ public function jsonDeserialize(array|string $jsonData): self $decodedJsonDataArray = $jsonData; } foreach ($decodedJsonDataArray as $fieldName => $fieldValue) { - $this->accountId = match ($fieldName) { - self::ACCOUNT_ID => $fieldValue, - default => throw new JsonException("Unknown field '$fieldName' for class '" . get_class($this) . "'.", ErrorCodes::UNKNOWN_FIELD_IN_JSON_DATA), - }; + switch ($fieldName) { + case self::ACCOUNT_ID: + $this->accountId = $fieldValue; + break; + default: + throw new JsonException("Unknown field '$fieldName' for class '" . get_class($this) . "'.", ErrorCodes::UNKNOWN_FIELD_IN_JSON_DATA); + break; + } } return $this; } diff --git a/src/Dto/Requests/MessageRequest.php b/src/Dto/Requests/MessageRequest.php index 833091a..38ebea6 100644 --- a/src/Dto/Requests/MessageRequest.php +++ b/src/Dto/Requests/MessageRequest.php @@ -59,7 +59,6 @@ public function setMessages(array $messages): void $this->messages = $messages; } - #[ArrayShape([self::SENSOR_ALTERNATE_ID => "string", self::CAPABILITY_ALTERNATE_ID => "string", self::MESSAGES => "array"])] public function jsonSerialize(): array { return [ diff --git a/src/Dto/Requests/OnboardRequest.php b/src/Dto/Requests/OnboardRequest.php index 19e705b..4925f9b 100644 --- a/src/Dto/Requests/OnboardRequest.php +++ b/src/Dto/Requests/OnboardRequest.php @@ -97,7 +97,6 @@ public function setCertificateType(string $certificateType): void $this->certificateType = $certificateType; } - #[ArrayShape([self::ID => "string", self::APPLICATION_ID => "string", self::CERTIFICATION_VERSION_ID => "string", self::GATEWAY_ID => "string", self::UTC_TIMESTAMP => "string", self::TIME_ZONE => "string", self::CERTIFICATE_TYPE => "string"])] public function jsonSerialize(): array { return [ diff --git a/src/Dto/Requests/RevokeRequest.php b/src/Dto/Requests/RevokeRequest.php index aaca15e..7c06d48 100644 --- a/src/Dto/Requests/RevokeRequest.php +++ b/src/Dto/Requests/RevokeRequest.php @@ -26,7 +26,6 @@ class RevokeRequest implements JsonSerializable private ?string $utcTimestamp = null; private ?string $timeZone = null; - #[ArrayShape([self::ACCOUNT_ID => "string", self::ENDPOINT_IDS => "array", self::UTC_TIMESTAMP => "string", self::TIME_ZONE => "string"])] public function jsonSerialize(): array { return [ diff --git a/src/Service/Cloud/CloudOffboardService.php b/src/Service/Cloud/CloudOffboardService.php index f0946d2..840c278 100644 --- a/src/Service/Cloud/CloudOffboardService.php +++ b/src/Service/Cloud/CloudOffboardService.php @@ -16,7 +16,6 @@ use App\Service\Parameters\CloudOffboardParameters; use App\Service\Parameters\MessageHeaderParameters; use App\Service\Parameters\MessagePayloadParameters; - use JetBrains\PhpStorm\Pure; /** * Service to send the cloud onboard message to the AR. @@ -33,7 +32,7 @@ class CloudOffboardService implements MessagingServiceInterface, EncodeMessageSe * Constructor. * @param MessagingServiceInterface $messagingService Service for message sending. */ - #[Pure] public function __construct(MessagingServiceInterface $messagingService) + public function __construct(MessagingServiceInterface $messagingService) { $this->messagingService = $messagingService; } diff --git a/src/Service/Cloud/CloudOnboardService.php b/src/Service/Cloud/CloudOnboardService.php index 4bc4308..1154c8f 100644 --- a/src/Service/Cloud/CloudOnboardService.php +++ b/src/Service/Cloud/CloudOnboardService.php @@ -16,7 +16,6 @@ use App\Service\Parameters\CloudOnboardParameters; use App\Service\Parameters\MessageHeaderParameters; use App\Service\Parameters\MessagePayloadParameters; - use JetBrains\PhpStorm\Pure; /** * Service to send the cloud onboard message to the AR. @@ -33,7 +32,7 @@ class CloudOnboardService implements MessagingServiceInterface, EncodeMessageSer * Constructor. * @param MessagingServiceInterface $messagingService Service for message sending. */ - #[Pure] public function __construct(MessagingServiceInterface $messagingService) + public function __construct(MessagingServiceInterface $messagingService) { $this->messagingService = $messagingService; } diff --git a/src/Service/Common/DecodeMessageService.php b/src/Service/Common/DecodeMessageService.php index b77f1a5..6455911 100644 --- a/src/Service/Common/DecodeMessageService.php +++ b/src/Service/Common/DecodeMessageService.php @@ -61,7 +61,7 @@ public function decodeResponse(string $message): DecodedMessage * @throws Exception * @noinspection PhpMixedReturnTypeCanBeReducedInspection */ - public function decodeDetails(Any $details): mixed + public function decodeDetails(Any $details) { switch ($details->getTypeUrl()) { case TypeUrlService::getTypeUrl(Messages::class): diff --git a/src/Service/Common/EncodeMessageService.php b/src/Service/Common/EncodeMessageService.php index 14625ae..a183022 100644 --- a/src/Service/Common/EncodeMessageService.php +++ b/src/Service/Common/EncodeMessageService.php @@ -40,8 +40,14 @@ private function encodeHeader(MessageHeaderParameters $messageHeaderParameters): $requestEnvelope->setApplicationMessageId(empty($messageHeaderParameters->getApplicationMessageId()) ? UuidService::newUuid() : $messageHeaderParameters->getApplicationMessageId()); $requestEnvelope->setApplicationMessageSeqNo($messageHeaderParameters->getApplicationMessageSeqNo()); $requestEnvelope->setTechnicalMessageType($messageHeaderParameters->getTechnicalMessageType()); + $recipients = $messageHeaderParameters->getRecipients(); + if (!empty($recipients)) { + $requestEnvelope->setRecipients($messageHeaderParameters->getRecipients()); + } $requestEnvelope->setMode($messageHeaderParameters->getMode()); $requestEnvelope->setTimestamp(UtcDataService::nowAsTimestamp()); + $requestEnvelope->setMetadata($messageHeaderParameters->getMetadata()); + $requestEnvelope->setChunkInfo($messageHeaderParameters->getChunkComponent()); return $requestEnvelope; } diff --git a/src/Service/Common/UtcDataService.php b/src/Service/Common/UtcDataService.php index 97cbe4f..0074d2a 100644 --- a/src/Service/Common/UtcDataService.php +++ b/src/Service/Common/UtcDataService.php @@ -5,7 +5,6 @@ use DateTime; use DateTimeZone; use Google\Protobuf\Timestamp; - use JetBrains\PhpStorm\Pure; /** * Service to generate timestamps and hold UTC specific functions. @@ -22,7 +21,7 @@ class UtcDataService */ public static function now(): string { - $d = new DateTime(null, new DateTimeZone('UTC')); + $d = new DateTime('now', new DateTimeZone('UTC')); return $d->format("Y-m-d\TH:i:s.v\Z"); } @@ -45,7 +44,7 @@ public static function getAsTimestamp(DateTime $d): string * @param int $offset . * @return string The current time zone. */ - #[Pure] public static function timeZone(int $offset): string + public static function timeZone(int $offset): string { return sprintf("%s%02d:00", ($offset >= 0) ? '+' : '-', abs($offset / 3600)); } diff --git a/src/Service/Common/UuidService.php b/src/Service/Common/UuidService.php index e54b1cb..4b84da0 100644 --- a/src/Service/Common/UuidService.php +++ b/src/Service/Common/UuidService.php @@ -2,7 +2,6 @@ namespace App\Service\Common { - use JetBrains\PhpStorm\Pure; /** * Service to generate UUIDs. @@ -15,7 +14,7 @@ class UuidService * Generate a new UUID. * @return string . */ - #[Pure] public static function newUuid(): string + public static function newUuid(): string { return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff), mt_rand(0, 0xffff), diff --git a/src/Service/Messaging/CapabilityService.php b/src/Service/Messaging/CapabilityService.php index 3274b8f..84d1ad3 100644 --- a/src/Service/Messaging/CapabilityService.php +++ b/src/Service/Messaging/CapabilityService.php @@ -16,7 +16,6 @@ use App\Service\Parameters\CapabilityParameters; use App\Service\Parameters\MessageHeaderParameters; use App\Service\Parameters\MessagePayloadParameters; - use JetBrains\PhpStorm\Pure; /** * Service to send the capabilities to the AR. @@ -33,7 +32,7 @@ class CapabilityService implements MessagingServiceInterface, EncodeMessageServi * Constructor. * @param MessagingServiceInterface $messagingService Service for message sending. */ - #[Pure] public function __construct(MessagingServiceInterface $messagingService) + public function __construct(MessagingServiceInterface $messagingService) { $this->messagingService = $messagingService; } diff --git a/src/Service/Messaging/FeedConfirmService.php b/src/Service/Messaging/FeedConfirmService.php index 4752b61..9c389da 100644 --- a/src/Service/Messaging/FeedConfirmService.php +++ b/src/Service/Messaging/FeedConfirmService.php @@ -16,7 +16,6 @@ use App\Service\Parameters\FeedConfirmParameters; use App\Service\Parameters\MessageHeaderParameters; use App\Service\Parameters\MessagePayloadParameters; - use JetBrains\PhpStorm\Pure; /** * Service to send the message confirmations to the AR. @@ -33,7 +32,7 @@ class FeedConfirmService implements MessagingServiceInterface, EncodeMessageServ * Constructor. * @param MessagingServiceInterface $messagingService Service for message sending. */ - #[Pure] public function __construct(MessagingServiceInterface $messagingService) + public function __construct(MessagingServiceInterface $messagingService) { $this->messagingService = $messagingService; } diff --git a/src/Service/Messaging/FeedDeleteService.php b/src/Service/Messaging/FeedDeleteService.php index 7e7b7ac..71d0d73 100644 --- a/src/Service/Messaging/FeedDeleteService.php +++ b/src/Service/Messaging/FeedDeleteService.php @@ -18,7 +18,6 @@ use App\Service\Parameters\FeedDeleteParameters; use App\Service\Parameters\MessageHeaderParameters; use App\Service\Parameters\MessagePayloadParameters; - use JetBrains\PhpStorm\Pure; /** * Service to send the delete message request to the AR. @@ -35,7 +34,7 @@ class FeedDeleteService implements MessagingServiceInterface, EncodeMessageServi * Constructor. * @param MessagingServiceInterface $messagingService Service for message sending. */ - #[Pure] public function __construct(MessagingServiceInterface $messagingService) + public function __construct(MessagingServiceInterface $messagingService) { $this->messagingService = $messagingService; } diff --git a/src/Service/Messaging/ListEndpointsService.php b/src/Service/Messaging/ListEndpointsService.php index c5478fd..cd693fc 100644 --- a/src/Service/Messaging/ListEndpointsService.php +++ b/src/Service/Messaging/ListEndpointsService.php @@ -16,7 +16,6 @@ use App\Service\Parameters\ListEndpointsParameters; use App\Service\Parameters\MessageHeaderParameters; use App\Service\Parameters\MessagePayloadParameters; - use JetBrains\PhpStorm\Pure; /** * Service to send the subscriptions to the AR. @@ -33,7 +32,7 @@ class ListEndpointsService implements MessagingServiceInterface, EncodeMessageSe * Constructor. * @param MessagingServiceInterface $messagingService Service for message sending. */ - #[Pure] public function __construct(MessagingServiceInterface $messagingService) + public function __construct(MessagingServiceInterface $messagingService) { $this->messagingService = $messagingService; } diff --git a/src/Service/Messaging/QueryHeadersService.php b/src/Service/Messaging/QueryHeadersService.php index a8f26eb..6209004 100644 --- a/src/Service/Messaging/QueryHeadersService.php +++ b/src/Service/Messaging/QueryHeadersService.php @@ -17,7 +17,6 @@ use App\Service\Parameters\MessageHeaderParameters; use App\Service\Parameters\MessagePayloadParameters; use App\Service\Parameters\QueryHeadersParameters; - use JetBrains\PhpStorm\Pure; /** * Service to fetch the message headers from the AR. @@ -34,7 +33,7 @@ class QueryHeadersService implements MessagingServiceInterface, EncodeMessageSer * Constructor. * @param MessagingServiceInterface $messagingService Service for message sending. */ - #[Pure] public function __construct(MessagingServiceInterface $messagingService) + public function __construct(MessagingServiceInterface $messagingService) { $this->messagingService = $messagingService; } diff --git a/src/Service/Messaging/QueryMessagesService.php b/src/Service/Messaging/QueryMessagesService.php index dd576cd..cf2e2c2 100644 --- a/src/Service/Messaging/QueryMessagesService.php +++ b/src/Service/Messaging/QueryMessagesService.php @@ -17,7 +17,6 @@ use App\Service\Parameters\MessageHeaderParameters; use App\Service\Parameters\MessagePayloadParameters; use App\Service\Parameters\QueryMessagesParameters; - use JetBrains\PhpStorm\Pure; /** * Service to fetch the message headers from the AR. @@ -34,7 +33,7 @@ class QueryMessagesService implements MessagingServiceInterface, EncodeMessageSe * Constructor. * @param MessagingServiceInterface $messagingService Service for message sending. */ - #[Pure] public function __construct(MessagingServiceInterface $messagingService) + public function __construct(MessagingServiceInterface $messagingService) { $this->messagingService = $messagingService; } diff --git a/src/Service/Messaging/SubscriptionService.php b/src/Service/Messaging/SubscriptionService.php index cdcc83e..592baf9 100644 --- a/src/Service/Messaging/SubscriptionService.php +++ b/src/Service/Messaging/SubscriptionService.php @@ -16,7 +16,6 @@ use App\Service\Parameters\MessageHeaderParameters; use App\Service\Parameters\MessagePayloadParameters; use App\Service\Parameters\SubscriptionParameters; - use JetBrains\PhpStorm\Pure; /** * Service to send the subscriptions to the AR. @@ -33,7 +32,7 @@ class SubscriptionService implements MessagingServiceInterface, EncodeMessageSer * Constructor. * @param MessagingServiceInterface $messagingService Service for message sending. */ - #[Pure] public function __construct(MessagingServiceInterface $messagingService) + public function __construct(MessagingServiceInterface $messagingService) { $this->messagingService = $messagingService; } diff --git a/src/Service/Parameters/ListEndpointsParameters.php b/src/Service/Parameters/ListEndpointsParameters.php index 8825998..201ebdc 100644 --- a/src/Service/Parameters/ListEndpointsParameters.php +++ b/src/Service/Parameters/ListEndpointsParameters.php @@ -15,7 +15,7 @@ class ListEndpointsParameters extends MessageParameters private ?string $direction = null; private bool $filtered = false; - public function getTechnicalMessageType(): string + public function getTechnicalMessageType(): ?string { return $this->technicalMessageType; } @@ -25,7 +25,7 @@ public function setTechnicalMessageType(string $technicalMessageType): void $this->technicalMessageType = $technicalMessageType; } - public function getDirection(): string + public function getDirection(): ?string { return $this->direction; } diff --git a/src/Service/Parameters/MessageHeaderParameters.php b/src/Service/Parameters/MessageHeaderParameters.php index c394486..0a93862 100644 --- a/src/Service/Parameters/MessageHeaderParameters.php +++ b/src/Service/Parameters/MessageHeaderParameters.php @@ -3,6 +3,7 @@ namespace App\Service\Parameters { use Agrirouter\Commons\ChunkComponent; + use Agrirouter\Commons\Metadata; use App\Api\Service\Parameters\Parameters; use App\Api\Service\Parameters\ValidatableInterface; @@ -20,6 +21,7 @@ class MessageHeaderParameters extends Parameters implements ValidatableInterface */ private ?array $recipients = null; private ?ChunkComponent $chunkComponent = null; + private ?Metadata $metadata = null; public function validate(): void { @@ -59,7 +61,7 @@ public function setTeamSetContextId(string $teamSetContextId): void /** * @return string[] */ - public function getRecipients(): array + public function getRecipients(): ?array { return $this->recipients; } @@ -72,7 +74,7 @@ public function setRecipients(array $recipients): void $this->recipients = $recipients; } - public function getChunkComponent(): ChunkComponent + public function getChunkComponent(): ?ChunkComponent { return $this->chunkComponent; } @@ -81,5 +83,15 @@ public function setChunkComponent(ChunkComponent $chunkComponent): void { $this->chunkComponent = $chunkComponent; } + + public function getMetadata(): ?Metadata + { + return $this->metadata; + } + + public function setMetadata(Metadata $metadata): void + { + $this->metadata = $metadata; + } } } diff --git a/tests/Helper/MqttClient.php b/tests/Helper/MqttClient.php index 1f019af..4dacdfb 100644 --- a/tests/Helper/MqttClient.php +++ b/tests/Helper/MqttClient.php @@ -36,7 +36,7 @@ class MqttClient implements MqttClientInterface * @param PhpMqttClient $mqttClient The PhpMqtt client. * @param LoggerInterface|null $logger The logger used for logging. */ - #[Pure] public function __construct(PhpMqttClient $mqttClient, ?LoggerInterface $logger = null) + public function __construct(PhpMqttClient $mqttClient, ?LoggerInterface $logger = null) { $this->mqttClient = $mqttClient; $this->logger = $logger; @@ -93,7 +93,7 @@ public function unsubscribe(string $topic): void /** * @inheritDoc */ - #[Pure] public function isConnected(): bool + public function isConnected(): bool { return $this->mqttClient->isConnected(); } diff --git a/tests/Service/Messaging/Mqtt/CapabilityServiceTest.php b/tests/Service/Messaging/Mqtt/CapabilityServiceTest.php index 0d7eaf7..448ea06 100644 --- a/tests/Service/Messaging/Mqtt/CapabilityServiceTest.php +++ b/tests/Service/Messaging/Mqtt/CapabilityServiceTest.php @@ -128,7 +128,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $capabilityParameters->setCapabilityParameters($capabilities); $capabilityService->send($capabilityParameters); - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); if ($callbackException !== null) { throw($callbackException); } @@ -188,7 +188,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $capabilityParameters->setCapabilityParameters($capabilityBuilder->build()); $capabilityService->send($capabilityParameters); - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); if ($callbackException !== null) { throw($callbackException); } @@ -267,7 +267,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $counter = 0; do { - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); $counter++; if ($callbackException !== null) { throw($callbackException); @@ -350,7 +350,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $counter = 0; do { - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); $counter++; if ($callbackException !== null) { throw($callbackException); @@ -433,7 +433,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $counter = 0; do { - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); $counter++; if ($callbackException !== null) { throw($callbackException); @@ -522,7 +522,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $counter = 0; do { - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); $counter++; if ($callbackException !== null) { throw($callbackException); @@ -611,7 +611,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $counter = 0; do { - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); $counter++; if ($callbackException !== null) { throw($callbackException); @@ -694,7 +694,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $counter = 0; do { - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); $counter++; if ($callbackException !== null) { throw($callbackException); @@ -777,7 +777,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $counter = 0; do { - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); $counter++; if ($callbackException !== null) { throw($callbackException); @@ -860,7 +860,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $counter = 0; do { - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); $counter++; if ($callbackException !== null) { throw($callbackException); @@ -979,7 +979,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $counter = 0; do { - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); $counter++; if ($callbackException !== null) { throw($callbackException); diff --git a/tests/Service/Messaging/Mqtt/Cloud/CloudOffboardServiceTest.php b/tests/Service/Messaging/Mqtt/Cloud/CloudOffboardServiceTest.php index 2dfce45..c170ff7 100644 --- a/tests/Service/Messaging/Mqtt/Cloud/CloudOffboardServiceTest.php +++ b/tests/Service/Messaging/Mqtt/Cloud/CloudOffboardServiceTest.php @@ -113,7 +113,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $cloudOnboardParameters->setEndpoints($onboardRequests); $cloudOffboardService->send($cloudOnboardParameters); - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); if ($callbackException !== null) { throw($callbackException); } diff --git a/tests/Service/Messaging/Mqtt/Cloud/CloudOnboardServiceTest.php b/tests/Service/Messaging/Mqtt/Cloud/CloudOnboardServiceTest.php index de579aa..132ee48 100644 --- a/tests/Service/Messaging/Mqtt/Cloud/CloudOnboardServiceTest.php +++ b/tests/Service/Messaging/Mqtt/Cloud/CloudOnboardServiceTest.php @@ -117,7 +117,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $cloudOnboardService->send($cloudOnboardParameters); - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); if ($callbackException !== null) { throw($callbackException); } diff --git a/tests/Service/Messaging/Mqtt/FeedConfirmServiceTest.php b/tests/Service/Messaging/Mqtt/FeedConfirmServiceTest.php index ba6d7d1..9d85243 100644 --- a/tests/Service/Messaging/Mqtt/FeedConfirmServiceTest.php +++ b/tests/Service/Messaging/Mqtt/FeedConfirmServiceTest.php @@ -104,7 +104,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $feedConfirmParameters->setMessageIds([UuidService::newUuid()]); $feedConfirmService->send($feedConfirmParameters); - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); if ($callbackException !== null) { throw($callbackException); } @@ -156,7 +156,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $feedConfirmParameters->setOnboardResponse(self::$onboardResponse); $feedConfirmService->send($feedConfirmParameters); - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); if ($callbackException !== null) { throw($callbackException); } diff --git a/tests/Service/Messaging/Mqtt/FeedDeleteServiceTest.php b/tests/Service/Messaging/Mqtt/FeedDeleteServiceTest.php index adaca56..565b864 100644 --- a/tests/Service/Messaging/Mqtt/FeedDeleteServiceTest.php +++ b/tests/Service/Messaging/Mqtt/FeedDeleteServiceTest.php @@ -106,7 +106,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $feedDeleteService->send($feedDeleteParameters); - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); if ($callbackException !== null) { throw($callbackException); } @@ -159,7 +159,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $feedDeleteParameters->setMessageIds([UuidService::newUuid()]); $feedDeleteService->send($feedDeleteParameters); - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); if ($callbackException !== null) { throw($callbackException); } @@ -212,7 +212,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $feedDeleteParameters->setSenders([UuidService::newUuid()]); $feedDeleteService->send($feedDeleteParameters); - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); if ($callbackException !== null) { throw($callbackException); } @@ -270,7 +270,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $feedDeleteParameters->setValidityPeriod($validityPeriod); $feedDeleteService->send($feedDeleteParameters); - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); if ($callbackException !== null) { throw($callbackException); } diff --git a/tests/Service/Messaging/Mqtt/ListEndpointsServiceTest.php b/tests/Service/Messaging/Mqtt/ListEndpointsServiceTest.php index a414fd6..e340500 100644 --- a/tests/Service/Messaging/Mqtt/ListEndpointsServiceTest.php +++ b/tests/Service/Messaging/Mqtt/ListEndpointsServiceTest.php @@ -95,7 +95,7 @@ protected static function cleanupQueues(bool $cleanupQueues): void $logger = $loggerBuilder->withTestConsoleDefaultValues("TestClassSetup")->build(); $counter = 0; while ($cleanupQueues) { - $cleanupQueues = SleepTimer::letTheAgrirouterProcessTheMqttMessage(2, mqttClient: self::$mqttClient); + $cleanupQueues = SleepTimer::letTheAgrirouterProcessTheMqttMessage(2, self::$mqttClient); if ($cleanupQueues) $counter++; } $logger->info("Cleaned mqtt queue, removed " . $counter . " messages."); @@ -164,7 +164,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $listEndpointsService->send($listEndpointsParameters); - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); if ($callbackException !== null) { throw($callbackException); } @@ -220,7 +220,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $listEndpointsParameters->setFiltered(true); $listEndpointsService->send($listEndpointsParameters); - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); if ($callbackException !== null) { throw($callbackException); } diff --git a/tests/Service/Messaging/Mqtt/QueryHeadersServiceTest.php b/tests/Service/Messaging/Mqtt/QueryHeadersServiceTest.php index 97a77dd..852dd08 100644 --- a/tests/Service/Messaging/Mqtt/QueryHeadersServiceTest.php +++ b/tests/Service/Messaging/Mqtt/QueryHeadersServiceTest.php @@ -106,7 +106,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $queryHeadersParameters->setOnboardResponse(self::$onboardResponse); $queryHeadersService->send($queryHeadersParameters); - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); if ($callbackException !== null) { throw($callbackException); } @@ -153,7 +153,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $queryHeadersParameters->setMessageIds([UuidService::newUuid()]); $queryHeadersService->send($queryHeadersParameters); - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); if ($callbackException !== null) { throw($callbackException); } @@ -200,7 +200,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $queryHeadersParameters->setSenders([UuidService::newUuid()]); $queryHeadersService->send($queryHeadersParameters); - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); if ($callbackException !== null) { throw($callbackException); } @@ -252,7 +252,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $queryHeadersParameters->setValidityPeriod($validityPeriod); $queryHeadersService->send($queryHeadersParameters); - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); if ($callbackException !== null) { throw($callbackException); } diff --git a/tests/Service/Messaging/Mqtt/QueryMessagesServiceTest.php b/tests/Service/Messaging/Mqtt/QueryMessagesServiceTest.php index be9124c..033527f 100644 --- a/tests/Service/Messaging/Mqtt/QueryMessagesServiceTest.php +++ b/tests/Service/Messaging/Mqtt/QueryMessagesServiceTest.php @@ -106,7 +106,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $queryMessagesParameters->setOnboardResponse(self::$onboardResponse); $queryHeadersService->send($queryMessagesParameters); - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); if ($callbackException !== null) { throw($callbackException); } @@ -153,7 +153,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $queryMessagesParameters->setMessageIds([UuidService::newUuid()]); $queryHeadersService->send($queryMessagesParameters); - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); if ($callbackException !== null) { throw($callbackException); } @@ -200,7 +200,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $queryMessagesParameters->setSenders([UuidService::newUuid()]); $queryHeadersService->send($queryMessagesParameters); - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); if ($callbackException !== null) { throw($callbackException); } @@ -252,7 +252,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $queryMessagesParameters->setValidityPeriod($validityPeriod); $queryHeadersService->send($queryMessagesParameters); - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); if ($callbackException !== null) { throw($callbackException); } diff --git a/tests/Service/Messaging/Mqtt/SubscriptionServiceTest.php b/tests/Service/Messaging/Mqtt/SubscriptionServiceTest.php index 89217d9..2241036 100644 --- a/tests/Service/Messaging/Mqtt/SubscriptionServiceTest.php +++ b/tests/Service/Messaging/Mqtt/SubscriptionServiceTest.php @@ -84,7 +84,7 @@ protected static function cleanupQueues(bool $cleanupQueues): void $logger = $loggerBuilder->withTestConsoleDefaultValues("TestClassSetup")->build(); $counter = 0; while ($cleanupQueues) { - $cleanupQueues = SleepTimer::letTheAgrirouterProcessTheMqttMessage(2, mqttClient: self::$mqttClient); + $cleanupQueues = SleepTimer::letTheAgrirouterProcessTheMqttMessage(2, self::$mqttClient); if ($cleanupQueues) $counter++; } $logger->info("Cleaned mqtt queue, removed " . $counter . " messages."); @@ -156,7 +156,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $subscriptionParameters->setSubscriptionItems($subscriptionItems); $subscriptionService->send($subscriptionParameters); - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); if ($callbackException !== null) { throw($callbackException); } @@ -202,7 +202,7 @@ function (string $topic, string $message) use (&$mqttClient, &$logger, &$callbac $subscriptionParameters->setSubscriptionItems($subscriptionItems); $subscriptionService->send($subscriptionParameters); - self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(mqttClient: self::$mqttClient)); + self::assertTrue(SleepTimer::letTheAgrirouterProcessTheMqttMessage(3, self::$mqttClient)); if ($callbackException !== null) { throw($callbackException); } diff --git a/tests/Service/Onboard/AuthorizationServiceTest.php b/tests/Service/Onboard/AuthorizationServiceTest.php index 1745cb8..ff7a536 100644 --- a/tests/Service/Onboard/AuthorizationServiceTest.php +++ b/tests/Service/Onboard/AuthorizationServiceTest.php @@ -3,6 +3,7 @@ namespace Lib\Tests\Service\Onboard { use App\Api\Exceptions\DecodeMessageException; + use App\Service\Common\SignatureService; use App\Service\Onboard\AuthorizationService; use Lib\Tests\Service\AbstractIntegrationTestForServices; @@ -107,5 +108,28 @@ public function testGivenDeclineConnectionResponseWhenParsingTheTokenThenTheAuth $this->assertNull($authorizationResult->getSignature()); $this->assertNotNull($authorizationResult->getError()); } + + public function testGivenValidResponseWhenParsingTheResultThenTheSignatureVerificationShouldBeOk() + { + $input = "state=6eab2086-0ef2-4b64-94b0-2ce620e66ece&token=eyJhY2NvdW50IjoiNWQ0N2E1MzctOTQ1NS00MTBkLWFhNmQtZmJkNjlhNWNmOTkwIiwicmVnY29kZSI6IjI2NGQwNjgzYzkiLCJleHBpcmVzIjoiMjAyMC0wMS0xNFQxMDowOTo1OS4zMTlaIn0%3D&signature=AJOFQmO4Y%2FT8DlNOcTAfpymMFiZQBpJHr4%2FUOfrHuGpzst6UA4kQraJYJtUEKSeEaQ%2FHCf4rJlUcK14ygyGAUtGkca1Y1sUAC1lVggVnECFMnVQAyTQzSnd1DEXjqI8n4Ud4LujSF6oSbiK0DWg1U8U9swwAEQ73Z0SDna7M3OEirY8zPUhGFcRij%2FrJOEFujq2rW%2Bs267z1pnp6FNq%2BoK5nbPBuH0hvCZ57Fz3HI1VadyE77o6rOAZ1HXniGqCGr%2F6v4TqAQ22MY9xhMAfUihtwQ3VLtdHsGSu1OH%2Fs71IQczOzBgeIlMAl4mchRo3l16qSU4k4awufLq7LzDSf5Q%3D%3D"; + $authorizationService = new AuthorizationService($this->getEnvironment()); + $authResult = $authorizationService->parseAuthorizationResult($input); + $agrirouterPublicKey = "-----BEGIN PUBLIC KEY-----\n". + "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy8xF9661acn+iS+QS+9Y\n". + "3HvTfUVcismzbuvxHgHA7YeoOUFxyj3lkaTnXm7hzQe4wDEDgwpJSGAzxIIYSUXe\n". + "8EsWLorg5O0tRexx5SP3+kj1i83DATBJCXP7k+bAF4u2FVJphC1m2BfLxelGLjzx\n". + "VAS/v6+EwvYaT1AI9FFqW/a2o92IsVPOh9oM9eds3lBOAbH/8XrmVIeHofw+XbTH\n". + "1/7MLD6IE2+HbEeY0F96nioXArdQWXcjUQsTch+p0p9eqh23Ak4ef5oGcZhNd4yp\n". + "Y8M6ppvIMiXkgWSPJevCJjhxRJRmndY+ajYGx7CLePx7wNvxXWtkng3yh+7WiZ/Y\n". + "qwIDAQAB\n". + "-----END PUBLIC KEY-----"; + + $sigVerifyResult = SignatureService::verifySignature( + urldecode($authResult->getState()).urldecode($authResult->getToken()), + base64_decode(urldecode($authResult->getSignature())), + $agrirouterPublicKey + ); + $this->assertTrue($sigVerifyResult); + } } } \ No newline at end of file