diff --git a/.mailmap b/.mailmap index 18c3e2b..65af5a4 100644 --- a/.mailmap +++ b/.mailmap @@ -1 +1,2 @@ CodeDredd Gregor Becker +CodeDredd Gregor Becker diff --git a/composer.json b/composer.json index 6825e7d..cf51806 100644 --- a/composer.json +++ b/composer.json @@ -21,13 +21,14 @@ "php-http/discovery": "^1.7", "php-http/message": "^1.8", "php-http/client-common": "^2.1", - "robrichards/wse-php": "^2.0" + "robrichards/wse-php": "^2.0", + "wsdl2phpgenerator/wsdl2phpgenerator": "^3.4" }, "require-dev": { "symfony/var-dumper": "^5.0", "phpunit/phpunit": "^9.1", - "mockery/mockery": "^1.3", - "orchestra/testbench": "^5.1" + "orchestra/testbench": "^5.1", + "laminas/laminas-code": "^3.4" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 0f6b041..c6853d0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9257626529083d40232805d69d34add7", + "content-hash": "80c57dffe4476671d9145a5827161ed5", "packages": [ { "name": "brick/math", @@ -536,16 +536,16 @@ }, { "name": "laravel/framework", - "version": "v7.7.1", + "version": "v7.9.2", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "4de129177f889cd7672e732d8808020adfb7b121" + "reference": "757b155658ae6da429065ba8f22242fe599824f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/4de129177f889cd7672e732d8808020adfb7b121", - "reference": "4de129177f889cd7672e732d8808020adfb7b121", + "url": "https://api.github.com/repos/laravel/framework/zipball/757b155658ae6da429065ba8f22242fe599824f7", + "reference": "757b155658ae6da429065ba8f22242fe599824f7", "shasum": "" }, "require": { @@ -684,20 +684,20 @@ "framework", "laravel" ], - "time": "2020-04-21T18:57:12+00:00" + "time": "2020-04-28T16:09:20+00:00" }, { "name": "league/commonmark", - "version": "1.4.1", + "version": "1.4.2", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "c995966d35424bae20f76f8b31248099487a3f57" + "reference": "9e780d972185e4f737a03bade0fd34a9e67bbf31" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/c995966d35424bae20f76f8b31248099487a3f57", - "reference": "c995966d35424bae20f76f8b31248099487a3f57", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/9e780d972185e4f737a03bade0fd34a9e67bbf31", + "reference": "9e780d972185e4f737a03bade0fd34a9e67bbf31", "shasum": "" }, "require": { @@ -758,7 +758,7 @@ "md", "parser" ], - "time": "2020-04-20T13:36:51+00:00" + "time": "2020-04-24T13:39:56+00:00" }, { "name": "league/flysystem", @@ -927,21 +927,22 @@ }, { "name": "nesbot/carbon", - "version": "2.32.2", + "version": "2.33.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "f10e22cf546704fab1db4ad4b9dedbc5c797a0dc" + "reference": "4d93cb95a80d9ffbff4018fe58ae3b7dd7f4b99b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/f10e22cf546704fab1db4ad4b9dedbc5c797a0dc", - "reference": "f10e22cf546704fab1db4ad4b9dedbc5c797a0dc", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/4d93cb95a80d9ffbff4018fe58ae3b7dd7f4b99b", + "reference": "4d93cb95a80d9ffbff4018fe58ae3b7dd7f4b99b", "shasum": "" }, "require": { "ext-json": "*", "php": "^7.1.8 || ^8.0", + "symfony/polyfill-mbstring": "^1.0", "symfony/translation": "^3.4 || ^4.0 || ^5.0" }, "require-dev": { @@ -994,7 +995,7 @@ "datetime", "time" ], - "time": "2020-03-31T13:43:19+00:00" + "time": "2020-04-20T15:05:43+00:00" }, { "name": "opis/closure", @@ -2142,16 +2143,16 @@ }, { "name": "robrichards/xmlseclibs", - "version": "3.0.4", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/robrichards/xmlseclibs.git", - "reference": "0a53d3c3aa87564910cae4ed01416441d3ae0db5" + "reference": "8d8e56ca7914440a8c60caff1a865e7dff1d9a5a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/robrichards/xmlseclibs/zipball/0a53d3c3aa87564910cae4ed01416441d3ae0db5", - "reference": "0a53d3c3aa87564910cae4ed01416441d3ae0db5", + "url": "https://api.github.com/repos/robrichards/xmlseclibs/zipball/8d8e56ca7914440a8c60caff1a865e7dff1d9a5a", + "reference": "8d8e56ca7914440a8c60caff1a865e7dff1d9a5a", "shasum": "" }, "require": { @@ -2176,7 +2177,7 @@ "xml", "xmldsig" ], - "time": "2019-11-05T11:44:22+00:00" + "time": "2020-04-22T17:19:51+00:00" }, { "name": "swiftmailer/swiftmailer", @@ -2242,7 +2243,7 @@ }, { "name": "symfony/console", - "version": "v5.0.7", + "version": "v5.0.8", "source": { "type": "git", "url": "https://github.com/symfony/console.git", @@ -2318,7 +2319,7 @@ }, { "name": "symfony/css-selector", - "version": "v5.0.7", + "version": "v5.0.8", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", @@ -2371,7 +2372,7 @@ }, { "name": "symfony/error-handler", - "version": "v5.0.7", + "version": "v5.0.8", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", @@ -2426,7 +2427,7 @@ }, { "name": "symfony/event-dispatcher", - "version": "v5.0.7", + "version": "v5.0.8", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -2554,16 +2555,16 @@ }, { "name": "symfony/filesystem", - "version": "v5.0.7", + "version": "v5.0.8", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "ca3b87dd09fff9b771731637f5379965fbfab420" + "reference": "7cd0dafc4353a0f62e307df90b48466379c8cc91" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/ca3b87dd09fff9b771731637f5379965fbfab420", - "reference": "ca3b87dd09fff9b771731637f5379965fbfab420", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/7cd0dafc4353a0f62e307df90b48466379c8cc91", + "reference": "7cd0dafc4353a0f62e307df90b48466379c8cc91", "shasum": "" }, "require": { @@ -2600,11 +2601,11 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2020-03-27T16:56:45+00:00" + "time": "2020-04-12T14:40:17+00:00" }, { "name": "symfony/finder", - "version": "v5.0.7", + "version": "v5.0.8", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -2653,16 +2654,16 @@ }, { "name": "symfony/http-foundation", - "version": "v5.0.7", + "version": "v5.0.8", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "26fb006a2c7b6cdd23d52157b05f8414ffa417b6" + "reference": "e47fdf8b24edc12022ba52923150ec6484d7f57d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/26fb006a2c7b6cdd23d52157b05f8414ffa417b6", - "reference": "26fb006a2c7b6cdd23d52157b05f8414ffa417b6", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/e47fdf8b24edc12022ba52923150ec6484d7f57d", + "reference": "e47fdf8b24edc12022ba52923150ec6484d7f57d", "shasum": "" }, "require": { @@ -2704,20 +2705,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2020-03-30T14:14:32+00:00" + "time": "2020-04-18T20:50:06+00:00" }, { "name": "symfony/http-kernel", - "version": "v5.0.7", + "version": "v5.0.8", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "ad574c55d451127cab1c45b4ac51bf283e340cf0" + "reference": "3565e51eecd06106304baba5ccb7ba89db2d7d2b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/ad574c55d451127cab1c45b4ac51bf283e340cf0", - "reference": "ad574c55d451127cab1c45b4ac51bf283e340cf0", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/3565e51eecd06106304baba5ccb7ba89db2d7d2b", + "reference": "3565e51eecd06106304baba5ccb7ba89db2d7d2b", "shasum": "" }, "require": { @@ -2733,6 +2734,7 @@ "symfony/browser-kit": "<4.4", "symfony/cache": "<5.0", "symfony/config": "<5.0", + "symfony/console": "<4.4", "symfony/dependency-injection": "<4.4", "symfony/doctrine-bridge": "<5.0", "symfony/form": "<5.0", @@ -2800,20 +2802,20 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2020-03-30T15:04:59+00:00" + "time": "2020-04-28T18:53:25+00:00" }, { "name": "symfony/mime", - "version": "v5.0.7", + "version": "v5.0.8", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "481b7d6da88922fb1e0d86a943987722b08f3955" + "reference": "5d6c81c39225a750f3f43bee15f03093fb9aaa0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/481b7d6da88922fb1e0d86a943987722b08f3955", - "reference": "481b7d6da88922fb1e0d86a943987722b08f3955", + "url": "https://api.github.com/repos/symfony/mime/zipball/5d6c81c39225a750f3f43bee15f03093fb9aaa0b", + "reference": "5d6c81c39225a750f3f43bee15f03093fb9aaa0b", "shasum": "" }, "require": { @@ -2862,29 +2864,29 @@ "mime", "mime-type" ], - "time": "2020-03-27T16:56:45+00:00" + "time": "2020-04-17T03:29:44+00:00" }, { "name": "symfony/options-resolver", - "version": "v5.0.7", + "version": "v3.4.40", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "09dccfffd24b311df7f184aa80ee7b61ad61ed8d" + "reference": "79701529391f802604ec92080364d617f029974b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/09dccfffd24b311df7f184aa80ee7b61ad61ed8d", - "reference": "09dccfffd24b311df7f184aa80ee7b61ad61ed8d", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/79701529391f802604ec92080364d617f029974b", + "reference": "79701529391f802604ec92080364d617f029974b", "shasum": "" }, "require": { - "php": "^7.2.5" + "php": "^5.5.9|>=7.0.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -2916,7 +2918,7 @@ "configuration", "options" ], - "time": "2020-03-27T16:56:45+00:00" + "time": "2020-04-06T08:30:32+00:00" }, { "name": "symfony/polyfill-ctype", @@ -3271,16 +3273,16 @@ }, { "name": "symfony/process", - "version": "v5.0.7", + "version": "v5.0.8", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "c5ca4a0fc16a0c888067d43fbcfe1f8a53d8e70e" + "reference": "3179f68dff5bad14d38c4114a1dab98030801fd7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/c5ca4a0fc16a0c888067d43fbcfe1f8a53d8e70e", - "reference": "c5ca4a0fc16a0c888067d43fbcfe1f8a53d8e70e", + "url": "https://api.github.com/repos/symfony/process/zipball/3179f68dff5bad14d38c4114a1dab98030801fd7", + "reference": "3179f68dff5bad14d38c4114a1dab98030801fd7", "shasum": "" }, "require": { @@ -3316,20 +3318,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2020-03-27T16:56:45+00:00" + "time": "2020-04-15T15:59:10+00:00" }, { "name": "symfony/routing", - "version": "v5.0.7", + "version": "v5.0.8", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "d98a95d0a684caba47a47c1c50c602a669dc973b" + "reference": "9b18480a6e101f8d9ab7c483ace7c19441be5111" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/d98a95d0a684caba47a47c1c50c602a669dc973b", - "reference": "d98a95d0a684caba47a47c1c50c602a669dc973b", + "url": "https://api.github.com/repos/symfony/routing/zipball/9b18480a6e101f8d9ab7c483ace7c19441be5111", + "reference": "9b18480a6e101f8d9ab7c483ace7c19441be5111", "shasum": "" }, "require": { @@ -3392,7 +3394,7 @@ "uri", "url" ], - "time": "2020-03-30T11:42:42+00:00" + "time": "2020-04-21T21:02:50+00:00" }, { "name": "symfony/service-contracts", @@ -3454,16 +3456,16 @@ }, { "name": "symfony/translation", - "version": "v5.0.7", + "version": "v5.0.8", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "99b831770e10807dca0979518e2c89edffef5978" + "reference": "c3879db7a68fe3e12b41263b05879412c87b27fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/99b831770e10807dca0979518e2c89edffef5978", - "reference": "99b831770e10807dca0979518e2c89edffef5978", + "url": "https://api.github.com/repos/symfony/translation/zipball/c3879db7a68fe3e12b41263b05879412c87b27fd", + "reference": "c3879db7a68fe3e12b41263b05879412c87b27fd", "shasum": "" }, "require": { @@ -3527,7 +3529,7 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2020-03-27T16:56:45+00:00" + "time": "2020-04-12T16:45:47+00:00" }, { "name": "symfony/translation-contracts", @@ -3588,16 +3590,16 @@ }, { "name": "symfony/var-dumper", - "version": "v5.0.7", + "version": "v5.0.8", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "f74a126acd701392eef2492a17228d42552c86b5" + "reference": "09de28632f16f81058a85fcf318397218272a07b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/f74a126acd701392eef2492a17228d42552c86b5", - "reference": "f74a126acd701392eef2492a17228d42552c86b5", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/09de28632f16f81058a85fcf318397218272a07b", + "reference": "09de28632f16f81058a85fcf318397218272a07b", "shasum": "" }, "require": { @@ -3659,7 +3661,7 @@ "debug", "dump" ], - "time": "2020-03-27T16:56:45+00:00" + "time": "2020-04-12T16:45:47+00:00" }, { "name": "tijsverkoyen/css-to-inline-styles", @@ -3822,6 +3824,55 @@ "php" ], "time": "2020-03-13T01:23:26+00:00" + }, + { + "name": "wsdl2phpgenerator/wsdl2phpgenerator", + "version": "3.4.0", + "source": { + "type": "git", + "url": "https://github.com/wsdl2phpgenerator/wsdl2phpgenerator.git", + "reference": "558c8a66677c117de2db5f5a4ae7f327c4b67f67" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wsdl2phpgenerator/wsdl2phpgenerator/zipball/558c8a66677c117de2db5f5a4ae7f327c4b67f67", + "reference": "558c8a66677c117de2db5f5a4ae7f327c4b67f67", + "shasum": "" + }, + "require": { + "ext-soap": "*", + "php": ">=5.3.0", + "symfony/options-resolver": "~2.6|~3.0", + "symfony/polyfill-iconv": "^1.2" + }, + "require-dev": { + "kasperg/phing-github": "0.2.*", + "phing/phing": "~2.7", + "php-vcr/php-vcr": "1.2 - 1.2.7|^1.3.1", + "php-vcr/phpunit-testlistener-vcr": "~1.1.2", + "phpunit/phpunit": "~4.4", + "psr/log": "~1.0", + "symfony/yaml": "~2.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Wsdl2PhpGenerator\\": [ + "src/", + "lib/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Simple class library for generating php classes from a wsdl file.", + "keywords": [ + "soap", + "wsdl" + ], + "time": "2016-10-30T21:02:36+00:00" } ], "packages-dev": [ @@ -3979,6 +4030,177 @@ ], "time": "2016-01-20T08:20:44+00:00" }, + { + "name": "laminas/laminas-code", + "version": "3.4.1", + "source": { + "type": "git", + "url": "https://github.com/laminas/laminas-code.git", + "reference": "1cb8f203389ab1482bf89c0e70a04849bacd7766" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laminas/laminas-code/zipball/1cb8f203389ab1482bf89c0e70a04849bacd7766", + "reference": "1cb8f203389ab1482bf89c0e70a04849bacd7766", + "shasum": "" + }, + "require": { + "laminas/laminas-eventmanager": "^2.6 || ^3.0", + "laminas/laminas-zendframework-bridge": "^1.0", + "php": "^7.1" + }, + "conflict": { + "phpspec/prophecy": "<1.9.0" + }, + "replace": { + "zendframework/zend-code": "self.version" + }, + "require-dev": { + "doctrine/annotations": "^1.7", + "ext-phar": "*", + "laminas/laminas-coding-standard": "^1.0", + "laminas/laminas-stdlib": "^2.7 || ^3.0", + "phpunit/phpunit": "^7.5.16 || ^8.4" + }, + "suggest": { + "doctrine/annotations": "Doctrine\\Common\\Annotations >=1.0 for annotation features", + "laminas/laminas-stdlib": "Laminas\\Stdlib component" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4.x-dev", + "dev-develop": "3.5.x-dev", + "dev-dev-4.0": "4.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Laminas\\Code\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Extensions to the PHP Reflection API, static code scanning, and code generation", + "homepage": "https://laminas.dev", + "keywords": [ + "code", + "laminas" + ], + "time": "2019-12-31T16:28:24+00:00" + }, + { + "name": "laminas/laminas-eventmanager", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/laminas/laminas-eventmanager.git", + "reference": "ce4dc0bdf3b14b7f9815775af9dfee80a63b4748" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laminas/laminas-eventmanager/zipball/ce4dc0bdf3b14b7f9815775af9dfee80a63b4748", + "reference": "ce4dc0bdf3b14b7f9815775af9dfee80a63b4748", + "shasum": "" + }, + "require": { + "laminas/laminas-zendframework-bridge": "^1.0", + "php": "^5.6 || ^7.0" + }, + "replace": { + "zendframework/zend-eventmanager": "self.version" + }, + "require-dev": { + "athletic/athletic": "^0.1", + "container-interop/container-interop": "^1.1.0", + "laminas/laminas-coding-standard": "~1.0.0", + "laminas/laminas-stdlib": "^2.7.3 || ^3.0", + "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2" + }, + "suggest": { + "container-interop/container-interop": "^1.1.0, to use the lazy listeners feature", + "laminas/laminas-stdlib": "^2.7.3 || ^3.0, to use the FilterChain feature" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev", + "dev-develop": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Laminas\\EventManager\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Trigger and listen to events within a PHP application", + "homepage": "https://laminas.dev", + "keywords": [ + "event", + "eventmanager", + "events", + "laminas" + ], + "time": "2019-12-31T16:44:52+00:00" + }, + { + "name": "laminas/laminas-zendframework-bridge", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/laminas/laminas-zendframework-bridge.git", + "reference": "bfbbdb6c998d50dbf69d2187cb78a5f1fa36e1e9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laminas/laminas-zendframework-bridge/zipball/bfbbdb6c998d50dbf69d2187cb78a5f1fa36e1e9", + "reference": "bfbbdb6c998d50dbf69d2187cb78a5f1fa36e1e9", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.1", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev", + "dev-develop": "1.1.x-dev" + }, + "laminas": { + "module": "Laminas\\ZendFrameworkBridge" + } + }, + "autoload": { + "files": [ + "src/autoload.php" + ], + "psr-4": { + "Laminas\\ZendFrameworkBridge\\": "src//" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Alias legacy ZF class names to Laminas Project equivalents.", + "keywords": [ + "ZendFramework", + "autoloading", + "laminas", + "zf" + ], + "time": "2020-04-03T16:01:00+00:00" + }, { "name": "mockery/mockery", "version": "1.3.1", @@ -4094,16 +4316,16 @@ }, { "name": "orchestra/testbench", - "version": "v5.1.0", + "version": "v5.2.0", "source": { "type": "git", "url": "https://github.com/orchestral/testbench.git", - "reference": "e36bdb5fc599495f46a8b2fd3a5e6ffed044e095" + "reference": "e2e493e8fdb043cdb4ab97560b4ce53d21313c40" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/orchestral/testbench/zipball/e36bdb5fc599495f46a8b2fd3a5e6ffed044e095", - "reference": "e36bdb5fc599495f46a8b2fd3a5e6ffed044e095", + "url": "https://api.github.com/repos/orchestral/testbench/zipball/e2e493e8fdb043cdb4ab97560b4ce53d21313c40", + "reference": "e2e493e8fdb043cdb4ab97560b4ce53d21313c40", "shasum": "" }, "require": { @@ -4140,7 +4362,7 @@ "orchestral", "testing" ], - "time": "2020-03-10T17:14:11+00:00" + "time": "2020-04-28T01:11:20+00:00" }, { "name": "orchestra/testbench-core", @@ -4312,24 +4534,21 @@ }, { "name": "phpdocumentor/reflection-common", - "version": "2.0.0", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a" + "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a", - "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/6568f4687e5b41b054365f9ae03fcb1ed5f2069b", + "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b", "shasum": "" }, "require": { "php": ">=7.1" }, - "require-dev": { - "phpunit/phpunit": "~6" - }, "type": "library", "extra": { "branch-alias": { @@ -4360,7 +4579,7 @@ "reflection", "static analysis" ], - "time": "2018-08-07T13:53:10+00:00" + "time": "2020-04-27T09:25:28+00:00" }, { "name": "phpdocumentor/reflection-docblock", @@ -4837,16 +5056,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.1.2", + "version": "9.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "d99d4e69c98c18d5c5f033c68c623880536f37be" + "reference": "2d7080c622cf7884992e7c3cf87853877bae8ff4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d99d4e69c98c18d5c5f033c68c623880536f37be", - "reference": "d99d4e69c98c18d5c5f033c68c623880536f37be", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2d7080c622cf7884992e7c3cf87853877bae8ff4", + "reference": "2d7080c622cf7884992e7c3cf87853877bae8ff4", "shasum": "" }, "require": { @@ -4867,7 +5086,7 @@ "phpunit/php-invoker": "^3.0", "phpunit/php-text-template": "^2.0", "phpunit/php-timer": "^3.1.4", - "sebastian/code-unit": "^1.0", + "sebastian/code-unit": "^1.0.2", "sebastian/comparator": "^4.0", "sebastian/diff": "^4.0", "sebastian/environment": "^5.0.1", @@ -4921,20 +5140,20 @@ "testing", "xunit" ], - "time": "2020-04-20T06:24:01+00:00" + "time": "2020-04-30T06:32:53+00:00" }, { "name": "sebastian/code-unit", - "version": "1.0.0", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "8d8f09bd47c75159921e6e84fdef146343962866" + "reference": "ac958085bc19fcd1d36425c781ef4cbb5b06e2a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/8d8f09bd47c75159921e6e84fdef146343962866", - "reference": "8d8f09bd47c75159921e6e84fdef146343962866", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/ac958085bc19fcd1d36425c781ef4cbb5b06e2a5", + "reference": "ac958085bc19fcd1d36425c781ef4cbb5b06e2a5", "shasum": "" }, "require": { @@ -4967,7 +5186,7 @@ ], "description": "Collection of value objects that represent the PHP code units", "homepage": "https://github.com/sebastianbergmann/code-unit", - "time": "2020-03-30T11:59:20+00:00" + "time": "2020-04-30T05:58:10+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", diff --git a/config/soap.php b/config/soap.php index 530893d..b522bb8 100644 --- a/config/soap.php +++ b/config/soap.php @@ -3,6 +3,18 @@ use RobRichards\XMLSecLibs\XMLSecurityKey; return [ + /* + |-------------------------------------------------------------------------- + | SOAP Code Generation directory + |-------------------------------------------------------------------------- + | + | Define the destination for the code generator under the app directory + */ + + 'code' => [ + 'path' => app_path('Soap'), + 'namespace' => 'App\\Soap', + ], /* |-------------------------------------------------------------------------- diff --git a/docs/commands/make-client.md b/docs/commands/make-client.md new file mode 100644 index 0000000..caf0066 --- /dev/null +++ b/docs/commands/make-client.md @@ -0,0 +1,13 @@ +# Make Client + +## Command + +````bash +php artisan soap:make:client +```` + +## Options + +### --dry-run + +Returns all code in console instead of saving in a file diff --git a/docs/commands/make-validation.md b/docs/commands/make-validation.md new file mode 100644 index 0000000..cc9e3da --- /dev/null +++ b/docs/commands/make-validation.md @@ -0,0 +1,13 @@ +# Make Validation + +## Command + +````bash +php artisan soap:make:validation +```` + +## Options + +### --dry-run + +Returns all code in console instead of saving in a file diff --git a/docs/commands/overview.md b/docs/commands/overview.md new file mode 100644 index 0000000..114fd92 --- /dev/null +++ b/docs/commands/overview.md @@ -0,0 +1,27 @@ +# Overview of Commands + +## Requirements + +You need to install following package to use the code generation feature + +````bash +composer require --dev laminas/laminas-code +```` + +Here is a list of all available soap commands. + +## Commands + +Command | Description +-------------------------------------------------------- | ------------- +[`php artisan soap:make:client`](make-client.md) | Create a customized client by wsdl or config name +[`php artisan soap:make:validation`](make-validation.md) | Create one or all validation classes by wsdl or config name + +## Configuration + +If you have published the configuration file then you have some options for the code generation. + +Config | Default | Description +------------------ | ------------------ | ----------- +``code.path`` | `app_path('Soap')` | Define where the generated Code should be saved in your project +``code.namespace`` | `App\\Soap` | Define the namespace of the generated Code diff --git a/mkdocs.yml b/mkdocs.yml index 2cf02d9..b0c3fa3 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -5,6 +5,10 @@ docs_dir: docs/ repo_name: 'codedredd/laravel-soap' repo_url: 'https://github.com/codedredd/laravel-soap' nav: - - Home: index.md + - Introduction: 'index.md' + - Commands: + - Overview: 'commands/overview.md' + - 'Make Client': 'commands/make-client.md' + - 'Make Validation': 'commands/make-validation.md' theme: name: 'material' diff --git a/src/Client/Response.php b/src/Client/Response.php index 6ce58c9..f34033c 100644 --- a/src/Client/Response.php +++ b/src/Client/Response.php @@ -47,11 +47,12 @@ public function __construct($response) /** * @param $result + * @param int $status * @return Response */ - public static function fromSoapResponse($result) + public static function fromSoapResponse($result, $status = 200) { - return new self(new Psr7Response(200, [], json_encode($result))); + return new self(new Psr7Response($status, [], json_encode($result))); } /** diff --git a/src/Code/Base.php b/src/Code/Base.php new file mode 100644 index 0000000..bfb27f5 --- /dev/null +++ b/src/Code/Base.php @@ -0,0 +1,88 @@ +actions = collect($engine->getOperations()); + $this->types = collect($engine->getTypes()); + $this->configName = $configName; + $this->clientClassName = ucfirst(Str::camel($configName)); + $this->destination = config('soap.code.path', 'Soap'); + $this->codeNamespace = config('soap.code.namespace'); + } + + /** + * @return string + */ + public function getCode() + { + return $this->codeClass->generate(); + } + + /** + * @param $filePath + */ + public function saveFile($filePath) + { + $file = config('soap.code.path', app_path('Soap')).$filePath; + if (! file_exists($file)) { + $fileCode = FileGenerator::fromArray([ + 'classes' => [$this->codeClass], + ]); + mkdir(dirname($file), 0777, true); + file_put_contents($file, $fileCode->generate()); + } + } +} diff --git a/src/Code/Client.php b/src/Code/Client.php new file mode 100644 index 0000000..ed614fc --- /dev/null +++ b/src/Code/Client.php @@ -0,0 +1,144 @@ +codeClass = new ClassGenerator(); + $this->clientContract = new ClientContract($engine, $configName); + $this->createNewClient(); + } + + /** + * @return ClassGenerator + */ + public function createNewClient() + { + $this->clientContract->createNewClientContract(); + $className = ucfirst(Str::camel($this->configName).'Client'); + $methodTags = $this->actions->map(function (Operation $action) { + $params = $action->getParams() > 0 ? '($body = [])' : '()'; + + return new GenericTag( + 'method', + 'CodeDredd\\Soap\\Client\\Response '.$action->getName().$params + ); + })->values()->toArray(); + $docBlock = DocBlockGenerator::fromArray([ + 'shortDescription' => $this->clientClassName.' Client', + 'tags' => $methodTags, + ]); + $constructorDocBlock = DocBlockGenerator::fromArray([ + 'shortDescription' => $className.' constructor', + ]); + $callDocBlock = DocBlockGenerator::fromArray([ + 'shortDescription' => 'Execute soap call', + 'tags' => [ + new ParamTag('method', 'string'), + new ParamTag('parameters', 'mixed'), + new ReturnTag('\CodeDredd\Soap\Client\Response|mixed'), + ], + ]); + $callMethodParameters = [ + 'method', + 'parameters', + ]; + $callMethodBody = 'if (static::hasMacro($method)) {'."\n " + .'return $this->macroCall($method, $parameters);'."\n" + .'}'."\n\n" + .'$validationClass = \'CodeDredd\\\\Soap\\\\Soap\\\\Validations\\\\LaravelSoap\\\\\''."\n " + .'. ucfirst(Str::camel($method))'."\n " + .'. \'Validation\';'."\n" + .'if (class_exists($validationClass)) {'."\n " + .'$parameters = app()->call([$validationClass, \'validator\'], [\'parameters\' => $parameters]);'."\n" + .'}'."\n\n" + .'return $this->client->call($method, $parameters);'; + + $this->codeClass->setName($className) + ->setDocBlock($docBlock) + ->setNamespaceName($this->codeNamespace.'\\Clients') + ->setImplementedInterfaces([$this->codeNamespace.'\\Contracts\\'.$this->clientClassName.'Contract']) + ->addProperty('client', null, PropertyGenerator::FLAG_PROTECTED) + ->addUse(Soap::class) + ->addUse(Macroable::class) + ->addTrait('Macroable') + ->addTraitAlias('Macroable::__call', 'macroCall') + ->addMethods([ + new MethodGenerator('__construct', [], MethodGenerator::FLAG_PUBLIC, + '$this->client = Soap::buildClient(\''.$this->configName.'\');', $constructorDocBlock), + new MethodGenerator('__call', $callMethodParameters, MethodGenerator::FLAG_PUBLIC, $callMethodBody, + $callDocBlock), + ]); + + return $this->codeClass; + } + + /** + * @param Operation $action + * @return MethodGenerator + */ + public static function createNewAction(Operation $action) + { + $validationClass = ucfirst(Str::camel($action->getName()).'Validation'); + $actionBody = 'return $this->client->call(\''.$action->getName() + .'\', '.$validationClass.'::validator($body));'; + + return new MethodGenerator( + $action->getName(), + empty($action->getParams()) ? [] : [ + [ + 'name' => 'body', + 'defaultValue' => [], + ], + ], + MethodGenerator::FLAG_PUBLIC, + $actionBody, + DocBlockGenerator::fromArray([ + 'shortDescription' => 'Call action '.$action->getName(), + 'tags' => [ + new ParamTag('body', 'array'), + new ReturnTag('\CodeDredd\Soap\Client\Response'), + ], + ]) + ); + } + + /** + * Save generated code as file. + */ + public function save() + { + $this->clientContract->save(); + $this->saveFile('/Clients/'.$this->clientClassName.'Client.php'); + } +} diff --git a/src/Code/ClientContract.php b/src/Code/ClientContract.php new file mode 100644 index 0000000..7235e17 --- /dev/null +++ b/src/Code/ClientContract.php @@ -0,0 +1,59 @@ +codeClass = new InterfaceGenerator(); + parent::__construct($engine, $configName); + } + + /** + * @return InterfaceGenerator + */ + public function createNewClientContract() + { + $className = ucfirst(Str::camel($this->configName).'Contract'); + $methodTags = $this->actions->map(function (Operation $action) { + $params = $action->getParams() > 0 ? '($body = []) ' : '() '; + + return new GenericTag( + 'method', + 'CodeDredd\\Soap\\Client\\Response '.$action->getName().$params.$action->getDescription() + ); + })->values()->toArray(); + $docBlock = DocBlockGenerator::fromArray([ + 'shortDescription' => $this->clientClassName.' Contract', + 'tags' => $methodTags, + ]); + + return $this->codeClass->setName($className) + ->setDocBlock($docBlock); + } + + /** + * Save generated code as file. + */ + public function save() + { + $this->saveFile('/Contracts/'.$this->clientClassName.'Contract.php'); + } +} diff --git a/src/Code/Validation.php b/src/Code/Validation.php new file mode 100644 index 0000000..6322c6a --- /dev/null +++ b/src/Code/Validation.php @@ -0,0 +1,173 @@ +codeClass = new ClassGenerator(); + $this->dryRun = $dryRun; + parent::__construct($engine, $configName); + } + + /** + * @param Operation $action + * @return ClassGenerator + */ + public function createNewValidation(Operation $action) + { + $this->actionName = $action->getName(); + $className = ucfirst(Str::camel($action->getName()).'Validation'); + $validationArray = []; + if (count($action->getParams()) > 0) { + foreach ($action->getParams() as $key => $param) { + $type = $this->types->get($param); + $validationForParam = []; + if ($type instanceof ComplexType) { + $validationForParam = $this->generateValidationArrayByAction($type->getMembers(), $validationForParam); + } + Arr::forget($validationForParam, '*'); + $validationArray[] = $validationForParam; + } + $validationArray = Arr::dot($validationArray); + } + $validatorFlags = [MethodGenerator::FLAG_PUBLIC, MethodGenerator::FLAG_STATIC]; + $validatorBody = 'return Validator::make($parameters, ['."\n" + .$this->arrayToStringCode($validationArray) + .']);'; + $docBlock = DocBlockGenerator::fromArray([ + 'shortDescription' => $this->actionName.' Validation', + 'longDescription' => $action->getDescription(), + ]); + $this->codeClass->setName($className) + ->setNamespaceName($this->codeNamespace.'\\Validations\\'.$this->clientClassName) + ->setDocBlock($docBlock) + ->addUse(Validator::class) + ->addMethod('validator', ['parameters'], $validatorFlags, $validatorBody); + + return $this->codeClass; + } + + /** + * @param array $actionNames + */ + public function generateValidationFiles(array $actionNames = []) + { + foreach ($actionNames as $actionName) { + $action = $this->actions->get($actionName); + if (! empty($action)) { + $this->codeClass = $this->createNewValidation($action); + $this->dryRun ? print_r($this->getCode()) : $this->save(); + } + } + } + + /** + * @param array $array + * @return string + */ + protected function arrayToStringCode(array $array) + { + $stringCode = ''; + foreach ($array as $key => $value) { + if (! empty($value)) { + $stringCode .= " '".$key.'\' => \''.$value."',\n"; + } + } + + return $stringCode; + } + + /** + * @param array $properties# + * @param array $validationArray + * @return array + */ + public function generateValidationArrayByAction(array $properties, $validationArray = []) + { + foreach ($properties as $property) { + /** @var Variable $property */ + $propertyType = $this->types->get(Str::before($property->getType(), '[]')); + if ($propertyType instanceof ComplexType) { + $validationArray['*'] = 'filled'; + $validationArray[$property->getName()] = $this->generateValidationArrayByAction($propertyType->getMembers()); + } elseif ($propertyType instanceof Enum) { + $validationArray[$property->getName()] = 'in:'.$propertyType->getValidValues(); + } else { + $validationArray[$property->getName()] = $this->mapToValidType($property->getType()).($property->getNullable() ? '|nullable' : ''); + } + } + + return $validationArray; + } + + /** + * @param $type + * @return string + */ + public function mapToValidType($type) + { + switch ($type) { + case 'datetime': return 'date_format:Y-m-d H:i:s'; + case 'date': return 'date'; + case 'bool': + case 'boolean': return 'boolean'; + case 'int': + case 'Count': + case 'Page': + case 'integer': return 'integer'; + default: return 'string'; + } + } + + /** + * @return string + */ + public function getCode() + { + return $this->codeClass->generate(); + } + + /** + * Save generated code as file. + */ + public function save() + { + $this->saveFile( + '/Validations/'.$this->clientClassName.'/' + .ucfirst(Str::camel($this->actionName).'Validation.php') + ); + } +} diff --git a/src/Commands/MakeClientCommand.php b/src/Commands/MakeClientCommand.php new file mode 100644 index 0000000..1273b9e --- /dev/null +++ b/src/Commands/MakeClientCommand.php @@ -0,0 +1,83 @@ +getWsdlAndConfigName(); + $service = $this->getGeneratorService($wsdl); + + $client = new Client($service, $configName); + if ($this->option('dry-run')) { + echo $client->getCode(); + } else { + $client->save(); + } + } + + public function getGeneratorService($wsdl, Command $commandInstance = null) + { + $commandInstance = $commandInstance ?? $this; + $commandInstance->line('Loading wsdl configuration ...'); + $generator = new Generator(); + $generator->setConfigByWsdl($wsdl, $this->output); + + return $generator->getService(); + } + + public function getWsdlAndConfigName(Command $commandInstance = null) + { + $commandInstance = $commandInstance ?? $this; + $clients = config('soap.clients'); + $clientNames = []; + + if (! empty($clients)) { + $clientNames = array_keys($clients); + } + $wsdl = $commandInstance->anticipate('Please type the wsdl or the name of your client configuration if u have defined one in the config "soap.php"', $clientNames); + if (! Str::contains($wsdl, ['http:', 'https:'])) { + $configName = $wsdl; + $wsdl = config()->get('soap.clients.'.$wsdl.'.base_wsdl'); + } else { + $configName = $commandInstance->ask('Please give a name under which the code will be generated. E.g. "laravel_soap"'); + } + + return [$wsdl, $configName]; + } +} diff --git a/src/Commands/MakeValidationCommand.php b/src/Commands/MakeValidationCommand.php new file mode 100644 index 0000000..de019c5 --- /dev/null +++ b/src/Commands/MakeValidationCommand.php @@ -0,0 +1,55 @@ +getWsdlAndConfigName($this); + $service = $clientCommand->getGeneratorService($wsdl, $this); + + $generateAllClassMaps = $this->confirm('Do you want to generate for every client method a validation?'); + $methods = collect($service->getOperations()); + $validationClasses = $methods->keys()->toArray(); + if (! $generateAllClassMaps) { + $validationClasses = Arr::wrap($this->anticipate('Which method do you want to generate?', $methods->keys()->toArray())); + } + $validationCode = new Validation($service, $configName, $this->option('dry-run')); + $validationCode->generateValidationFiles($validationClasses); + } +} diff --git a/src/SoapClient.php b/src/SoapClient.php index c980ec9..b5f48fa 100644 --- a/src/SoapClient.php +++ b/src/SoapClient.php @@ -11,6 +11,7 @@ use GuzzleHttp\HandlerStack; use Http\Adapter\Guzzle6\Client; use Http\Client\Exception\HttpException; +use Illuminate\Contracts\Validation\Validator; use Illuminate\Support\Str; use Illuminate\Support\Traits\Macroable; use Phpro\SoapClient\Middleware\BasicAuthMiddleware; @@ -276,6 +277,21 @@ public function debugLastSoapRequest(): array ]; } + /** + * Handle a failed validation attempt. + * + * @param \Illuminate\Contracts\Validation\Validator $validator + * @return Response + */ + protected function failedValidation(Validator $validator) + { + return Response::fromSoapResponse([ + 'success' => false, + 'message' => __('Invalid data.'), + 'errors' => $validator->errors(), + ]); + } + /** * @param $method * @param $parameters @@ -292,7 +308,7 @@ public function __call($method, $parameters) /** * @param string $method - * @param array $arguments + * @param array|Validator $arguments * @return Response */ public function call(string $method, $arguments = []): Response @@ -301,6 +317,12 @@ public function call(string $method, $arguments = []): Response if (! $this->isClientBuilded) { $this->buildClient(); } + if ($arguments instanceof Validator) { + if ($arguments->fails()) { + return $this->failedValidation($arguments); + } + $arguments = $arguments->validated(); + } $result = $this->engine->request($method, $arguments); if ($result instanceof ResultProviderInterface) { $result = Response::fromSoapResponse($result->getResult()); diff --git a/src/SoapServiceProvider.php b/src/SoapServiceProvider.php index 0f10344..57abce7 100644 --- a/src/SoapServiceProvider.php +++ b/src/SoapServiceProvider.php @@ -2,6 +2,8 @@ namespace CodeDredd\Soap; +use CodeDredd\Soap\Commands\MakeClientCommand; +use CodeDredd\Soap\Commands\MakeValidationCommand; use Illuminate\Support\ServiceProvider; class SoapServiceProvider extends ServiceProvider @@ -13,9 +15,7 @@ class SoapServiceProvider extends ServiceProvider */ public function boot() { - $this->publishes([ - dirname(__DIR__, 1).'/config/soap.php' => config_path('soap.php'), - ]); + $this->registerPublishing(); } /** @@ -25,11 +25,16 @@ public function boot() */ public function register() { + $this->mergeConfigFrom( + __DIR__.'/../config/soap.php', 'soap' + ); + $this->registerService(); + $this->registerCommands(); } /** - * Register Horizon's services in the container. + * Register Soap's services in the container. * * @return void */ @@ -39,4 +44,29 @@ protected function registerService() return new SoapFactory(); }); } + + /** + * Register the package's publishable resources. + * + * @return void + */ + private function registerPublishing() + { + if ($this->app->runningInConsole()) { + $this->publishes([ + dirname(__DIR__, 1).'/config/soap.php' => config_path('soap.php'), + ], 'soap-config'); + } + } + + /** + * Register Soap commands. + * + * @return void + */ + protected function registerCommands() + { + $this->commands(MakeClientCommand::class); + $this->commands(MakeValidationCommand::class); + } } diff --git a/src/Types/Generator.php b/src/Types/Generator.php new file mode 100644 index 0000000..c41754c --- /dev/null +++ b/src/Types/Generator.php @@ -0,0 +1,137 @@ +config = new Config([ + 'inputFile' => $wsdl, + 'outputDir' => '/tmp/output', + ]); + + $this->log('Starting generation'); + + // Warn users who have disabled SOAP_SINGLE_ELEMENT_ARRAYS. + // Note that this can be + $options = $this->config->get('soapClientOptions'); + if (empty($options['features']) || + (($options['features'] & SOAP_SINGLE_ELEMENT_ARRAYS) != SOAP_SINGLE_ELEMENT_ARRAYS)) { + $message = ['SoapClient option feature SOAP_SINGLE_ELEMENT_ARRAYS is not set.', + 'This is not recommended as data types in DocBlocks for array properties will not be ', + 'valid if the array only contains a single value.', ]; + $this->log(implode(PHP_EOL, $message), 'warning'); + } + $this->load($wsdl); + } + + public function getTypes() + { + return $this->types; + } + + public function getService() + { + return $this->service; + } + + protected function loadService() + { + $service = $this->wsdl->getService(); + $this->log('Starting to load service '.$service->getName()); + + $this->service = new Service($this->config, $service->getName(), $this->types, $service->getDocumentation()); + + foreach ($this->wsdl->getOperations() as $function) { + $this->log('Loading function '.$function->getName()); + + $this->service->addOperation(new Operation($function->getName(), $function->getParams(), $function->getDocumentation(), $function->getReturns())); + } + + $this->log('Done loading service '.$service->getName()); + } + + /** + * Loads all type classes. + */ + protected function loadTypes() + { + $this->log('Loading types'); + + $types = $this->wsdl->getTypes(); + + foreach ($types as $typeNode) { + $type = null; + + if ($typeNode->isComplex()) { + if ($typeNode->isArray()) { + $type = new ArrayType($this->config, $typeNode->getName()); + } else { + $type = new ComplexType($this->config, $typeNode->getName()); + } + + $this->log('Loading type '.$type->getPhpIdentifier()); + + $type->setAbstract($typeNode->isAbstract()); + + foreach ($typeNode->getParts() as $name => $typeName) { + // There are 2 ways a wsdl can indicate that a field accepts the null value - + // by setting the "nillable" attribute to "true" or by setting the "minOccurs" attribute to "0". + // See http://www.ibm.com/developerworks/webservices/library/ws-tip-null/index.html + $nullable = $typeNode->isElementNillable($name) || $typeNode->getElementMinOccurs($name) === 0; + $type->addMember($typeName, $name, $nullable); + } + } elseif ($enumValues = $typeNode->getEnumerations()) { + $type = new Enum($this->config, $typeNode->getName(), $typeNode->getRestriction()); + array_walk($enumValues, function ($value) use ($type) { + $type->addValue($value); + }); + } elseif ($pattern = $typeNode->getPattern()) { + $type = new Pattern($this->config, $typeNode->getName(), $typeNode->getRestriction()); + $type->setValue($pattern); + } + + if ($type != null) { + $already_registered = false; + if ($this->config->get('sharedTypes')) { + foreach ($this->types as $registered_types) { + if ($registered_types->getIdentifier() == $type->getIdentifier()) { + $already_registered = true; + break; + } + } + } + if (! $already_registered) { + $this->types[$typeNode->getName()] = $type; + } + } + } + + // Loop through all types again to setup class inheritance. + // We can only do this once all types have been loaded. Otherwise we risk referencing types which have not been + // loaded yet. + foreach ($types as $type) { + if (($baseType = $type->getBase()) && isset($this->types[$baseType]) && $this->types[$baseType] instanceof ComplexType) { + $this->types[$type->getName()]->setBaseType($this->types[$baseType]); + } + } + + $this->log('Done loading types'); + } +} diff --git a/src/Types/Service.php b/src/Types/Service.php new file mode 100644 index 0000000..9202da1 --- /dev/null +++ b/src/Types/Service.php @@ -0,0 +1,50 @@ + + * Date: 27.04.2020 + * Time: 17:21. + */ + +namespace CodeDredd\Soap\Types; + +use Wsdl2PhpGenerator\ConfigInterface; +use Wsdl2PhpGenerator\Operation; + +class Service extends \Wsdl2PhpGenerator\Service +{ + protected $operations; + + public function __construct(ConfigInterface $config, $identifier, array $types, $description) + { + $this->operations = []; + parent::__construct($config, $identifier, $types, $description); + } + + public function getOperations() + { + return $this->operations; + } + + /** + * Returns an operation provided by the service based on its name. + * + * @param string $operationName the name of the operation + * + * @return Operation|null the operation or null if it does not exist + */ + public function getOperation($operationName) + { + return isset($this->operations[$operationName]) ? $this->operations[$operationName] : null; + } + + /** + * Add an operation to the service. + * + * @param Operation $operation the operation to be added + */ + public function addOperation(Operation $operation) + { + $this->operations[$operation->getName()] = $operation; + } +} diff --git a/tests/TestCase.php b/tests/TestCase.php index e589d96..5bb49f9 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,10 +1,4 @@ - * Date: 15.04.2020 - * Time: 15:30. - */ namespace CodeDredd\Soap\Tests; @@ -16,7 +10,8 @@ abstract class TestCase extends OrchestraTestCase { /** * Load package service provider. - * @param \Illuminate\Foundation\Application $app + * @param \Illuminate\Foundation\Application $app + * @return string[] */ protected function getPackageProviders($app) { @@ -45,11 +40,13 @@ protected function getEnvironmentSetUp($app) { // Setup default wsse $app['config']->set('soap.clients.laravel_soap', [ - 'base_wsdl' => 'laravel_soap.wsdl', + 'base_wsdl' => __DIR__.'/Fixtures/Wsdl/weather.wsdl', 'with_wsse' => [ 'user_token_name' => 'username', 'user_token_password' => 'password', ], ]); + $app['config']->set('soap.code.path', __DIR__.'/app'); + $app['config']->set('soap.code.namespace', 'App\\Soap'); } } diff --git a/tests/Unit/Commands/MakeClientCommandTest.php b/tests/Unit/Commands/MakeClientCommandTest.php new file mode 100644 index 0000000..0762871 --- /dev/null +++ b/tests/Unit/Commands/MakeClientCommandTest.php @@ -0,0 +1,14 @@ +artisan('soap:make:client --dry-run') + ->expectsQuestion('Please type the wsdl or the name of your client configuration if u have defined one in the config "soap.php"', 'laravel_soap'); + } +} diff --git a/tests/Unit/Commands/MakeValidationCommandTest.php b/tests/Unit/Commands/MakeValidationCommandTest.php new file mode 100644 index 0000000..e49f7f7 --- /dev/null +++ b/tests/Unit/Commands/MakeValidationCommandTest.php @@ -0,0 +1,16 @@ +artisan('soap:make:validation --dry-run') + ->expectsQuestion('Please type the wsdl or the name of your client configuration if u have defined one in the config "soap.php"', 'laravel_soap') + ->expectsConfirmation('Do you want to generate for every client method a validation?', 'no') + ->expectsQuestion('Which method do you want to generate?', 'GetWeatherInformation'); + } +}